Пример #1
0
    def __init__(self, model, name='', **attributes):
        super(Board, self).__init__(**attributes)

        context = attributes.get('context')
        self.view_ids = attributes.get('view_ids')

        try:
            view, = RPCExecute('model',
                               'ir.ui.view',
                               'read',
                               self.view_ids, ['arch'],
                               context=context)
        except RPCException:
            raise

        xml_dom = xml.dom.minidom.parseString(view['arch'])
        root, = xml_dom.childNodes
        self.board = ViewBoard(root, context=context)
        self.model = model
        self.dialogs = []
        if not name:
            self.name = self.board.name
        else:
            self.name = name

        self.create_tabcontent()
Пример #2
0
    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()
Пример #3
0
class Board(SignalEvent, TabContent):
    'Board'

    def __init__(self, model, name='', **attributes):
        super(Board, self).__init__(**attributes)

        context = attributes.get('context')
        self.view_ids = attributes.get('view_ids')

        try:
            view, = RPCExecute('model',
                               'ir.ui.view',
                               'read',
                               self.view_ids, ['arch'],
                               context=context)
        except RPCException:
            raise

        self.board = ViewBoard(view['arch'], context=context)
        self.model = model
        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 compare(self, model, attributes):
        if not attributes:
            return False
        return (
            self.model == model
            and self.attributes.get('view_ids') == attributes.get('view_ids')
            and self.attributes.get('context') == attributes.get('context'))

    def __hash__(self):
        return id(self)

    def sig_win_close(self, widget):
        Main().sig_win_close(widget)

    def set_cursor(self):
        if not self.board.actions:
            return
        first_action = self.board.actions[0]
        first_action.screen.set_cursor()
Пример #4
0
class Board(TabContent):
    'Board'

    def __init__(self, model, name='', **attributes):
        super(Board, self).__init__(**attributes)

        context = attributes.get('context')
        self.view_id, = attributes.get('view_ids')

        view = RPCExecute('model',
                          'ir.ui.view',
                          'view_get',
                          self.view_id,
                          context=context)

        xml_dom = xml.dom.minidom.parseString(view['arch'])
        root, = xml_dom.childNodes
        self.board = ViewBoard(root, context=context)
        self.model = model
        self.dialogs = []
        if not name:
            name = MODELNAME.get(model)
        self.name = name

        self.create_tabcontent()
        self.board.reload()

    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 compare(self, model, attributes):
        if not attributes:
            return False
        return (
            self.model == model
            and self.attributes.get('view_ids') == attributes.get('view_ids')
            and self.attributes.get('context') == attributes.get('context'))

    def __hash__(self):
        return id(self)

    def sig_win_close(self, widget):
        Main().sig_win_close(widget)

    def set_cursor(self):
        if not self.board.actions:
            return
        first_action = self.board.actions[0]
        first_action.screen.set_cursor()
Пример #5
0
    def __init__(self, model, name='', **attributes):
        super(Board, self).__init__(**attributes)

        context = attributes.get('context')
        self.view_id, = attributes.get('view_ids')

        view = RPCExecute('model',
                          'ir.ui.view',
                          'view_get',
                          self.view_id,
                          context=context)

        xml_dom = xml.dom.minidom.parseString(view['arch'])
        root, = xml_dom.childNodes
        self.board = ViewBoard(root, context=context)
        self.model = model
        self.dialogs = []
        if not name:
            name = MODELNAME.get(model)
        self.name = name

        self.create_tabcontent()
        self.board.reload()
Пример #6
0
    def __init__(self, model, name='', **attributes):
        super(Board, self).__init__()

        context = attributes.get('context')
        self.view_ids = attributes.get('view_ids')

        try:
            view, = RPCExecute('model',
                               'ir.ui.view',
                               'read',
                               self.view_ids, ['arch'],
                               context=context)
        except RPCException:
            raise

        self.board = ViewBoard(view['arch'], context=context)
        self.model = model
        self.dialogs = []
        if not name:
            self.name = self.board.name
        else:
            self.name = name

        self.create_tabcontent()
Пример #7
0
    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()
Пример #8
0
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()
Пример #9
0
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()
Пример #10
0
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()
Пример #11
0
class Board(SignalEvent, TabContent):
    'Board'

    @property
    def toolbar_def(self):
        return [
            ('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'),
        ]

    @property
    def menu_def(self):
        return [
            (_('_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, name='', **attributes):
        super(Board, self).__init__()

        context = attributes.get('context')
        self.view_ids = attributes.get('view_ids')

        try:
            view, = RPCExecute('model',
                               'ir.ui.view',
                               'read',
                               self.view_ids, ['arch'],
                               context=context)
        except RPCException:
            raise

        self.board = ViewBoard(view['arch'], context=context)
        self.model = model
        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_ids == value.view_ids
                and self.board.context == value.board.context
                and self.name == value.name)

    def sig_win_close(self, widget):
        Main.get_main().sig_win_close(widget)

    def set_cursor(self):
        if not self.board.actions:
            return
        first_action = self.board.actions[0]
        first_action.screen.set_cursor()