Skip to content

Commit

Permalink
Select the clicked line when activating a button in list view
Browse files Browse the repository at this point in the history
issue11212
review433141003
  • Loading branch information
nicoe committed Sep 17, 2022
1 parent cb61a82 commit 764824c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tryton/gui/window/view_form/view/list_gtk/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,11 +1305,17 @@ def button_clicked(self, widget, path):
store = self.view.treeview.get_model()
record = store.get_value(store.get_iter(path), 0)

if self.view.record and self.view.record != record:
widget.stop_emission_by_name('clicked')
return True

state_changes = record.expr_eval(
self.attrs.get('states', {}))
if state_changes.get('invisible') \
or state_changes.get('readonly'):
return True

self.view.treeview.set_cursor(path)
widget.handler_block_by_func(self.button_clicked)
try:
self.view.screen.button(self.attrs)
Expand Down

0 comments on commit 764824c

Please sign in to comment.