Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions tryton/tryton/gui/window/view_form/view/list_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,17 @@ def select_nodes(self, nodes):
if not nodes:
return
nodes = {n[0] for n in nodes}
self.listbox.handler_block_by_func(self.select_nodes)
self.listbox.unselect_all()
for idx, view_form in enumerate(self._view_forms):
if view_form.record.id in nodes:
row = self.listbox.get_row_at_index(idx)
if not row:
continue
self.listbox.select_row(row)
self.listbox.handler_unblock_by_func(self.select_nodes)
self.listbox.handler_block_by_func(self._row_selected)
try:
self.listbox.unselect_all()
for idx, view_form in enumerate(self._view_forms):
if view_form.record.id in nodes:
row = self.listbox.get_row_at_index(idx)
if not row:
continue
self.listbox.select_row(row)
finally:
self.listbox.handler_unblock_by_func(self._row_selected)

def _row_selected(self, listbox, row):
previous_record = self.record
Expand Down Expand Up @@ -205,11 +207,11 @@ def _select_show_row(self, index):
return
# unselect_all triggers a loop in _row_selected if the record is not
# valid
self.listbox.handler_block_by_func(self._select_show_row)
self.listbox.handler_block_by_func(self._row_selected)
try:
self.listbox.unselect_all()
finally:
self.listbox.handler_unblock_by_func(self._select_show_row)
self.listbox.handler_unblock_by_func(self._row_selected)
row = self.listbox.get_row_at_index(index)
if not row or not row.get_realized():
return
Expand Down