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

Commits:

5 changed files:

Changes:

  • gajim/gtk/chat_action_processor.py
    ... ... @@ -16,7 +16,6 @@
    16 16
     
    
    17 17
     from typing import cast
    
    18 18
     from typing import Optional
    
    19
    -from typing import TYPE_CHECKING
    
    20 19
     
    
    21 20
     from gi.repository import Gdk
    
    22 21
     from gi.repository import Gio
    
    ... ... @@ -31,14 +30,12 @@
    31 30
     from .emoji_data_gtk import get_emoji_data
    
    32 31
     from .groupchat_nick_completion import GroupChatNickCompletion
    
    33 32
     
    
    34
    -if TYPE_CHECKING:
    
    35
    -    from .message_input import MessageInputTextView
    
    36 33
     
    
    37 34
     MAX_ENTRIES = 5
    
    38 35
     
    
    39 36
     
    
    40 37
     class ChatActionProcessor(Gtk.Popover):
    
    41
    -    def __init__(self, message_input: MessageInputTextView) -> None:
    
    38
    +    def __init__(self, message_input: Gtk.TextView) -> None:
    
    42 39
             Gtk.Popover.__init__(self)
    
    43 40
             self._menu = Gio.Menu()
    
    44 41
             self.bind_model(self._menu)
    
    ... ... @@ -75,7 +72,7 @@ def _on_destroy(self, _popover: Gtk.Popover) -> None:
    75 72
             app.check_finalize(self)
    
    76 73
     
    
    77 74
         def _on_key_press(self,
    
    78
    -                      textview: MessageInputTextView,
    
    75
    +                      textview: Gtk.TextView,
    
    79 76
                           event: Gdk.EventKey
    
    80 77
                           ) -> bool:
    
    81 78
             if isinstance(self._contact, GroupchatContact):
    
    ... ... @@ -125,7 +122,7 @@ def _get_commands(self) -> list[tuple[str, str]]:
    125 122
             assert self._contact is not None
    
    126 123
             return app.commands.get_commands(self._contact.type_string)
    
    127 124
     
    
    128
    -    def _on_changed(self, _textview: MessageInputTextView) -> None:
    
    125
    +    def _on_changed(self, _text_buffer: Gtk.TextBuffer) -> None:
    
    129 126
             insert = self._buf.get_insert()
    
    130 127
             self._current_iter = self._buf.get_iter_at_mark(insert)
    
    131 128
             current_offset = self._current_iter.get_offset()
    

  • gajim/gtk/conversation/message_widget.py
    ... ... @@ -86,7 +86,7 @@ def add_content(self, content: ContentT) -> None:
    86 86
                     message_widget = MessageWidget(self._account, self._selectable)
    
    87 87
                     message_widget.add_content(block)
    
    88 88
                     widget = QuoteWidget(self._account)
    
    89
    -                widget.attach_message_widget(message_widget)
    
    89
    +                widget.add(message_widget)
    
    90 90
                     self.add(widget)
    
    91 91
                     continue
    
    92 92
     
    

  • gajim/gtk/conversation/quote_widget.py
    ... ... @@ -14,13 +14,8 @@
    14 14
     
    
    15 15
     from __future__ import annotations
    
    16 16
     
    
    17
    -import typing
    
    18
    -
    
    19 17
     from gi.repository import Gtk
    
    20 18
     
    
    21
    -if typing.TYPE_CHECKING:
    
    22
    -    from .message_widget import MessageWidget
    
    23
    -
    
    24 19
     
    
    25 20
     class QuoteWidget(Gtk.Box):
    
    26 21
         def __init__(self, account: str) -> None:
    
    ... ... @@ -32,16 +27,3 @@ def __init__(self, account: str) -> None:
    32 27
             quote_bar.set_margin_end(6)
    
    33 28
             quote_bar.get_style_context().add_class('conversation-quote-bar')
    
    34 29
             self.add(quote_bar)
    35
    -
    
    36
    -        self._account = account
    
    37
    -
    
    38
    -        self._message_widget = None
    
    39
    -
    
    40
    -    def attach_message_widget(self, message_widget: MessageWidget) -> None:
    
    41
    -
    
    42
    -        # Purpose of this method is to prevent circular imports
    
    43
    -        if self._message_widget is not None:
    
    44
    -            raise ValueError(
    
    45
    -                'QuoteWidget already has a MessageWidget attached')
    
    46
    -        self._message_widget = message_widget
    
    47
    -        self.add(message_widget)

  • gajim/gtk/groupchat_nick_completion.py
    ... ... @@ -15,12 +15,12 @@
    15 15
     from __future__ import annotations
    
    16 16
     
    
    17 17
     from typing import Optional
    
    18
    -from typing import TYPE_CHECKING
    
    19 18
     
    
    20 19
     import logging
    
    21 20
     
    
    22 21
     from nbxmpp.structs import PresenceProperties
    
    23 22
     
    
    23
    +from gi.repository import Gtk
    
    24 24
     from gi.repository import Gdk
    
    25 25
     
    
    26 26
     from gajim.common import app
    
    ... ... @@ -31,8 +31,6 @@
    31 31
     from gajim.common.helpers import jid_is_blocked
    
    32 32
     from gajim.common.helpers import message_needs_highlight
    
    33 33
     
    
    34
    -if TYPE_CHECKING:
    
    35
    -    from .message_input import MessageInputTextView
    
    36 34
     
    
    37 35
     log = logging.getLogger('gajim.gui.groupchat_nick_completion')
    
    38 36
     
    
    ... ... @@ -186,7 +184,7 @@ def _nick_matching(nick: str) -> bool:
    186 184
             return matches + other_nicks
    
    187 185
     
    
    188 186
         def process_key_press(self,
    
    189
    -                          textview: MessageInputTextView,
    
    187
    +                          textview: Gtk.TextView,
    
    190 188
                               event: Gdk.EventKey
    
    191 189
                               ) -> bool:
    
    192 190
             if (event.get_state() & Gdk.ModifierType.SHIFT_MASK or
    

  • pyrightconfig.json
    ... ... @@ -2,7 +2,6 @@
    2 2
         "pythonPlatform": "All",
    
    3 3
         "pythonVersion": "3.9",
    
    4 4
         "typeCheckingMode": "strict",
    
    5
    -    "reportImportCycles": "none",
    
    6 5
         "reportUnnecessaryTypeIgnoreComment": "error",
    
    7 6
         "reportPropertyTypeMismatch": "error",
    
    8 7
         "reportMissingModuleSource": "none",