Daniel Brötzmann pushed to branch newcontrol at gajim / gajim
Commits:
ef7e143b by wurstsalat at 2022-07-31T23:24:14+02:00
chore: MessageActionBox: Add asserts
- - - - -
9994e499 by wurstsalat at 2022-07-31T23:24:50+02:00
chore: Main: Adapt _on_window_motion_notify
- - - - -
3 changed files:
- gajim/gtk/chat_stack.py
- gajim/gtk/main.py
- gajim/gtk/message_actions_box.py
Changes:
=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -142,6 +142,9 @@ def process_escape(self) -> bool:
def get_control_stack(self) -> ControlStack:
return self._control_stack
+ def get_message_action_box(self) -> MessageActionsBox:
+ return self._message_action_box
+
def show_chat(self, account: str, jid: JID) -> None:
# Store (preserve) primary clipboard and restore it after switching
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
=====================================
gajim/gtk/main.py
=====================================
@@ -464,12 +464,12 @@ def _on_window_motion_notify(self,
if control is None:
return
- return
- # TODO
if self.get_property('has-toplevel-focus'):
client = app.get_client(control.account)
+ chat_stack = self._chat_page.get_chat_stack()
+ msg_action_box = chat_stack.get_message_action_box()
client.get_module('Chatstate').set_mouse_activity(
- control.contact, control.msg_textview.has_text())
+ control.contact, msg_action_box.msg_textview.has_text())
def _on_window_delete(self,
_widget: Gtk.ApplicationWindow,
=====================================
gajim/gtk/message_actions_box.py
=====================================
@@ -121,6 +121,7 @@ def __init__(self) -> None:
self._connect_actions()
def _get_encryption_state(self) -> tuple[bool, str]:
+ assert self._contact is not None
encryption = self._contact.settings.get('encryption')
return bool(encryption), encryption
@@ -310,7 +311,9 @@ def _change_encryption(self,
) -> None:
new_state = param.get_string()
- current_state = action.get_state().get_string()
+ action_state = action.get_state()
+ assert action_state is not None
+ current_state = action_state.get_string()
if current_state == new_state:
return
@@ -493,6 +496,7 @@ def _update_send_file_button_tooltip(self):
self._ui.sendfile_button.set_tooltip_text(tooltip_text)
return
+ assert self._contact is not None
client = app.get_client(self._contact.account)
tooltip_text = _('Send File…')
@@ -593,6 +597,7 @@ def _on_msg_textview_key_press_event(self,
textview.insert_newline()
return True
+ assert self._contact is not None
if not app.account_is_available(self._contact.account):
# we are not connected
ErrorDialog(
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/4486547a7f2e0fd65ad6f37ee6b52f3ee1d5355b...9994e49909a67402374d6aec13f5cb281593320b
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/4486547a7f2e0fd65ad6f37ee6b52f3ee1d5355b...9994e49909a67402374d6aec13f5cb281593320b
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