Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
c712a113 by mesonium at 2024-11-23T10:37:38+00:00
imprv: Preview: Use native theme colors and improve styling
- - - - -
3 changed files:
- gajim/common/preview.py
- gajim/data/style/gajim.css
- gajim/gtk/preview.py
Changes:
=====================================
gajim/common/preview.py
=====================================
@@ -90,7 +90,7 @@ def __init__(self,
self.account = widget.account
self.orig_path = orig_path
self.thumb_path = thumb_path
- self.size = size
+ self.size = size * app.window.get_scale_factor()
self.thumbnail: bytes | None = None
self.mime_type: str = ''
=====================================
gajim/data/style/gajim.css
=====================================
@@ -231,7 +231,10 @@ .solid-background { background-color: @theme_base_color; }
.border { border: 1px solid @borders; }
.no-border { border: none; }
.scrolled-no-border { border: none; }
-.preview-image { box-shadow: 0px 0px 3px 0px alpha(@theme_text_color, 0.2); }
+.preview-image {
+ border-radius: 4px;
+ box-shadow: 0px 0px 3px 0px alpha(@theme_text_color, 0.2);
+}
/* Scrollbars */
.no-scroll-indicator undershoot.top, undershoot.bottom { background-image:
none; }
@@ -821,28 +824,25 @@ .preview-image-button:hover {
box-shadow: none;
}
.preview-image-button > picture {
- border-radius: 6px;
+ border-radius: 4px;
}
.preview-content-box {
- border-radius: 6px;
+ border-radius: 4px;
}
.preview-content-box:hover {
background: alpha(@theme_fg_color, 0.1);
}
.preview-image-overlay {
- color: rgb(255, 255, 255);
- background: alpha(rgb(0, 0, 0), 0.8);
- padding: 6px 12px;
- border-bottom-left-radius: 6px;
- border-bottom-right-radius: 6px;
+ background: alpha(@theme_bg_color, 0.9);
+ padding: 4px 12px;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
}
.preview-image-overlay-button {
- color: rgb(255, 255, 255);
- border-color: rgb(128, 128, 128);
- background: rgb(36, 36, 36);
+ background: @theme_bg_color;
}
.preview-image-overlay-button:hover {
- background: rgb(68, 68, 68);
+ background: shade(@theme_bg_color, 0.92);
}
/* Conversation meta elements */
=====================================
gajim/gtk/preview.py
=====================================
@@ -155,6 +155,8 @@ def update(self, preview: Preview, data: bytes | None) ->
None:
self._ui.image_button.set_tooltip_text(preview.filename)
if data is not None:
+ self._ui.image_button.set_tooltip_text(None)
+
texture = Gdk.Texture.new_from_bytes(GLib.Bytes.new(data))
max_preview_size = app.settings.get("preview_size")
@@ -174,12 +176,12 @@ def update(self, preview: Preview, data: bytes | None) ->
None:
width = texture_width
height = texture_height
+ self._ui.content_overlay.set_size_request(width, height)
+
image = Gtk.Picture.new_for_paintable(texture)
image.add_css_class("preview-image")
- image.set_size_request(width, height)
-
- self._ui.image_button.set_child(image)
- self._ui.image_button.set_tooltip_text(None)
+ image.set_can_target(False)
+ self._ui.content_overlay.add_overlay(image)
self._ui.button_box.unparent()
self._ui.content_overlay.add_overlay(self._ui.button_box)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/c712a11383cb4528c2b46b02ca89939fd93af796
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/c712a11383cb4528c2b46b02ca89939fd93af796
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]