changeset a4a2faad5941 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=a4a2faad5941
description:
        Add width and height attributes on calendar view

        issue9148
        review250931003
diffstat:

 tryton/gui/window/view_form/view/calendar_.py |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 16919e524402 -r a4a2faad5941 
tryton/gui/window/view_form/view/calendar_.py
--- a/tryton/gui/window/view_form/view/calendar_.py     Sat Mar 28 00:35:48 
2020 +0100
+++ b/tryton/gui/window/view_form/view/calendar_.py     Wed Apr 01 23:58:49 
2020 +0200
@@ -41,13 +41,21 @@
             self.parse(child)
         goocalendar = Calendar_(
             self.view.attributes, self.view, self.calendar_fields)
+        scrolledwindow = Gtk.ScrolledWindow()
+        scrolledwindow.add(goocalendar)
         toolbar = Toolbar(goocalendar)
-        self.view.scroll.add(goocalendar)
         self.view.widget.pack_start(
             toolbar, expand=False, fill=False, padding=0)
+        self.view.widget.pack_start(
+            scrolledwindow, expand=True, fill=True, padding=0)
         self.view.widgets['goocalendar'] = goocalendar
         self.view.widgets['toolbar'] = toolbar
 
+        if attributes.get('height') or attributes.get('width'):
+            scrolledwindow.set_size_request(
+                int(attributes.get('width', -1)),
+                int(attributes.get('height', -1)))
+
     def _parse_field(self, node, attributes):
         self.calendar_fields.append(attributes)
 
@@ -64,10 +72,6 @@
             self.widgets = {}
             return
 
-        self.scroll = scrolledWindow = Gtk.ScrolledWindow()
-        self.widget.pack_end(
-            scrolledWindow, expand=True, fill=True, padding=0)
-
         super().__init__(view_id, screen, xml)
 
         goocalendar = self.widgets['goocalendar']

Reply via email to