Reviewers: ,
Please review this at http://codereview.tryton.org/34003/
Affected files:
M tryton/gui/window/view_board/action.py
M tryton/gui/window/view_board/parser.py
M tryton/gui/window/view_board/view_board.py
Index: tryton/gui/window/view_board/action.py
===================================================================
--- a/tryton/gui/window/view_board/action.py
+++ b/tryton/gui/window/view_board/action.py
@@ -18,12 +18,12 @@
class Action(SignalEvent):
- def __init__(self, window, attrs=None):
+ def __init__(self, window, attrs=None, context=None):
super(Action, self).__init__()
self.act_id = int(attrs['name'])
self._window = window
self.screen = None
- self.tree = None
+ self.context = context or {}
try:
self.action =
rpc.execute('model', 'ir.action.act_window', 'read',
@@ -44,7 +44,7 @@
self.action['view_mode'] = attrs['view_mode']
self.action.setdefault('pyson_domain', '[]')
- self.context = {'active_id': False, 'active_ids': []}
+ self.context.update({'active_id': False, 'active_ids': []})
self.context.update(rpc.CONTEXT)
self.context.update(PYSONDecoder(self.context).decode(
self.action.get('pyson_context', '{}')))
@@ -217,31 +217,14 @@
if self.screen:
self.screen.clear()
self.screen.load(res_ids)
- elif self.tree:
- self.tree.ids = res_ids
- self.tree.reload()
return True
- def sig_key_press(self, widget, event):
- if event.keyval == gtk.keysyms.Left:
- model, paths = self.tree.view.get_selection()\
- .get_selected_rows()
- for path in paths:
- self.tree.view.collapse_row(path)
- elif event.keyval == gtk.keysyms.Right:
- model, paths = self.tree.view.get_selection()\
- .get_selected_rows()
- for path in paths:
- self.tree.view.expand_row(path, False)
-
def _active_changed(self, *args):
self.signal('active-changed')
def _get_active(self):
if self.screen:
return common.EvalEnvironment(self.screen.current_record,
False)
- elif self.tree:
- return {'id': self.tree.sel_id_get()}
active = property(_get_active)
Index: tryton/gui/window/view_board/parser.py
===================================================================
--- a/tryton/gui/window/view_board/parser.py
+++ b/tryton/gui/window/view_board/parser.py
@@ -10,9 +10,10 @@
class ParserBoard(object):
- def __init__(self, window):
+ def __init__(self, window, context=None):
self.window = window
self.title = None
+ self.context = context
def parse(self, root_node, notebook=None, paned=None, tooltips=None):
widgets = []
@@ -175,7 +176,7 @@
paned.pack2(widget, resize=True, shrink=True)
elif node.localName == 'action':
name = str(attrs['name'])
- widget_act = Action(self.window, attrs)
+ widget_act = Action(self.window, attrs, self.context)
widgets.append(widget_act)
container.wid_add(widget_act.widget,
colspan=int(attrs.get('colspan', 1)),
Index: tryton/gui/window/view_board/view_board.py
===================================================================
--- a/tryton/gui/window/view_board/view_board.py
+++ b/tryton/gui/window/view_board/view_board.py
@@ -11,9 +11,10 @@
def __init__(self, arch, window, context=None):
self.window = window
+ self.context = context
xml_dom = xml.dom.minidom.parseString(arch)
- parser = ParserBoard(window)
+ parser = ParserBoard(window, context)
for node in xml_dom.childNodes:
if not node.nodeType == node.ELEMENT_NODE:
continue
--
[email protected] mailing list