Daniel Brötzmann pushed to branch newcontrol at gajim / gajim
Commits:
961310be by wurstsalat at 2022-07-17T16:13:06+02:00
ChatStack: Process escape press
- - - - -
4 changed files:
- gajim/gtk/chat_function_page.py
- gajim/gtk/chat_page.py
- gajim/gtk/chat_stack.py
- gajim/gtk/main.py
Changes:
=====================================
gajim/gtk/chat_function_page.py
=====================================
@@ -85,16 +85,14 @@ def __init__(self) -> None:
button_box.pack_end(self._confirm_button, False, True, 0)
self.add(button_box)
- self.connect('key-press-event', self._on_key_press)
- def _on_key_press(self, _widget: Gtk.Widget, event: Gdk.EventKey) -> None:
- if event.keyval == Gdk.KEY_Escape:
- close_control = self._mode in (
- 'join-failed',
- 'creation-failed',
- 'config-failed',
- 'captcha-error')
- self.emit('finish', close_control)
+ def process_escape(self) -> None:
+ close_control = self._mode in (
+ 'join-failed',
+ 'creation-failed',
+ 'config-failed',
+ 'captcha-error')
+ self.emit('finish', close_control)
def _clear(self) -> None:
for child in self._content_box.get_children():
=====================================
gajim/gtk/chat_page.py
=====================================
@@ -121,6 +121,9 @@ def set_startup_finished(self) -> None:
def get_chat_list_stack(self) -> ChatListStack:
return self._chat_list_stack
+ def get_chat_stack(self) -> ChatStack:
+ return self._chat_stack
+
def get_control_stack(self) -> ControlStack:
return self._control_stack
=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -87,6 +87,12 @@ def _get_current_contact(self) -> ChatContactT:
assert self._current_contact is not None
return self._current_contact
+ def process_escape(self) -> bool:
+ if self.get_visible_child_name() == 'function':
+ self._chat_function_page.process_escape()
+ return True
+ return False
+
def get_control_stack(self) -> ControlStack:
return self._control_stack
=====================================
gajim/gtk/main.py
=====================================
@@ -391,6 +391,10 @@ def _on_action(self,
if action_name == 'escape' and self._chat_page.hide_search():
return None
+ chat_stack = self._chat_page.get_chat_stack()
+ if action_name == 'escape' and chat_stack.process_escape():
+ return None
+
control = self.get_active_control()
if control is not None:
if action_name == 'change-nickname':
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/961310be27cea8672542dae536b0c9d15ab0233c
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/961310be27cea8672542dae536b0c9d15ab0233c
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits