changeset 586088f94345 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset&node=586088f94345
description:
Do not clear model if the selection is still the same
Clearing the model reset the scroll position of the ScrolledWindow
which is
unnecessary if the content is still the same.
issue10121
review339981002
(grafted from 5fe718640116041b10a132b2a10ab72f31ffbbe4)
diffstat:
tryton/gui/window/view_form/view/form_gtk/multiselection.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r 193e6468b03a -r 586088f94345
tryton/gui/window/view_form/view/form_gtk/multiselection.py
--- a/tryton/gui/window/view_form/view/form_gtk/multiselection.py Wed Mar
03 18:14:21 2021 +0100
+++ b/tryton/gui/window/view_form/view/form_gtk/multiselection.py Mon Mar
01 23:30:23 2021 +0100
@@ -77,12 +77,15 @@
# it will be set back in the super call
selection.set_select_function(lambda *a: True)
self.update_selection(self.record, self.field)
- self.model.clear()
+ new_model = self.selection != [list(row) for row in self.model]
+ if new_model:
+ self.model.clear()
if not self.field:
return
value2path = {}
for idx, (value, name) in enumerate(self.selection):
- self.model.append((value, name))
+ if new_model:
+ self.model.append((value, name))
value2path[value] = idx
selection.unselect_all()
values = self.field.get_eval(self.record)