Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits: b412cedb by Cédric Krier at 2023-02-17T15:20:31+01:00 Switch to the next/previous record instead of page in list view of tryton This harmonizes the behavior of the next/previous buttons in clients. Closes #7979 - - - - - 2 changed files: - tryton/tryton/gui/main.py - tryton/tryton/gui/window/view_form/screen/screen.py Changes: ===================================== tryton/tryton/gui/main.py ===================================== @@ -175,5 +175,5 @@ Gtk.AccelMap.add_entry( '<tryton>/Form/Delete', Gdk.KEY_D, Gdk.ModifierType.CONTROL_MASK) Gtk.AccelMap.add_entry( - '<tryton>/Form/Next', Gdk.KEY_Page_Down, 0) + '<tryton>/Form/Next', Gdk.KEY_Down, Gdk.ModifierType.CONTROL_MASK) Gtk.AccelMap.add_entry( @@ -179,5 +179,6 @@ Gtk.AccelMap.add_entry( - '<tryton>/Form/Previous', Gdk.KEY_Page_Up, 0) + '<tryton>/Form/Previous', + Gdk.KEY_Up, Gdk.ModifierType.CONTROL_MASK) Gtk.AccelMap.add_entry( '<tryton>/Form/Switch View', Gdk.KEY_L, Gdk.ModifierType.CONTROL_MASK) ===================================== tryton/tryton/gui/window/view_form/screen/screen.py ===================================== @@ -976,19 +976,7 @@ def _get_next_record(self, test=False): view = self.current_view - if view.view_type == 'tree' and len(self.group): - range_ = view.treeview.get_visible_range() - if range_ and not test: - start, end = range_ - vadjustment = view.treeview.get_vadjustment() - vadjustment.set_value( - vadjustment.props.value + vadjustment.props.page_increment) - model = view.treeview.get_model() - iter_ = model.get_iter(end) - return model.get_value(iter_, 0) - else: - return self.group[-1] - elif (view.view_type == 'form' + if (view.view_type in {'tree', 'form'} and self.current_record and self.current_record.group): group = self.current_record.group @@ -1063,19 +1051,7 @@ def _get_prev_record(self, test=False): view = self.current_view - if view.view_type == 'tree' and len(self.group): - range_ = view.treeview.get_visible_range() - if range_ and not test: - start, end = range_ - vadjustment = view.treeview.get_vadjustment() - vadjustment.set_value( - vadjustment.props.value - vadjustment.props.page_increment) - model = view.treeview.get_model() - iter_ = model.get_iter(start) - return model.get_value(iter_, 0) - else: - return self.group[0] - elif (view.view_type == 'form' + if (view.view_type in {'tree', 'form'} and self.current_record and self.current_record.group): group = self.current_record.group View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/b412cedb9f3d1340cb4d62e085d17580beb3d276 -- View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/b412cedb9f3d1340cb4d62e085d17580beb3d276 You're receiving this email because of your account on foss.heptapod.net.