Daniel Brötzmann pushed to branch gtk4 at gajim / gajim
Commits:
c57b0a64 by wurstsalat at 2024-11-01T13:04:31+01:00
refactor: Add assertions, adapt to API changes
- - - - -
7 changed files:
- gajim/gtk/advanced_config.py
- gajim/gtk/blocking.py
- gajim/gtk/call_window.py
- gajim/gtk/chat_list_row.py
- gajim/gtk/component_search.py
- gajim/gtk/const.py
- gajim/gtk/roster.py
Changes:
=====================================
gajim/gtk/advanced_config.py
=====================================
@@ -211,6 +211,7 @@ def _on_config_edited(self,
) -> None:
treepath = Gtk.TreePath.new_from_string(path)
+ assert treepath is not None
modelpath = self.modelfilter.convert_path_to_child_path(treepath)
assert modelpath
modelrow = self.model[modelpath]
=====================================
gajim/gtk/blocking.py
=====================================
@@ -103,6 +103,9 @@ def _on_add(self, _button: Any) -> None:
def _on_remove(self, _button: Any) -> None:
selected_rows = self._ui.block_view.get_selection().get_selected_rows()
+ if selected_rows is None:
+ return
+
mod, paths = selected_rows
for path in paths:
iter_ = mod.get_iter(path)
=====================================
gajim/gtk/call_window.py
=====================================
@@ -138,6 +138,9 @@ def _on_button_press(
y: float,
) -> None:
button = gesture_click.get_widget()
+ if button is None:
+ return
+
key = button.get_name()
app.call_manager.start_dtmf(
self._account, self._resource_contact.jid, key)
=====================================
gajim/gtk/chat_list_row.py
=====================================
@@ -509,14 +509,14 @@ def _on_prepare(self,
def _on_drag_begin(self, _drag_source: Gtk.DragSource, drag: Gdk.Drag) ->
None:
# TODO: Use widget's snapshot
+ assert isinstance(self.contact, ChatContactT)
texture = self.contact.get_avatar(AvatarSize.CHAT, 1)
- if texture is not None:
- Gtk.DragIcon.set_from_paintable(
- drag,
- texture,
- int(self._drag_hotspot_x),
- int(self._drag_hotspot_y)
- )
+ Gtk.DragIcon.set_from_paintable(
+ drag,
+ texture,
+ int(self._drag_hotspot_x),
+ int(self._drag_hotspot_y)
+ )
app.window.highlight_dnd_targets(self, True)
=====================================
gajim/gtk/component_search.py
=====================================
@@ -297,6 +297,7 @@ def _on_button_press(
x: float,
y: float,
) -> int:
+ assert self._treeview is not None
path = self._treeview.get_path_at_pos(int(x), int(y))
if path is None:
return False
=====================================
gajim/gtk/const.py
=====================================
@@ -22,9 +22,10 @@
from gajim.common.setting_values import AllSettingsT
if sys.byteorder == 'little':
- GDK_MEMORY_DEFAULT = Gdk.MemoryFormat.B8G8R8A8_PREMULTIPLIED
+ gdk_memory_default = Gdk.MemoryFormat.B8G8R8A8_PREMULTIPLIED
else:
- GDK_MEMORY_DEFAULT = Gdk.MemoryFormat.A8R8G8B8_PREMULTIPLIED
+ gdk_memory_default = Gdk.MemoryFormat.A8R8G8B8_PREMULTIPLIED
+GDK_MEMORY_DEFAULT = gdk_memory_default
class Setting(NamedTuple):
=====================================
gajim/gtk/roster.py
=====================================
@@ -366,6 +366,9 @@ def _on_row_clicked(
return Gdk.EVENT_PROPAGATE
path, _, _, _ = pos
+ if path is None:
+ return Gdk.EVENT_PROPAGATE
+
path = self._modelfilter.convert_path_to_child_path(path)
assert path is not None
iter_ = self._store.get_iter(path)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/c57b0a64c7ca26110125fb4f737b597c7b913050
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/c57b0a64c7ca26110125fb4f737b597c7b913050
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]