Expand/Collapse row when activate row without action

This commit is contained in:
Cédric Krier
2008-01-18 21:00:43 +01:00
parent 1f9081d831
commit 82d723a649
2 changed files with 12 additions and 7 deletions
+2 -2
View File
@@ -125,7 +125,7 @@ class Action(object):
Action.exec_report(action['report_name'], datas)
@staticmethod
def exec_keyword(keyword, data=None, context=None):
def exec_keyword(keyword, data=None, context=None, warning=True):
actions = []
if 'id' in data:
try:
@@ -149,6 +149,6 @@ class Action(object):
(name, action) = res
Action._exec_action(action, data, context=context)
return (name, action)
elif not len(keyact):
elif not len(keyact) and warning:
message(_('No action defined!'), Main.get_main().window)
return False
+10 -5
View File
@@ -149,7 +149,7 @@ class Tree(object):
def sig_print(self):
self.sig_action('form_print')
def sig_action(self, keyword='tree_action', obj_id=None):
def sig_action(self, keyword='tree_action', obj_id=None, warning=True):
ids = self.ids_get()
if not obj_id and ids and len(ids):
obj_id = ids[0]
@@ -159,17 +159,22 @@ class Tree(object):
del ctx['active_ids']
if 'active_id' in ctx:
del ctx['active_id']
Action.exec_keyword(keyword, {
return Action.exec_keyword(keyword, {
'model': self.model,
'id': obj_id,
'ids':ids,
'window': self.window,
}, context=ctx)
}, context=ctx, warning=warning)
else:
common.message(_('No resource selected!'), self.window)
return False
def sig_activate(self, tree_view, path, view_column):
self.sig_action('tree_open')
def sig_activate(self, widget, iter, path):
if not self.sig_action('tree_open', warning=False):
if self.tree_res.view.row_expanded(iter):
self.tree_res.view.collapse_row(iter)
else:
self.tree_res.view.expand_row(iter, False)
def sig_edit(self):
obj_ids = self.ids_get()