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

Commits:

3 changed files:

Changes:

  • gajim/gtk/chat_stack.py
    ... ... @@ -304,6 +304,7 @@ def _on_action(self,
    304 304
                 open_window('AddContact', account=account, jid=jid)
    
    305 305
     
    
    306 306
             elif action_name == 'clear-chat':
    
    307
    +            assert current_control is not None
    
    307 308
                 current_control.reset_view()
    
    308 309
     
    
    309 310
             elif action_name == 'show-contact-info':
    
    ... ... @@ -386,6 +387,7 @@ def _on_send_message(self) -> None:
    386 387
             message = self._message_action_box.msg_textview.get_text()
    
    387 388
     
    
    388 389
             control = self._control_stack.get_current_control()
    
    390
    +        assert control is not None
    
    389 391
     
    
    390 392
             action = app.window.lookup_action('set-encryption')
    
    391 393
             assert action is not None
    

  • gajim/gtk/control_stack.py
    ... ... @@ -40,7 +40,7 @@ def __init__(self):
    40 40
     
    
    41 41
             self.show_all()
    
    42 42
             self._controls: dict[tuple[str, JID], ControlT] = {}
    
    43
    -        self._current_control = None
    
    43
    +        self._current_control: Optional[ControlT] = None
    
    44 44
     
    
    45 45
         def get_control(self, account: str, jid: JID) -> Optional[ControlT]:
    
    46 46
             try:
    
    ... ... @@ -48,7 +48,7 @@ def get_control(self, account: str, jid: JID) -> Optional[ControlT]:
    48 48
             except KeyError:
    
    49 49
                 return None
    
    50 50
     
    
    51
    -    def get_current_control(self) -> ControlT:
    
    51
    +    def get_current_control(self) -> Optional[ControlT]:
    
    52 52
             return self._current_control
    
    53 53
     
    
    54 54
         def get_controls(self, account: Optional[str]
    

  • test/no_gui/test_nick_completion.py
    1 1
     import unittest
    
    2
    -from unittest.mock import MagicMock
    
    3 2
     
    
    4 3
     from gajim import gui
    
    5 4
     gui.init('gtk')
    
    ... ... @@ -10,8 +9,7 @@
    10 9
     class Test(unittest.TestCase):
    
    11 10
     
    
    12 11
         def test_generate_suggestions(self):
    
    13
    -        message_input = MagicMock()
    
    14
    -        gen = GroupChatNickCompletion(message_input)
    
    12
    +        gen = GroupChatNickCompletion()
    
    15 13
     
    
    16 14
             l = ['aaaa', 'fooo', 'xxxxz', 'xaaaz']
    
    17 15
             for n in l:
    
    ... ... @@ -45,7 +43,7 @@ def test_generate_suggestions(self):
    45 43
             old_name = 'aaaa'
    
    46 44
             new_name = 'bbbb'
    
    47 45
     
    
    48
    -        for lst in (gen._attention_list, gen._sender_list):
    
    46
    +        for lst in (gen._highlight_list, gen._sender_list):
    
    49 47
                 for idx, contact in enumerate(lst):
    
    50 48
                     if contact == old_name:
    
    51 49
                         lst[idx] = new_name