1 ##############################################################################
3 # Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
7 # WARNING: This program as such is intended to be used by professional
8 # programmers who take the whole responsability of assessing all potential
9 # consequences resulting from its eventual inadequacies and bugs
10 # End users who are looking for a ready-to-use solution with commercial
11 # garantees and support are strongly adviced to contract a Free Software
14 # This program is Free Software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 ##############################################################################
37 class view_tree_sc(object):
38 def __init__(self
, tree
, model
):
41 self
.tree
.get_selection().set_mode('single')
42 column
= gtk
.TreeViewColumn (_('ID'), gtk
.CellRendererText(), text
=0)
43 self
.tree
.append_column(column
)
44 column
.set_visible(False)
45 cell
= gtk
.CellRendererText()
47 column
= gtk
.TreeViewColumn (_('Description'), cell
, text
=1)
48 self
.tree
.append_column(column
)
52 store
= gtk
.ListStore(gobject
.TYPE_STRING
, gobject
.TYPE_STRING
, gobject
.TYPE_STRING
)
54 sc
= rpc
.session
.rpc_exec_auth('/object', 'execute', 'ir.ui.view_sc', 'get_sc', uid
, self
.model
, rpc
.session
.context
) or []
57 store
.set(num
, 0, s
['res_id'], 1, s
['name'], 2, s
['id'])
58 self
.tree
.set_model(store
)
59 if self
.model
== 'ir.ui.menu':
60 service
.LocalService('gui.main').shortcut_set(sc
)
67 def value_get(self
, col
):
68 sel
= self
.tree
.get_selection().get_selected()
74 return model
.get_value(iter, col
)
77 res
= self
.value_get(0)
83 def serv_update(self
, ids
, action
):