Reviewers: ,
Please review this at http://codereview.tryton.org/210008/ Affected files: M tryton/gui/window/view_form/screen/screen.py M tryton/gui/window/view_form/view/list_gtk/parser.py Index: tryton/gui/window/view_form/screen/screen.py =================================================================== --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -550,6 +550,8 @@ records = [self.current_record] elif self.current_view.view_type == 'tree': records = self.current_view.selected_records() + if not records: + return if delete: if not self.group.delete(records): return False Index: tryton/gui/window/view_form/view/list_gtk/parser.py =================================================================== --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -93,6 +93,7 @@ treeview.sequence = attrs.get('sequence', False) treeview.colors = attrs.get('colors', '"black"') treeview.keyword_open = attrs.get('keyword_open', False) + treeview.connect('focus', self.set_selection) self.treeview = treeview treeview.set_property('rules-hint', True) if not self.title: @@ -262,6 +263,12 @@ treeview.set_fixed_height_mode(True) return treeview, dict_widget, button_list, on_write, [], None + def set_selection(self, treeview, direction): + selection = treeview.get_selection() + if len(treeview.get_model()): + selection.select_path(0) + return False + class Char(object): -- [email protected] mailing list
