changeset 16919e524402 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=16919e524402
description:
Set default size for image widget in all views
issue9131
review256701006
diffstat:
tryton/gui/window/view_form/view/list_gtk/widget.py | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diffs (28 lines):
diff -r e42798373198 -r 16919e524402
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py Sat Mar 28
00:33:27 2020 +0100
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py Sat Mar 28
00:35:48 2020 +0100
@@ -636,8 +636,9 @@
if renderer is None:
renderer = Gtk.CellRendererPixbuf
super(Image, self).__init__(view, attrs, renderer)
- self.renderer.set_fixed_size(self.attrs.get('width', -1),
- self.attrs.get('height', -1))
+ self.height = int(attrs.get('height', 100))
+ self.width = int(attrs.get('width', 300))
+ self.renderer.set_fixed_size(self.width, self.height)
@realized
@CellCache.cache
@@ -650,10 +651,8 @@
else:
value = field.get_data(record)
pixbuf = data2pixbuf(value)
- width = self.attrs.get('width', -1)
- height = self.attrs.get('height', -1)
- if pixbuf and (width != -1 or height != -1):
- pixbuf = common.resize_pixbuf(pixbuf, width, height)
+ if pixbuf:
+ pixbuf = common.resize_pixbuf(pixbuf, self.width, self.height)
cell.set_property('pixbuf', pixbuf)
self._set_visual(cell, record)