Philipp Hörist pushed to branch unify-control at gajim / gajim


Commits:
b887b1a4 by lovetox at 2022-08-09T12:00:16+02:00
cq: Fix typo

- - - - -
72b87682 by lovetox at 2022-08-09T12:15:35+02:00
fix: Fix some asserts and attr access

- - - - -


2 changed files:

- gajim/gtk/control.py
- gajim/gtk/main.py


Changes:

=====================================
gajim/gtk/control.py
=====================================
@@ -125,18 +125,18 @@ def client(self) -> types.Client:
         return self._client
 
     def is_loaded(self, account: str, jid: JID) -> bool:
-        if self.contact is None:
+        if self._contact is None:
             return False
         return self.contact.account == account and self.contact.jid == jid
 
     def has_active_chat(self) -> bool:
-        return self.contact is not None
+        return self._contact is not None
 
     def clear(self) -> None:
         log.info('Clear')
 
-        if self.contact is not None:
-            self.contact.disconnect_all_from_obj(self)
+        if self._contact is not None:
+            self._contact.disconnect_all_from_obj(self)
 
         self._contact = None
         self._client = None
@@ -194,10 +194,13 @@ def switch_contact(self, contact: Union[BareContact,
         self._client.get_module('Chatstate').set_active(contact)
 
     def process_event(self, event: events.MainEventT) -> None:
-        if event.account != self.contact.account:
+        if self._contact is None:
+            return
+
+        if event.account != self._contact.account:
             return
 
-        if event.jid not in (self.contact.jid, self.contact.jid.bare):
+        if event.jid not in (self._contact.jid, self._contact.jid.bare):
             return
 
         file_transfer_events = (
@@ -758,7 +761,7 @@ def _on_user_status_show_changed(self,
                                      properties: PresenceProperties
                                      ) -> None:
 
-        # TODO: This cant work
+        # TODO: This does not work
         return
         if isinstance(self.contact, GroupchatContact):
             if not contact.settings.get('print_status'):


=====================================
gajim/gtk/main.py
=====================================
@@ -421,12 +421,12 @@ def _on_action(self,
 
             if action_name == 'escape':
                 if app.settings.get('escape_key_closes'):
-                    self._chat_page.remove_chat(control.account,
+                    self._chat_page.remove_chat(control.contact.account,
                                                 control.contact.jid)
                     return None
 
             elif action_name == 'close-tab':
-                self._chat_page.remove_chat(control.account,
+                self._chat_page.remove_chat(control.contact.account,
                                             control.contact.jid)
                 return None
 
@@ -490,7 +490,7 @@ def _on_window_motion_notify(self,
             return
 
         if self.get_property('has-toplevel-focus'):
-            client = app.get_client(control.account)
+            client = app.get_client(control.contact.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(
@@ -822,7 +822,7 @@ def _on_window_active(self,
             return
 
         if control.get_autoscroll():
-            self.mark_as_read(control.account, control.contact.jid)
+            self.mark_as_read(control.contact.account, control.contact.jid)
 
     @staticmethod
     def contact_info(account: str, jid: str) -> None:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/c121701810eba287c97afa63303ad6c9b27c8fa1...72b876820f3257191bfcb1deaa6251b0e82b4bf7

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/c121701810eba287c97afa63303ad6c9b27c8fa1...72b876820f3257191bfcb1deaa6251b0e82b4bf7
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to