Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: 6e48f01c by wurstsalat at 2022-01-13T09:58:42+01:00 Helpers: Allow play_sound to have no account
- - - - - 0e0a78de by wurstsalat at 2022-01-13T10:02:19+01:00 CallWidget: Fix wrong arg
- - - - - b0460387 by wurstsalat at 2022-01-13T10:06:48+01:00 AppPage: Typing
- - - - - e880f36c by wurstsalat at 2022-01-13T10:15:22+01:00 AccountSideBar: Typing
- - - - - aa3b45d6 by wurstsalat at 2022-01-13T10:15:37+01:00 Update pyrightconfig.json
- - - - -
5 changed files:
- gajim/common/helpers.py - gajim/gtk/account_side_bar.py - gajim/gtk/app_page.py - gajim/gtk/call_widget.py - pyrightconfig.json
Changes:
===================================== gajim/common/helpers.py ===================================== @@ -466,13 +466,14 @@ def get_contact_dict_for_account(account: str) -> dict[str, types.BareContact]:
def play_sound(sound_event: str, - account: str, + account: Optional[str] = None, force: bool = False, loop: bool = False) -> None:
if sound_event is None: return - if force or allow_sound_notification(account, sound_event): + if (force or account is None or + allow_sound_notification(account, sound_event)): play_sound_file( app.settings.get_soundevent_settings(sound_event)['path'], loop)
===================================== gajim/gtk/account_side_bar.py ===================================== @@ -14,8 +14,8 @@
from __future__ import annotations
-from typing import List from typing import Optional +from typing import cast
from gi.repository import Gtk
@@ -34,7 +34,7 @@ def __init__(self) -> None: self.get_style_context().add_class('account-sidebar') self.connect('row-activated', self._on_row_activated)
- self._accounts: List[str] = list(app.connections.keys()) + self._accounts: list[str] = list(app.connections.keys()) for account in self._accounts: self.add_account(account)
@@ -42,7 +42,8 @@ def add_account(self, account: str) -> None: self.add(Account(account))
def remove_account(self, account: str) -> None: - for row in self.get_children(): + accounts = cast(list[Account], self.get_children()) + for row in accounts: if row.account == account: row.destroy() return @@ -52,7 +53,7 @@ def _on_row_activated(_listbox: AccountSideBar, row: Account) -> None: app.window.show_account_page(row.account)
def activate_account_page(self, account: str) -> None: - row = self.get_selected_row() + row = cast(Account, self.get_selected_row()) if row is not None and row.account == account: return
===================================== gajim/gtk/app_page.py ===================================== @@ -12,7 +12,10 @@ # 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 Optional +from typing import cast
from gi.repository import GObject from gi.repository import Gtk @@ -103,7 +106,8 @@ def add_app_message(self, category: str, message: Optional[str]) -> None:
def remove_app_message(self, row: Gtk.ListBoxRow) -> None: self.remove(row) - self.get_parent().remove_app_message() + app_page = cast(AppPage, self.get_parent()) + app_page.remove_app_message()
class AppMessageRow(Gtk.ListBoxRow): @@ -124,15 +128,19 @@ def __init__(self, category: str, message: Optional[str] = None) -> None:
def _on_check_clicked(self, _button: Gtk.Button) -> None: app.interface.get_latest_release() - self.get_parent().remove_app_message(self) + list_box = cast(AppMessageListBox, self.get_parent()) + list_box.remove_app_message(self)
def _on_dismiss_check_clicked(self, _button: Gtk.Button) -> None: app.settings.set('check_for_update', False) - self.get_parent().remove_app_message(self) + list_box = cast(AppMessageListBox, self.get_parent()) + list_box.remove_app_message(self)
def _on_visit_website_clicked(self, _button: Gtk.Button) -> None: open_uri('https://gajim.org/download') - self.get_parent().remove_app_message(self) + list_box = cast(AppMessageListBox, self.get_parent()) + list_box.remove_app_message(self)
def _on_dismiss_update_clicked(self, _button: Gtk.Button) -> None: - self.get_parent().remove_app_message(self) + list_box = cast(AppMessageListBox, self.get_parent()) + list_box.remove_app_message(self)
===================================== gajim/gtk/call_widget.py ===================================== @@ -553,7 +553,7 @@ def _set_jingle_state(self,
def _stop_jingle(self, sid: Optional[str] = None, - _reason: Optional[str] = None + reason: Optional[str] = None ) -> None: audio_sid = self._jingle['audio'].sid video_sid = self._jingle['video'].sid
===================================== pyrightconfig.json ===================================== @@ -18,15 +18,20 @@ "gajim/common/sound.py", "gajim/common/storage/", "gajim/gtk/account_page.py", + "gajim/gtk/account_side_bar.py", + "gajim/gtk/app_page.py", "gajim/gtk/app_side_bar.py", + "gajim/gtk/call_widget.py", "gajim/gtk/chat_filter.py", "gajim/gtk/chat_list_stack.py", "gajim/gtk/chat_page.py", + "gajim/gtk/contacts_flowbox.py", "gajim/gtk/conversation/code_widget.py", "gajim/gtk/conversation/jump_to_end_button.py", "gajim/gtk/conversation/plain_widget.py", "gajim/gtk/conversation/quote_widget.py", "gajim/gtk/conversation/rows/base.py", + "gajim/gtk/conversation/rows/call.py", "gajim/gtk/conversation/rows/command_output.py", "gajim/gtk/conversation/rows/date.py", "gajim/gtk/conversation/rows/file_transfer.py", @@ -43,6 +48,7 @@ "gajim/gtk/groupchat_nick.py", "gajim/gtk/groupchat_state.py", "gajim/gtk/main_stack.py", + "gajim/gtk/manage_sounds.py", "gajim/gtk/notification.py", "gajim/gtk/structs.py", "gajim/gtk/sidebar_switcher.py", @@ -50,5 +56,8 @@ "gajim/gtk/status_icon.py", "gajim/gtk/status_message_selector.py", "gajim/gtk/status_selector.py", + "gajim/gtk/themes.py", + "gajim/gtk/video_preview.py", + "gajim/gtk/workspace_dialog.py", ], }
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/a0c8587b358b21e06e41f3499108773a...