Prevent calling twice get_sc

This commit is contained in:
Cédric Krier committed 2008-06-26 11:26:28 +02:00
1 parent 90a5a654b1
commit f9727caa4e
2 files changed
+10 -9

No files matched your search

+9 -8
View File
@@ -605,19 +605,20 @@ class Main(object):
def get_main():
return _MAIN[0]
def shortcut_set(self):
def shortcut_set(self, shortcuts=None):
def _action_shortcut(widget, action):
ctx = rpc.CONTEXT.copy()
Action.exec_keyword('tree_open', {'model': 'ir.ui.menu',
'id': action, 'ids': [action],
'window': self.window}, context=ctx)
user = rpc._USER
try:
shortcuts = rpc.execute('object', 'execute',
'ir.ui.view_sc', 'get_sc', user, 'ir.ui.menu',
rpc.CONTEXT)
except:
shortcuts = []
if shortcuts is None:
user = rpc._USER
try:
shortcuts = rpc.execute('object', 'execute',
'ir.ui.view_sc', 'get_sc', user, 'ir.ui.menu',
rpc.CONTEXT)
except:
shortcuts = []
menu = gtk.Menu()
for shortcut in shortcuts:
menuitem = gtk.MenuItem(shortcut['name'])
+1 -1
View File
@@ -43,7 +43,7 @@ class ViewTreeSC(object):
2, shortcut['id'])
self.tree.set_model(store)
if self.model == 'ir.ui.menu':
Main.get_main().shortcut_set()
Main.get_main().shortcut_set(shortcuts=view_sc)
def value_get(self, col):
sel = self.tree.get_selection().get_selected()