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

Commits:

5 changed files:

Changes:

  • gajim/common/helpers.py
    ... ... @@ -466,13 +466,14 @@ def get_contact_dict_for_account(account: str) -> dict[str, types.BareContact]:
    466 466
     
    
    467 467
     
    
    468 468
     def play_sound(sound_event: str,
    
    469
    -               account: str,
    
    469
    +               account: Optional[str] = None,
    
    470 470
                    force: bool = False,
    
    471 471
                    loop: bool = False) -> None:
    
    472 472
     
    
    473 473
         if sound_event is None:
    
    474 474
             return
    
    475
    -    if force or allow_sound_notification(account, sound_event):
    
    475
    +    if (force or account is None or
    
    476
    +            allow_sound_notification(account, sound_event)):
    
    476 477
             play_sound_file(
    
    477 478
                 app.settings.get_soundevent_settings(sound_event)['path'], loop)
    
    478 479
     
    

  • gajim/gtk/account_side_bar.py
    ... ... @@ -14,8 +14,8 @@
    14 14
     
    
    15 15
     from __future__ import annotations
    
    16 16
     
    
    17
    -from typing import List
    
    18 17
     from typing import Optional
    
    18
    +from typing import cast
    
    19 19
     
    
    20 20
     from gi.repository import Gtk
    
    21 21
     
    
    ... ... @@ -34,7 +34,7 @@ def __init__(self) -> None:
    34 34
             self.get_style_context().add_class('account-sidebar')
    
    35 35
             self.connect('row-activated', self._on_row_activated)
    
    36 36
     
    
    37
    -        self._accounts: List[str] = list(app.connections.keys())
    
    37
    +        self._accounts: list[str] = list(app.connections.keys())
    
    38 38
             for account in self._accounts:
    
    39 39
                 self.add_account(account)
    
    40 40
     
    
    ... ... @@ -42,7 +42,8 @@ def add_account(self, account: str) -> None:
    42 42
             self.add(Account(account))
    
    43 43
     
    
    44 44
         def remove_account(self, account: str) -> None:
    
    45
    -        for row in self.get_children():
    
    45
    +        accounts = cast(list[Account], self.get_children())
    
    46
    +        for row in accounts:
    
    46 47
                 if row.account == account:
    
    47 48
                     row.destroy()
    
    48 49
                     return
    
    ... ... @@ -52,7 +53,7 @@ def _on_row_activated(_listbox: AccountSideBar, row: Account) -> None:
    52 53
             app.window.show_account_page(row.account)
    
    53 54
     
    
    54 55
         def activate_account_page(self, account: str) -> None:
    
    55
    -        row = self.get_selected_row()
    
    56
    +        row = cast(Account, self.get_selected_row())
    
    56 57
             if row is not None and row.account == account:
    
    57 58
                 return
    
    58 59
     
    

  • gajim/gtk/app_page.py
    ... ... @@ -12,7 +12,10 @@
    12 12
     # You should have received a copy of the GNU General Public License
    
    13 13
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    14 14
     
    
    15
    +from __future__ import annotations
    
    16
    +
    
    15 17
     from typing import Optional
    
    18
    +from typing import cast
    
    16 19
     
    
    17 20
     from gi.repository import GObject
    
    18 21
     from gi.repository import Gtk
    
    ... ... @@ -103,7 +106,8 @@ def add_app_message(self, category: str, message: Optional[str]) -> None:
    103 106
     
    
    104 107
         def remove_app_message(self, row: Gtk.ListBoxRow) -> None:
    
    105 108
             self.remove(row)
    
    106
    -        self.get_parent().remove_app_message()
    
    109
    +        app_page = cast(AppPage, self.get_parent())
    
    110
    +        app_page.remove_app_message()
    
    107 111
     
    
    108 112
     
    
    109 113
     class AppMessageRow(Gtk.ListBoxRow):
    
    ... ... @@ -124,15 +128,19 @@ def __init__(self, category: str, message: Optional[str] = None) -> None:
    124 128
     
    
    125 129
         def _on_check_clicked(self, _button: Gtk.Button) -> None:
    
    126 130
             app.interface.get_latest_release()
    
    127
    -        self.get_parent().remove_app_message(self)
    
    131
    +        list_box = cast(AppMessageListBox, self.get_parent())
    
    132
    +        list_box.remove_app_message(self)
    
    128 133
     
    
    129 134
         def _on_dismiss_check_clicked(self, _button: Gtk.Button) -> None:
    
    130 135
             app.settings.set('check_for_update', False)
    
    131
    -        self.get_parent().remove_app_message(self)
    
    136
    +        list_box = cast(AppMessageListBox, self.get_parent())
    
    137
    +        list_box.remove_app_message(self)
    
    132 138
     
    
    133 139
         def _on_visit_website_clicked(self, _button: Gtk.Button) -> None:
    
    134 140
             open_uri('https://gajim.org/download')
    
    135
    -        self.get_parent().remove_app_message(self)
    
    141
    +        list_box = cast(AppMessageListBox, self.get_parent())
    
    142
    +        list_box.remove_app_message(self)
    
    136 143
     
    
    137 144
         def _on_dismiss_update_clicked(self, _button: Gtk.Button) -> None:
    
    138
    -        self.get_parent().remove_app_message(self)
    145
    +        list_box = cast(AppMessageListBox, self.get_parent())
    
    146
    +        list_box.remove_app_message(self)

  • gajim/gtk/call_widget.py
    ... ... @@ -553,7 +553,7 @@ def _set_jingle_state(self,
    553 553
     
    
    554 554
         def _stop_jingle(self,
    
    555 555
                          sid: Optional[str] = None,
    
    556
    -                     _reason: Optional[str] = None
    
    556
    +                     reason: Optional[str] = None
    
    557 557
                          ) -> None:
    
    558 558
             audio_sid = self._jingle['audio'].sid
    
    559 559
             video_sid = self._jingle['video'].sid
    

  • pyrightconfig.json
    ... ... @@ -18,15 +18,20 @@
    18 18
             "gajim/common/sound.py",
    
    19 19
             "gajim/common/storage/",
    
    20 20
             "gajim/gtk/account_page.py",
    
    21
    +        "gajim/gtk/account_side_bar.py",
    
    22
    +        "gajim/gtk/app_page.py",
    
    21 23
             "gajim/gtk/app_side_bar.py",
    
    24
    +        "gajim/gtk/call_widget.py",
    
    22 25
             "gajim/gtk/chat_filter.py",
    
    23 26
             "gajim/gtk/chat_list_stack.py",
    
    24 27
             "gajim/gtk/chat_page.py",
    
    28
    +        "gajim/gtk/contacts_flowbox.py",
    
    25 29
             "gajim/gtk/conversation/code_widget.py",
    
    26 30
             "gajim/gtk/conversation/jump_to_end_button.py",
    
    27 31
             "gajim/gtk/conversation/plain_widget.py",
    
    28 32
             "gajim/gtk/conversation/quote_widget.py",
    
    29 33
             "gajim/gtk/conversation/rows/base.py",
    
    34
    +        "gajim/gtk/conversation/rows/call.py",
    
    30 35
             "gajim/gtk/conversation/rows/command_output.py",
    
    31 36
             "gajim/gtk/conversation/rows/date.py",
    
    32 37
             "gajim/gtk/conversation/rows/file_transfer.py",
    
    ... ... @@ -43,6 +48,7 @@
    43 48
             "gajim/gtk/groupchat_nick.py",
    
    44 49
             "gajim/gtk/groupchat_state.py",
    
    45 50
             "gajim/gtk/main_stack.py",
    
    51
    +        "gajim/gtk/manage_sounds.py",
    
    46 52
             "gajim/gtk/notification.py",
    
    47 53
             "gajim/gtk/structs.py",
    
    48 54
             "gajim/gtk/sidebar_switcher.py",
    
    ... ... @@ -50,5 +56,8 @@
    50 56
             "gajim/gtk/status_icon.py",
    
    51 57
             "gajim/gtk/status_message_selector.py",
    
    52 58
             "gajim/gtk/status_selector.py",
    
    59
    +        "gajim/gtk/themes.py",
    
    60
    +        "gajim/gtk/video_preview.py",
    
    61
    +        "gajim/gtk/workspace_dialog.py",
    
    53 62
         ],
    
    54 63
     }