Keep column arrow up to date
When an order is set on a One2Many widget and the user reload the form, the selected order is lost and so the client should no more display those arrow. For that we update the arrows on each display using the screen order. And we unset the screen order when the group change as we do not know the order of this group. issue7817 review70481002
This commit is contained in:
1 parent
6cc13fd3d4
commit
6c7cedb1f1
2 files changed
+21
No files matched your search
@@ -368,6 +368,7 @@ class Screen(SignalEvent):
|
||||
fields[name] = field.attrs
|
||||
fields_views[name] = field.views
|
||||
self.tree_states_done.clear()
|
||||
self.order = None
|
||||
self.__group = group
|
||||
self.parent = group.parent
|
||||
self.parent_name = group.parent_name
|
||||
|
||||
@@ -554,6 +554,25 @@ class ViewTree(View):
|
||||
else:
|
||||
self.screen.search_filter(search_string=search_string)
|
||||
|
||||
def update_arrow(self):
|
||||
order = self.screen.order
|
||||
if order and len(order) == 1:
|
||||
(name, direction), = order
|
||||
direction = {
|
||||
'ASC': gtk.ARROW_DOWN,
|
||||
'DESC': gtk.ARROW_UP,
|
||||
}[direction]
|
||||
else:
|
||||
name, direction = None, None
|
||||
|
||||
for col in self.treeview.get_columns():
|
||||
arrow = getattr(col, 'arrow', None)
|
||||
if arrow:
|
||||
if col.name != name:
|
||||
arrow.set(gtk.ARROW_NONE, gtk.SHADOW_NONE)
|
||||
else:
|
||||
arrow.set(direction, gtk.SHADOW_IN)
|
||||
|
||||
def add_last_column(self):
|
||||
for column in self.treeview.get_columns():
|
||||
if column.get_expand():
|
||||
@@ -1033,6 +1052,7 @@ class ViewTree(View):
|
||||
self.treeview.queue_draw()
|
||||
if self.editable:
|
||||
self.set_state()
|
||||
self.update_arrow()
|
||||
self.update_sum()
|
||||
|
||||
# Set column visibility depending on attributes and domain
|
||||
|
||||
Reference in new issue
Block a user