Philipp Hörist pushed to branch unify-control at gajim / gajim
Commits:
d9e24817 by lovetox at 2022-08-09T17:14:18+02:00
fix: Comment import
- - - - -
7066d32b by lovetox at 2022-08-09T17:18:10+02:00
fix: GroupchatRoster: fix pyright issues
- - - - -
3 changed files:
- gajim/gtk/groupchat_roster.py
- gajim/gtk/preferences.py
- pyrightconfig.json
Changes:
=====================================
gajim/gtk/groupchat_roster.py
=====================================
@@ -25,7 +25,7 @@
from gi.repository import Gtk
from gi.repository import GLib
from nbxmpp.const import Affiliation
-from nbxmpp.structs import MessageProperties
+from nbxmpp.structs import PresenceProperties
from gajim.common import app
from gajim.common import ged
@@ -184,6 +184,7 @@ def _query_tooltip(self,
nickname = self._store[iter_][Column.NICK_OR_GROUP]
+ assert self._contact is not None
contact = self._contact.get_resource(nickname)
value, widget = self._tooltip.get_tooltip(contact)
@@ -283,11 +284,13 @@ def _on_user_nickname_changed(self,
contact: types.GroupchatContact,
_signal_name: str,
user_contact: types.GroupchatParticipant,
- properties: MessageProperties
+ properties: PresenceProperties
) -> None:
self._remove_contact(user_contact)
+ assert properties.muc_user is not None
+ assert properties.muc_user.nick is not None
user_contact = contact.get_resource(properties.muc_user.nick)
self._add_contact(user_contact)
@@ -361,15 +364,20 @@ def _on_roster_row_activated(self,
if self._store.iter_parent(iter_) is None:
# This is a group row
return
+
+ assert self._contact is not None
+
nick = self._store[iter_][Column.NICK_OR_GROUP]
if self._contact.nickname == nick:
return
disco = self._contact.get_disco()
assert disco is not None
+
muc_prefer_direct_msg = app.settings.get('muc_prefer_direct_msg')
if disco.muc_is_nonanonymous and muc_prefer_direct_msg:
participant = self._contact.get_resource(nick)
+ assert participant.real_jid is not None
app.window.add_chat(self._contact.account,
participant.real_jid,
'contact',
@@ -402,6 +410,8 @@ def _on_roster_button_press_event(self,
# Group row
return
+ assert self._contact is not None
+
nick = self._store[iter_][Column.NICK_OR_GROUP]
if self._contact.nickname == nick:
return
@@ -416,10 +426,11 @@ def _on_roster_button_press_event(self,
# self.roster.emit('row-activated', nick)
def _show_contact_menu(self, nick: str, rect: Gdk.Rectangle) -> None:
+ assert self._contact is not None
self_contact = self._contact.get_self()
assert self_contact is not None
contact = self._contact.get_resource(nick)
- menu = get_groupchat_roster_menu(self._account,
+ menu = get_groupchat_roster_menu(self._contact.account,
self_contact,
contact)
@@ -461,6 +472,7 @@ def _tree_compare_iters(self,
if not app.settings.get('sort_by_show_in_muc'):
return locale.strcoll(nick1.lower(), nick2.lower())
+ assert self._contact is not None
contact1 = self._contact.get_resource(nick1)
contact2 = self._contact.get_resource(nick2)
@@ -485,6 +497,7 @@ def enable_sort(self, enable: bool) -> None:
def _load_roster(self) -> None:
log.info('Load Roster')
+ assert self._contact is not None
self._contact.multi_connect({
'user-affiliation-changed': self._update_contact,
'user-avatar-update': self._on_user_avatar_update,
@@ -504,6 +517,7 @@ def _load_roster(self) -> None:
def _unload_roster(self) -> None:
log.info('Unload Roster')
+ assert self._contact is not None
self._contact.multi_disconnect(self, CONTACT_SIGNALS)
self._roster.set_model(None)
@@ -527,6 +541,7 @@ def _draw_contact(self, nick: str) -> None:
if not iter_:
return
+ assert self._contact is not None
contact = self._contact.get_resource(nick)
self._draw_avatar(contact)
=====================================
gajim/gtk/preferences.py
=====================================
@@ -52,8 +52,8 @@
from .util import get_app_window
from .builder import get_builder
-if app.is_installed('GSPELL'):
- from gi.repository import Gspell # pylint: disable=ungrouped-imports
+# if app.is_installed('GSPELL'):
+# from gi.repository import Gspell # pylint: disable=ungrouped-imports
log = logging.getLogger('gajim.gui.preferences')
=====================================
pyrightconfig.json
=====================================
@@ -84,6 +84,7 @@
"gajim/gtk/groupchat_nick_completion.py",
"gajim/gtk/groupchat_nick.py",
"gajim/gtk/groupchat_outcasts.py",
+ "gajim/gtk/groupchat_roster.py",
"gajim/gtk/groupchat_settings.py",
"gajim/gtk/groupchat_state.py",
"gajim/gtk/gstreamer.py",
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/6ebbfaf6e08573af4871aa40d175ad531011711f...7066d32baa6256987c0d14787307700d6f1a0a8f
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/6ebbfaf6e08573af4871aa40d175ad531011711f...7066d32baa6256987c0d14787307700d6f1a0a8f
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