/usr/share/pyshared/tryton/gui/window/board.py is in tryton-client 3.0.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | #This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Board"
import gettext
from tryton.signal_event import SignalEvent
from tryton.gui import Main
from tryton.gui.window.view_board import ViewBoard
from tryton.common import RPCExecute, RPCException
from tabcontent import TabContent
_ = gettext.gettext
class Board(SignalEvent, TabContent):
'Board'
toolbar_def = [
('new', 'tryton-new', _('New'), _('Create a new record'), None),
('save', 'tryton-save', _('Save'), _('Save this record'), None),
('switch', 'tryton-fullscreen', _('Switch'), _('Switch view'),
None),
('reload', 'tryton-refresh', _('_Reload'), _('Reload'),
'sig_reload'),
]
menu_def = [
(_('_New'), 'tryton-new', None, '<tryton>/Form/New'),
(_('_Save'), 'tryton-save', None, '<tryton>/Form/Save'),
(_('_Switch View'), 'tryton-fullscreen', None,
'<tryton>/Form/Switch View'),
(_('_Reload/Undo'), 'tryton-refresh', 'sig_reload',
'<tryton>/Form/Reload'),
(_('_Delete...'), 'tryton-delete', None, '<tryton>/Form/Delete'),
(None,) * 4,
(_('_Close Tab'), 'tryton-close', 'sig_win_close',
'<tryton>/Form/Close'),
]
def __init__(self, model, view_id, context=None, name=False,
auto_refresh=False):
super(Board, self).__init__()
try:
view, = RPCExecute('model', 'ir.ui.view', 'read',
[view_id], ['arch'], context=context)
except RPCException:
raise
self.board = ViewBoard(view['arch'], context=context)
self.model = model
self.view_id = view_id
self.context = context
self.auto_refresh = auto_refresh
self.dialogs = []
if not name:
self.name = self.board.name
else:
self.name = name
self.create_tabcontent()
def get_toolbars(self):
return {}
def widget_get(self):
return self.board.widget_get()
def sig_reload(self, test_modified=True):
self.board.reload()
return True
def sig_close(self):
return True
def __eq__(self, value):
if not value:
return False
if not isinstance(value, Board):
return False
return (self.model == value.model
and self.view_id == value.view_id
and self.context == value.context
and self.name == value.name
and self.auto_refresh == value.auto_refresh)
def sig_win_close(self, widget):
Main.get_main().sig_win_close(widget)
def set_cursor(self):
if not self.board.widgets:
return
first_widget = self.board.widgets[0]
# only Actions are added to self.board.widgets, so no need to test
# further
first_widget.screen.set_cursor()
|