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


Commits:
720e5c30 by Philipp Hörist at 2024-11-01T23:30:19+01:00
cq: Fix types

- - - - -


2 changed files:

- gajim/gtk/groupchat_affiliation.py
- gajim/gtk/groupchat_creation.py


Changes:

=====================================
gajim/gtk/groupchat_affiliation.py
=====================================
@@ -126,7 +126,12 @@ def _on_add(self, _button: Gtk.Button) -> None:
         self._update_apply_button_state()
 
     def _on_remove(self, _button: Gtk.Button) -> None:
-        _model, paths = self._treeview.get_selection().get_selected_rows()
+        selection = self._treeview.get_selection()
+        rows = selection.get_selected_rows()
+        if rows is None:
+            return
+
+        _model, paths = rows
 
         owner_count = len([row for row in self._store
                            if row[Column.AFFILIATION] == 'owner'])
@@ -139,7 +144,7 @@ def _on_remove(self, _button: Gtk.Button) -> None:
                                 _('A Group Chat needs at least one Owner'))
                     return
                 owner_count -= 1
-            references.append(Gtk.TreeRowReference.new(self._store, path))
+            references.append(Gtk.TreeRowReference(self._store, path))
 
         for ref in references:
             path = ref.get_path()
@@ -196,7 +201,9 @@ def _jid_exists(self, jid: str) -> bool:
     @staticmethod
     def _get_selected_affiliations(tree_selection: Gtk.TreeSelection
                                    ) -> set[str]:
-        model, paths = tree_selection.get_selected_rows()
+        rows = tree_selection.get_selected_rows()
+        assert rows is not None
+        model, paths = rows
         selected_affiliations: set[str] = set()
         for path in paths:
             selected_affiliations.add(model[path][Column.AFFILIATION])


=====================================
gajim/gtk/groupchat_creation.py
=====================================
@@ -145,6 +145,7 @@ def _on_account_combo_changed(self, combo: Gtk.ComboBox) -> 
None:
         self._account = combo.get_active_id()
         if self._account is None:
             model = combo.get_model()
+            assert model is not None
             iter_ = model.get_iter_first()
             if not iter_:
                 return
@@ -223,7 +224,9 @@ def _update_entry_completion(self, entry: Gtk.Entry, text: 
str) -> None:
         if '@' in text:
             text = text.split('@', 1)[0]
 
-        model = entry.get_completion().get_model()
+        completion = entry.get_completion()
+        assert completion is not None
+        model = completion.get_model()
         assert isinstance(model, Gtk.ListStore)
         model.clear()
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/720e5c3009d5c5ef507f6cb57837532ecae1ae8f

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/720e5c3009d5c5ef507f6cb57837532ecae1ae8f
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to