changeset e42798373198 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=e42798373198
description:
        Set saved tree width only if client save them

        We rename also the option from save_width_height to save_tree_width 
which
        correspond better to the current behavior.

        issue9130
        review258921051
diffstat:

 doc/usage.rst                                |   5 ++---
 tryton/config.py                             |   2 +-
 tryton/gui/main.py                           |   4 ++--
 tryton/gui/window/attachment.py              |   2 +-
 tryton/gui/window/note.py                    |   2 +-
 tryton/gui/window/view_form/screen/screen.py |  11 ++++++++---
 tryton/gui/window/view_form/view/list.py     |   6 +++---
 7 files changed, 18 insertions(+), 14 deletions(-)

diffs (128 lines):

diff -r c2bff499cec9 -r e42798373198 doc/usage.rst
--- a/doc/usage.rst     Sat Mar 28 00:15:03 2020 +0100
+++ b/doc/usage.rst     Sat Mar 28 00:33:27 2020 +0100
@@ -177,10 +177,9 @@
 
 Form:
 
-  * Save Width/Height:
+  * Save Column Width:
     Check box to enable saving of manually adjusted widths of columns in lists
-    and trees. Additionally saving of manually adjusted widths and heights of
-    dialog and popup windows.
+    and trees.
 
   * Save Tree Expanded State:
     Check box to enable saving of expanded and selected nodes in trees/lists.
diff -r c2bff499cec9 -r e42798373198 tryton/config.py
--- a/tryton/config.py  Sat Mar 28 00:15:03 2020 +0100
+++ b/tryton/config.py  Sat Mar 28 00:33:27 2020 +0100
@@ -46,7 +46,7 @@
             'client.title': 'Tryton',
             'client.modepda': False,
             'client.toolbar': 'default',
-            'client.save_width_height': True,
+            'client.save_tree_width': True,
             'client.save_tree_state': True,
             'client.spellcheck': False,
             'client.lang': locale.getdefaultlocale()[0],
diff -r c2bff499cec9 -r e42798373198 tryton/gui/main.py
--- a/tryton/gui/main.py        Sat Mar 28 00:15:03 2020 +0100
+++ b/tryton/gui/main.py        Sat Mar 28 00:33:27 2020 +0100
@@ -76,7 +76,7 @@
 
         for name, key in [
                 ('mode-pda', 'client.modepda'),
-                ('save-width-height', 'client.save_width_height'),
+                ('save-tree-width', 'client.save_tree_width'),
                 ('save-tree-state', 'client.save_tree_state'),
                 ('spell-checking', 'client.spellcheck'),
                 ('check-version', 'client.check_version'),
@@ -151,7 +151,7 @@
 
         form = Gio.Menu.new()
         section.append_submenu(_("Form"), form)
-        form.append(_("Save Width/Height"), 'app.save-width-height')
+        form.append(_("Save Column Width"), 'app.save-tree-width')
         form.append(_("Save Tree State"), 'app.save-tree-state')
         form.append(_("Spell Checking"), 'app.spell-checking')
 
diff -r c2bff499cec9 -r e42798373198 tryton/gui/window/attachment.py
--- a/tryton/gui/window/attachment.py   Sat Mar 28 00:15:03 2020 +0100
+++ b/tryton/gui/window/attachment.py   Sat Mar 28 00:33:27 2020 +0100
@@ -30,7 +30,7 @@
         screen.search_filter()
 
     def destroy(self):
-        self.prev_view.save_width_height()
+        self.prev_view.save_width()
         super(Attachment, self).destroy()
 
     def callback(self, result):
diff -r c2bff499cec9 -r e42798373198 tryton/gui/window/note.py
--- a/tryton/gui/window/note.py Sat Mar 28 00:15:03 2020 +0100
+++ b/tryton/gui/window/note.py Sat Mar 28 00:33:27 2020 +0100
@@ -23,7 +23,7 @@
         screen.search_filter()
 
     def destroy(self):
-        self.prev_view.save_width_height()
+        self.prev_view.save_width()
         super(Note, self).destroy()
 
     def callback(self, result):
diff -r c2bff499cec9 -r e42798373198 
tryton/gui/window/view_form/screen/screen.py
--- a/tryton/gui/window/view_form/screen/screen.py      Sat Mar 28 00:15:03 
2020 +0100
+++ b/tryton/gui/window/view_form/screen/screen.py      Sat Mar 28 00:33:27 
2020 +0100
@@ -157,10 +157,12 @@
             return self._domain_parser[view_id]
 
         if view_id not in self.fields_view_tree:
+            context = self.context
+            context['view_tree_width'] = CONFIG['client.save_tree_width']
             try:
                 self.fields_view_tree[view_id] = view_tree = RPCExecute(
                     'model', self.model_name, 'fields_view_get', False, 'tree',
-                    context=self.context)
+                    context=context)
             except RPCException:
                 view_tree = {
                     'fields': {},
@@ -548,9 +550,12 @@
         elif not view_id and view_type in self.views_preload:
             view = self.views_preload[view_type]
         else:
+            context = self.context
+            context['view_tree_width'] = CONFIG['client.save_tree_width']
             try:
-                view = RPCExecute('model', self.model_name, 'fields_view_get',
-                    view_id, view_type, context=self.context)
+                view = RPCExecute(
+                    'model', self.model_name, 'fields_view_get', view_id,
+                    view_type, context=context)
             except RPCException:
                 return
         return self.add_view(view)
diff -r c2bff499cec9 -r e42798373198 tryton/gui/window/view_form/view/list.py
--- a/tryton/gui/window/view_form/view/list.py  Sat Mar 28 00:15:03 2020 +0100
+++ b/tryton/gui/window/view_form/view/list.py  Sat Mar 28 00:33:27 2020 +0100
@@ -906,8 +906,8 @@
     def __getitem__(self, name):
         return None
 
-    def save_width_height(self):
-        if not CONFIG['client.save_width_height']:
+    def save_width(self):
+        if not CONFIG['client.save_tree_width']:
             return
         fields = {}
         last_col = None
@@ -934,7 +934,7 @@
             self.screen.tree_column_width[model_name].update(fields)
 
     def destroy(self):
-        self.save_width_height()
+        self.save_width()
         self.treeview.destroy()
 
     def __sig_switch(self, treeview, path, column):

Reply via email to