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


Commits:
0afdd0f1 by wurstsalat at 2022-07-17T21:59:20+02:00
Fix linting errors

- - - - -


4 changed files:

- gajim/gtk/chat_function_page.py
- gajim/gtk/controls/groupchat.py
- gajim/gtk/message_actions_box.py
- gajim/gtk/message_input.py


Changes:

=====================================
gajim/gtk/chat_function_page.py
=====================================
@@ -16,7 +16,6 @@
 
 from typing import Optional
 
-from gi.repository import Gdk
 from gi.repository import GObject
 from gi.repository import Gtk
 from gi.repository import Pango


=====================================
gajim/gtk/controls/groupchat.py
=====================================
@@ -61,7 +61,6 @@
 from gajim.gui.dialogs import ConfirmationDialog
 from gajim.gui.groupchat_roster import GroupchatRoster
 from gajim.gui.groupchat_state import GroupchatState
-from gajim.gui.util import open_window
 
 log = logging.getLogger('gajim.gui.controls.groupchat')
 


=====================================
gajim/gtk/message_actions_box.py
=====================================
@@ -181,6 +181,7 @@ def _on_action(self,
 
     def switch_contact(self, contact: ChatContactT) -> None:
         if self._client is not None:
+            self._set_chatstate(False)
             self._client.disconnect_all_from_obj(self)
 
         if self._contact is not None:
@@ -211,7 +212,7 @@ def switch_contact(self, contact: ChatContactT) -> None:
         self._set_encryption_details(encryption)
 
         self._set_spell_checker_language(contact)
-        self._set_chatstate()
+        self._set_chatstate(True)
 
         self.msg_textview.switch_contact(contact)
         self._security_label_selector.switch_contact(contact)
@@ -250,18 +251,18 @@ def _update_message_input_state(self) -> None:
         self.msg_textview.set_sensitive(state)
         self.msg_textview.set_editable(state)
 
-    def _set_chatstate(self) -> None:
-        return #TODO
+    def _set_chatstate(self, state: bool) -> None:
+        assert self._client is not None
         if state:
             if self.msg_textview.has_text():
                 self._client.get_module('Chatstate').set_chatstate(
-                    self.contact, Chatstate.PAUSED)
+                    self._contact, Chatstate.PAUSED)
             else:
                 self._client.get_module('Chatstate').set_chatstate(
-                    self.contact, Chatstate.ACTIVE)
+                    self._contact, Chatstate.ACTIVE)
         else:
             self._client.get_module('Chatstate').set_chatstate(
-                self.contact, Chatstate.INACTIVE)
+                self._contact, Chatstate.INACTIVE)
 
     def _set_encryption_state(self, state: str) -> None:
         action = app.window.lookup_action('set-encryption')
@@ -565,7 +566,7 @@ def _on_textview_key_press_event(self,
             app.window.activate_action('send-message', None)
             return True
 
-        elif event.keyval == Gdk.KEY_z:  # CTRL+z
+        if event.keyval == Gdk.KEY_z:  # CTRL+z
             if event_state & Gdk.ModifierType.CONTROL_MASK:
                 self.msg_textview.undo()
                 return True


=====================================
gajim/gtk/message_input.py
=====================================
@@ -346,20 +346,17 @@ def _on_populate_popup(self,
         assert isinstance(menu, Gtk.Menu)
         item = Gtk.MenuItem.new_with_mnemonic(_('_Undo'))
         menu.prepend(item)
-        id_ = item.connect('activate', self.undo)
-        # self.handlers[id_] = item
+        item.connect('activate', self.undo)
 
         item = Gtk.SeparatorMenuItem()
         menu.prepend(item)
 
         item = Gtk.MenuItem.new_with_mnemonic(_('_Clear'))
         menu.prepend(item)
-        id_ = item.connect('activate', self.clear)
-        # self.handlers[id_] = item
+        item.connect('activate', self.clear)
 
         paste_item = Gtk.MenuItem.new_with_label(_('Paste as quote'))
-        id_ = paste_item.connect('activate', self._paste_clipboard_as_quote)
-        # self.handlers[id_] = paste_item
+        paste_item.connect('activate', self._paste_clipboard_as_quote)
         menu.append(paste_item)
 
         menu.show_all()



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/0afdd0f1164959c499fc3a28bb3e40df02c07056

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/0afdd0f1164959c499fc3a28bb3e40df02c07056
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

Reply via email to