Exemplo n.º 1
0
    def __init__(self, title, admin, model, index):
        AbstractView.__init__(self)

        layout = QtGui.QVBoxLayout()
        form_and_actions_layout = QtGui.QHBoxLayout()
        form_and_actions_layout.setObjectName('form_and_actions_layout')
        layout.addLayout(form_and_actions_layout)

        self.model = model
        self.admin = admin
        self.title_prefix = title

        form = FormWidget(self, admin)
        form.setObjectName('form')
        form.changed_signal.connect(self.update_title)
        form.set_model(model)
        form.set_index(index)
        form_and_actions_layout.addWidget(form)

        statusbar = StatusBar(self)
        statusbar.setObjectName('statusbar')
        statusbar.setSizeGripEnabled(False)
        layout.addWidget(statusbar)
        layout.setAlignment(statusbar, Qt.AlignBottom)
        self.setLayout(layout)

        self.change_title(title)

        if hasattr(admin, 'form_size') and admin.form_size:
            self.setMinimumSize(admin.form_size[0], admin.form_size[1])

        self.validator = admin.create_validator(model)
        self.validate_before_close = True

        def get_actions():
            return admin.get_form_actions(None)

        post(get_actions, self.setActions)
        self.update_title()
        #
        # Define actions
        #
        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.addAction(ActionFactory.view_first(self, self.viewFirst))
        self.addAction(ActionFactory.view_last(self, self.viewLast))
        self.addAction(ActionFactory.view_next(self, self.viewNext))
        self.addAction(ActionFactory.view_previous(self, self.viewPrevious))
        self.addAction(ActionFactory.refresh(self, self.refresh_session))
        self.addAction(ActionFactory.export_ooxml(self, form.export_ooxml))
Exemplo n.º 2
0
    def __init__(self, title, admin, model, index, parent = None):
        AbstractView.__init__( self, parent )

        layout = QtGui.QVBoxLayout()
        layout.setSpacing( 1 )
        layout.setContentsMargins( 1, 1, 1, 1 )
        layout.setObjectName( 'layout' )
        form_and_actions_layout = QtGui.QHBoxLayout()
        form_and_actions_layout.setObjectName('form_and_actions_layout')
        layout.addLayout( form_and_actions_layout )
            
        self.model = model
        self.admin = admin
        self.title_prefix = title
        self.refresh_action = Refresh()

        form = FormWidget(self, admin)
        form.setObjectName( 'form' )
        form.changed_signal.connect( self.update_title )
        form.set_model(model)
        form.set_index(index)
        form_and_actions_layout.addWidget(form)

        self.gui_context = FormActionGuiContext()
        self.gui_context.workspace = self
        self.gui_context.admin = admin
        self.gui_context.view = self
        self.gui_context.widget_mapper = self.findChild( QtGui.QDataWidgetMapper, 
                                                         'widget_mapper' )
        self.setLayout( layout )

        self.change_title(title)

        if hasattr(admin, 'form_size') and admin.form_size:
            self.setMinimumSize(admin.form_size[0], admin.form_size[1])

        self.accept_close_event = False

        get_actions = admin.get_form_actions
        post( functools.update_wrapper( functools.partial( get_actions, 
                                                           None ),
                                        get_actions ),
              self.set_actions )

        get_toolbar_actions = admin.get_form_toolbar_actions
        post( functools.update_wrapper( functools.partial( get_toolbar_actions, 
                                                           Qt.TopToolBarArea ),
                                        get_toolbar_actions ),
              self.set_toolbar_actions )
Exemplo n.º 3
0
    def __init__(self, title, admin, model, index):
        AbstractView.__init__(self)

        layout = QtGui.QVBoxLayout()
        form_and_actions_layout = QtGui.QHBoxLayout()
        form_and_actions_layout.setObjectName('form_and_actions_layout')
        layout.addLayout(form_and_actions_layout)

        self.model = model
        self.admin = admin
        self.title_prefix = title

        form = FormWidget(self, admin)
        form.setObjectName( 'form' )
        form.changed_signal.connect( self.update_title )
        form.set_model(model)
        form.set_index(index)
        form_and_actions_layout.addWidget(form)

        statusbar = StatusBar(self)
        statusbar.setObjectName('statusbar')
        statusbar.setSizeGripEnabled(False)
        layout.addWidget(statusbar)
        layout.setAlignment(statusbar, Qt.AlignBottom)
        self.setLayout(layout)

        self.change_title(title)

        if hasattr(admin, 'form_size') and admin.form_size:
            self.setMinimumSize(admin.form_size[0], admin.form_size[1])

        self.validator = admin.create_validator(model)
        self.validate_before_close = True

        def get_actions():
            return admin.get_form_actions(None)

        post(get_actions, self.setActions)
        self.update_title()
        #
        # Define actions
        #
        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.addAction( ActionFactory.view_first(self, self.viewFirst) )
        self.addAction( ActionFactory.view_last(self, self.viewLast) )
        self.addAction( ActionFactory.view_next(self, self.viewNext) )
        self.addAction( ActionFactory.view_previous(self, self.viewPrevious) )
        self.addAction( ActionFactory.refresh(self, self.refresh_session) )
        self.addAction( ActionFactory.export_ooxml(self, form.export_ooxml) )
