Philipp Hörist pushed to branch master at gajim / gajim


Commits:
111dd675 by lovetox at 2021-12-27T15:13:05+01:00
QuoteWidget: Add type annotations

- - - - -
8269253f by lovetox at 2021-12-27T15:17:06+01:00
JumpToEndButton: Add type annotations

- - - - -
578979c7 by lovetox at 2021-12-27T15:17:29+01:00
Update pyrightconfig.json

- - - - -


4 changed files:

- gajim/gtk/conversation/jump_to_end_button.py
- gajim/gtk/conversation/quote_widget.py
- gajim/gtk/types.py
- pyrightconfig.json


Changes:

=====================================
gajim/gtk/conversation/jump_to_end_button.py
=====================================
@@ -12,9 +12,20 @@
 # You should have received a copy of the GNU General Public License
 # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import annotations
+
+from typing import Union
+
 from gi.repository import GObject
 from gi.repository import Gtk
 
+from gajim.common.modules.contacts import GroupchatContact
+from gajim.common.modules.contacts import GroupchatParticipant
+from gajim.common.modules.contacts import BareContact
+
+
+ContactT = Union[BareContact, GroupchatContact, GroupchatParticipant]
+
 
 class JumpToEndButton(Gtk.Overlay):
 
@@ -25,7 +36,7 @@ class JumpToEndButton(Gtk.Overlay):
             ()),
     }
 
-    def __init__(self, contact):
+    def __init__(self, contact: ContactT) -> None:
         Gtk.Overlay.__init__(self)
         self.set_halign(Gtk.Align.END)
         self.set_valign(Gtk.Align.END)
@@ -51,7 +62,7 @@ def __init__(self, contact):
         self._unread_label.get_style_context().add_class(
             'unread-counter')
 
-        if contact.is_groupchat and not contact.can_notify():
+        if isinstance(contact, GroupchatContact) and not contact.can_notify():
             self._unread_label.get_style_context().add_class(
                 'unread-counter-silent')
 
@@ -65,7 +76,7 @@ def __init__(self, contact):
         self._count = 0
         self.set_no_show_all(True)
 
-    def _on_jump_clicked(self, _button):
+    def _on_jump_clicked(self, _button: Gtk.Button) -> None:
         self.emit('clicked')
 
     def toggle(self, visible: bool) -> None:


=====================================
gajim/gtk/conversation/quote_widget.py
=====================================
@@ -12,8 +12,12 @@
 # You should have received a copy of the GNU General Public License
 # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import annotations
+
 from gi.repository import Gtk
 
+from .. import types
+
 
 class QuoteWidget(Gtk.Box):
     def __init__(self, account: str) -> None:
@@ -30,7 +34,9 @@ def __init__(self, account: str) -> None:
 
         self._message_widget = None
 
-    def attach_message_widget(self, message_widget):
+    def attach_message_widget(self,
+                              message_widget: types.MessageWidget) -> None:
+
         # Purpose of this method is to prevent circular imports
         if self._message_widget is not None:
             raise ValueError(


=====================================
gajim/gtk/types.py
=====================================
@@ -21,6 +21,7 @@
     from .controls.chat import ChatControl
     from .controls.private import PrivateChatControl
     from .controls.groupchat import GroupchatControl
+    from .conversation.message_widget import MessageWidget
     from .conversation.rows.call import CallRow
     from .conversation.rows.command_output import CommandOutputRow
     from .conversation.rows.date import DateRow


=====================================
pyrightconfig.json
=====================================
@@ -13,10 +13,22 @@
     "pythonVersion": "3.9",
     "typeCheckingMode": "strict",
     "include": [
-        "gajim/gtk/chat_filter.py",
+        "gajim/common/cert_store.py",
         "gajim/gtk/app_side_bar.py",
-        "gajim/gtk/status_selector.py",
+        "gajim/gtk/chat_filter.py",
+        "gajim/gtk/conversation/code_widget.py",
+        "gajim/gtk/conversation/jump_to_end_button.py",
+        "gajim/gtk/conversation/quote_widget.py",
+        "gajim/gtk/conversation/rows/command_output.py",
+        "gajim/gtk/conversation/rows/date.py",
+        "gajim/gtk/conversation/rows/info.py",
+        "gajim/gtk/conversation/rows/muc_join_left.py",
+        "gajim/gtk/conversation/rows/muc_subject.py",
+        "gajim/gtk/conversation/rows/muc_user_status.py",
+        "gajim/gtk/conversation/rows/scroll_hint.py",
+        "gajim/gtk/conversation/rows/widgets.py",
+        "gajim/gtk/conversation/scrolled.py",
         "gajim/gtk/status_message_selector.py",
-        "gajim/common/cert_store.py"
+        "gajim/gtk/status_selector.py",
     ],
 }



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/e78b5932f22e06228192185cfdbbe981ac55617d...578979c7da0774757e1fb4d5190e22b936b73d03

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/e78b5932f22e06228192185cfdbbe981ac55617d...578979c7da0774757e1fb4d5190e22b936b73d03
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