Daniel Brötzmann pushed to branch gtk4 at gajim / gajim
Commits:
d378e3e0 by wurstsalat at 2024-10-21T18:48:25+02:00
refactor: AvatarSelector: Fix default size, remove TODOs
- - - - -
db10756f by wurstsalat at 2024-10-21T18:48:47+02:00
refactor: WorkspaceDialog: Increase default size for AvatarSelector
- - - - -
2 changed files:
- gajim/gtk/avatar_selector.py
- gajim/gtk/workspace_dialog.py
Changes:
=====================================
gajim/gtk/avatar_selector.py
=====================================
@@ -120,7 +120,11 @@ def prepare_crop_area(self, path: str) -> None:
self._helper_label.hide()
self._crop_area.show()
- def _on_path_picked(self, _button: AvatarFileChooserButton, paths:
list[Path]) -> None:
+ def _on_path_picked(
+ self,
+ _button: AvatarFileChooserButton,
+ paths: list[Path]
+ ) -> None:
if not paths:
return
@@ -193,8 +197,6 @@ def __init__(self) -> None:
Gtk.DrawingArea.__init__(self, visible=False)
SignalManager.__init__(self)
- # TODO GTK4: Resizing does not work
-
self._image = Gdk.Rectangle()
self._crop = Gdk.Rectangle()
self._pixbuf: GdkPixbuf.Pixbuf | None = None
@@ -210,8 +212,8 @@ def __init__(self) -> None:
self._active_region = Loc.OUTSIDE
self._last_press_x = -1
self._last_press_y = -1
- self._base_width = 300
- self._base_height = 300
+ self._base_width = 10
+ self._base_height = 10
self._aspect = 1.0
self.set_size_request(self._base_width, self._base_height)
@@ -397,8 +399,6 @@ def _on_button_press(
self._last_press_y = (y - self._image.y) / self._scale
self._active_region = self._find_location(crop, x, y)
self.queue_draw()
- # self.queue_draw_area(
- # crop.x - 1, crop.y - 1, crop.width + 2, crop.height + 2)
def _on_button_release(
self,
@@ -410,14 +410,12 @@ def _on_button_release(
if self._browse_pixbuf is None:
return
- crop = self._crop_to_widget()
+ self._crop_to_widget()
self._last_press_x = -1
self._last_press_y = -1
self._active_region = Loc.OUTSIDE
self.queue_draw()
- # self.queue_draw_area(
- # crop.x - 1, crop.y - 1, crop.width + 2, crop.height + 2)
def _on_motion(
self,
@@ -433,10 +431,8 @@ def _on_motion(
self._update_cursor(x, y)
- damage = self._crop_to_widget()
+ self._crop_to_widget()
self.queue_draw()
- # self.queue_draw_area(
- # damage.x - 1, damage.y - 1, damage.width + 2, damage.height + 2)
pb_width = self._browse_pixbuf.get_width()
pb_height = self._browse_pixbuf.get_height()
@@ -612,11 +608,9 @@ def _on_motion(
self._crop.y = int(top)
self._crop.width = int(right - left + 1)
self._crop.height = int(bottom - top + 1)
- damage = self._crop_to_widget()
+ self._crop_to_widget()
self.queue_draw()
- # self.queue_draw_area(
- # damage.x - 1, damage.y - 1, damage.width + 2, damage.height + 2)
def _update_pixbufs(self) -> None:
allocated_width = self.get_width()
=====================================
gajim/gtk/workspace_dialog.py
=====================================
@@ -35,7 +35,7 @@ def __init__(self, workspace_id: str | None = None) -> None:
self.set_child(self._ui.box)
self._avatar_selector = AvatarSelector()
- self._avatar_selector.set_size_request(200, 200)
+ self._avatar_selector.set_size_request(400, 300)
self._ui.image_box.append(self._avatar_selector)
name: str = _('My Workspace')
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/d06b21ef73c6dd5383c8db2aa0bc40467714c25f...db10756fca06a219c2926755cfb7f899731a9bae
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/d06b21ef73c6dd5383c8db2aa0bc40467714c25f...db10756fca06a219c2926755cfb7f899731a9bae
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]