Exemplo n.º 4
0
    def __init__(self, title, admin, model, index, parent=None):
        AbstractView.__init__(self, parent)

        layout = QtGui.QVBoxLayout()
        layout.setSpacing(1)
        layout.setContentsMargins(1, 1, 1, 1)
        layout.setObjectName('layout')
        form_and_actions_layout = QtGui.QHBoxLayout()
        form_and_actions_layout.setObjectName('form_and_actions_layout')
        layout.addLayout(form_and_actions_layout)

        self.model = model
        self.admin = admin
        self.title_prefix = title
        self.refresh_action = Refresh()

        form = FormWidget(self, admin)
        form.setObjectName('form')
        form.changed_signal.connect(self.update_title)
        form.set_model(model)
        form.set_index(index)
        form_and_actions_layout.addWidget(form)

        self.gui_context = FormActionGuiContext()
        self.gui_context.workspace = self
        self.gui_context.admin = admin
        self.gui_context.view = self
        self.gui_context.widget_mapper = self.findChild(
            QtGui.QDataWidgetMapper, 'widget_mapper')
        self.setLayout(layout)

        self.change_title(title)

        if hasattr(admin, 'form_size') and admin.form_size:
            self.setMinimumSize(admin.form_size[0], admin.form_size[1])

        self.accept_close_event = False

        get_actions = admin.get_form_actions
        post(
            functools.update_wrapper(functools.partial(get_actions, None),
                                     get_actions), self.set_actions)

        get_toolbar_actions = admin.get_form_toolbar_actions
        post(
            functools.update_wrapper(
                functools.partial(get_toolbar_actions, Qt.TopToolBarArea),
                get_toolbar_actions), self.set_toolbar_actions)
Exemplo n.º 5
0
 def __init__(self, parent):
     AbstractView.__init__(self, parent)
     self.widget_layout = QtGui.QVBoxLayout()
     self.widget_layout.setMargin(0)
     title = _('New')
     index = 0
     self.form_view = admin.create_form_view(
         title, model, index, parent)
     self.widget_layout.insertWidget(0, self.form_view)
     self.setLayout(self.widget_layout)
     self.validate_before_close = True
     #
     # every time data has been changed, it could become valid,
     # when this is the case, it should be propagated
     #
     model.dataChanged.connect(self.dataChanged)
     self.form_view.title_changed_signal.connect(self.change_title)
Exemplo n.º 6
0
 def __init__(self, parent):
     AbstractView.__init__(self, parent)
     self.widget_layout = QtGui.QVBoxLayout()
     self.widget_layout.setMargin(0)
     title = _('New')
     index = 0
     self.form_view = admin.create_form_view(
         title, model, index, parent
     )
     self.widget_layout.insertWidget(0, self.form_view)
     self.setLayout(self.widget_layout)
     self.validate_before_close = True
     #
     # every time data has been changed, it could become valid,
     # when this is the case, it should be propagated
     #
     model.dataChanged.connect( self.dataChanged )
     self.form_view.title_changed_signal.connect( self.change_title )
Exemplo n.º 7
0
    def __init__(self, title, admin, model, form_display, columns,
                 index, parent = None):
        AbstractView.__init__( self, parent )

        layout = QtWidgets.QVBoxLayout()
        layout.setSpacing( 1 )
        layout.setContentsMargins( 1, 1, 1, 1 )
        layout.setObjectName( 'layout' )
        form_and_actions_layout = QtWidgets.QHBoxLayout()
        form_and_actions_layout.setObjectName('form_and_actions_layout')
        layout.addLayout( form_and_actions_layout )
            
        self.model = model
        self.admin = admin
        self.title_prefix = title
        self.refresh_action = Refresh()

        form = FormWidget(admin=admin, model=model, form_display=form_display,
                          columns=columns, parent=self)
        form.setObjectName( 'form' )
        form.changed_signal.connect( self.update_title )
        form.set_index(index)
        form_and_actions_layout.addWidget(form)

        self.gui_context = FormActionGuiContext()
        self.gui_context.workspace = self
        self.gui_context.admin = admin
        self.gui_context.view = self
        self.gui_context.widget_mapper = self.findChild( QtWidgets.QDataWidgetMapper, 
                                                         'widget_mapper' )
        self.setLayout( layout )
        self.change_title(title)

        if hasattr(admin, 'form_size') and admin.form_size:
            self.setMinimumSize(admin.form_size[0], admin.form_size[1])

        self.accept_close_event = False