Daniel Brötzmann pushed to branch newcontrol at gajim / gajim

Commits:

4 changed files:

Changes:

  • gajim/gtk/chat_function_page.py
    ... ... @@ -85,16 +85,14 @@ def __init__(self) -> None:
    85 85
             button_box.pack_end(self._confirm_button, False, True, 0)
    
    86 86
     
    
    87 87
             self.add(button_box)
    
    88
    -        self.connect('key-press-event', self._on_key_press)
    
    89 88
     
    
    90
    -    def _on_key_press(self, _widget: Gtk.Widget, event: Gdk.EventKey) -> None:
    
    91
    -        if event.keyval == Gdk.KEY_Escape:
    
    92
    -            close_control = self._mode in (
    
    93
    -                'join-failed',
    
    94
    -                'creation-failed',
    
    95
    -                'config-failed',
    
    96
    -                'captcha-error')
    
    97
    -            self.emit('finish', close_control)
    
    89
    +    def process_escape(self) -> None:
    
    90
    +        close_control = self._mode in (
    
    91
    +            'join-failed',
    
    92
    +            'creation-failed',
    
    93
    +            'config-failed',
    
    94
    +            'captcha-error')
    
    95
    +        self.emit('finish', close_control)
    
    98 96
     
    
    99 97
         def _clear(self) -> None:
    
    100 98
             for child in self._content_box.get_children():
    

  • gajim/gtk/chat_page.py
    ... ... @@ -121,6 +121,9 @@ def set_startup_finished(self) -> None:
    121 121
         def get_chat_list_stack(self) -> ChatListStack:
    
    122 122
             return self._chat_list_stack
    
    123 123
     
    
    124
    +    def get_chat_stack(self) -> ChatStack:
    
    125
    +        return self._chat_stack
    
    126
    +
    
    124 127
         def get_control_stack(self) -> ControlStack:
    
    125 128
             return self._control_stack
    
    126 129
     
    

  • gajim/gtk/chat_stack.py
    ... ... @@ -87,6 +87,12 @@ def _get_current_contact(self) -> ChatContactT:
    87 87
             assert self._current_contact is not None
    
    88 88
             return self._current_contact
    
    89 89
     
    
    90
    +    def process_escape(self) -> bool:
    
    91
    +        if self.get_visible_child_name() == 'function':
    
    92
    +            self._chat_function_page.process_escape()
    
    93
    +            return True
    
    94
    +        return False
    
    95
    +
    
    90 96
         def get_control_stack(self) -> ControlStack:
    
    91 97
             return self._control_stack
    
    92 98
     
    

  • gajim/gtk/main.py
    ... ... @@ -391,6 +391,10 @@ def _on_action(self,
    391 391
             if action_name == 'escape' and self._chat_page.hide_search():
    
    392 392
                 return None
    
    393 393
     
    
    394
    +        chat_stack = self._chat_page.get_chat_stack()
    
    395
    +        if action_name == 'escape' and chat_stack.process_escape():
    
    396
    +            return None
    
    397
    +
    
    394 398
             control = self.get_active_control()
    
    395 399
             if control is not None:
    
    396 400
                 if action_name == 'change-nickname':