def setupUi(self):
        self.setGeometry(QtCore.QRect(100, 100, 800, 800))
        self.w = QtWidgets.QWidget(self)
        self.setCentralWidget(self.w)
        self.lay = QtWidgets.QHBoxLayout(self.w)

        # Create a list
        self.lis = self.data_model.PersonList(
            collection=self.data_model.collection)

        # Get lists's widget
        self.lis.widget.setParent(self.w)

        # Add to main layout
        self.lay.addWidget(self.lis.widget)

        # Create a group of forms
        self.formset = EditFormSet(collection=self.data_model.collection)

        # Get form's widget and set it's parent to the current main widget
        self.formset.widget.setParent(self.w)

        # Add formset to layout
        self.lay.addWidget(self.formset.widget)

        # Inform formset about the item in question.  "self.lis.widget" is a QListWidget instance.
        self.lis.widget.currentItemChanged.connect(
            self.formset.chooseForm_slot)

        # inform list when a new record has been added or when a record has been saved
        self.formset.signals.new_record.connect(self.lis.update_slot)
        self.formset.signals.save_record.connect(self.lis.update_slot)
    def setupUi(self):
        self.setGeometry(QtCore.QRect(100, 100, 800, 800))
        self.w = QtWidgets.QWidget(self)
        self.setCentralWidget(self.w)
        self.lay = QtWidgets.QHBoxLayout(self.w)

        # Create a list
        self.lis = PersonList(collection=collection)

        # Get lists's widget
        self.lis.widget.setParent(self.w)

        # Add to main layout
        self.lay.addWidget(self.lis.widget)

        # Create a group of forms
        self.formset = FormSet(collection=collection)

        # Get form's widget.  It encapsulates the form widgets of each row type
        self.formset.widget.setParent(self.w)

        # Add formset to layout
        self.lay.addWidget(self.formset.widget)

        # Inform formset about the item in question
        self.lis.widget.currentItemChanged.connect(
            self.formset.chooseForm_slot)
    def setupUi(self):
        self.setGeometry(QtCore.QRect(100, 100, 800, 800))
        self.w = QtWidgets.QWidget(self)
        self.setCentralWidget(self.w)
        self.lay = QtWidgets.QHBoxLayout(self.w)

        # Create a list view of a collection.  We need to provide a collection, of course
        self.lis = PersonList(collection=collection)

        # Get lists's widget, set its parent to the current main widget
        self.lis.widget.setParent(self.w)

        # Add to main layout
        self.lay.addWidget(self.lis.widget)
Beispiel #4
0
    def setupUi(self):
        self.setGeometry(QtCore.QRect(100, 100, 800, 800))
        self.w = QtWidgets.QWidget(self)
        self.setCentralWidget(self.w)
        self.lay = QtWidgets.QHBoxLayout(self.w)

        self.person_view = ListAndForm(
            self.data_model.PersonList(collection=self.data_model.collection),
            EditFormSet(collection=self.data_model.collection), "Persons",
            self.w)
        self.food_view = ListAndForm(
            self.data_model.FoodList(
                collection=self.data_model.food_collection),
            EditFormSet(collection=self.data_model.food_collection), "Foods",
            self.w)

        self.food_view.modified.connect(self.person_view.update)

        # instantiate PersonFormSet => instantiate rows => row instantiates widgets based on the columns => ..
        # updating: call row's updateWidget method => re-creates column widgets

        self.lay.addWidget(self.person_view.widget)
        self.lay.addWidget(self.food_view.widget)
Beispiel #5
0
 def setupUi(self):
     self.setGeometry(QtCore.QRect(100, 100, 800, 800))
     self.w = QtWidgets.QWidget(self)
     self.setCentralWidget(self.w)
     # self.lay=QtWidgets.QGridLayout(self.w)
     self.lay = QtWidgets.QHBoxLayout(self.w)
Beispiel #6
0
 def setupUi(self):
   self.setGeometry(QtCore.QRect(100,100,800,800))
   self.w=QtWidgets.QWidget(self)
   self.setCentralWidget(self.w)
   self.lay=QtWidgets.QHBoxLayout(self.w)
   
   self.person_view  =ListAndForm(self.data_model.getPersonList(), self.data_model.getPersonForm(),  "Registered Persons",  self.w)
   self.vehicle_view =ListAndForm(self.data_model.getVehicleList(),self.data_model.getVehicleForm(), "Registered Vehicles", self.w)
   self.device_view  =ListAndForm(self.data_model.getDeviceList(), self.data_model.getDeviceForm(),  "Registered Cameras",  self.w)
   self.company_view =ListAndForm(self.data_model.getCompanyList(),self.data_model.getCompanyForm(), "Registered Companies",self.w)
   self.area_view    =ListAndForm(self.data_model.getAreaList(),   self.data_model.getAreaForm(),    "Registered Areas",    self.w)
   
   self.area_permission_view  =PermissionListsAndForm("Area Permissions",          
                                                       self.data_model.getAreaList(),
                                                       self.data_model.getVehicleList(),
                                                       self.data_model.getAreaPermissionForm(),
                                                       titles=["AREA","VEHICLE","PERMISSION"],
                                                       parent=self.w)
   
   self.area_permission_per_company_view =PermissionListsAndForm("Area Permission per Company",
                                                                 self.data_model.getAreaList(),
                                                                 self.data_model.getCompanyList(),
                                                                 self.data_model.getAreaPerCompanyPermissionForm(),
                                                                 titles=["AREA","COMPANY","PERMISSION"],
                                                                 parent=self.w)
   
   # Update GUI's if relation targets change:
   self.device_view.modified. connect(self.area_view.update)
   self.vehicle_view.modified.connect(self.area_view.update)
   self.area_view.modified.   connect(self.area_permission_view.update)
   self.vehicle_view.modified.connect(self.area_permission_view.update)
   self.area_view.modified.   connect(self.area_permission_per_company_view.update)
   self.company_view.modified.connect(self.area_permission_per_company_view.update)
   
   self.all_views=[self.person_view, self.vehicle_view, self.device_view, self.company_view, self.area_view, self.area_permission_view, self.area_permission_per_company_view]
   
   self.hideAll()
   for view in self.all_views:
     self.lay.addWidget(view.widget)
   
   self.file_menu    =self.menuBar().addMenu("File")
   self.config_menu  =self.menuBar().addMenu("Configuration")
   self.perm_menu    =self.menuBar().addMenu("Permissions")
   
   self.exit_action           =self.file_menu.addAction("Exit")
   self.exit_action.triggered.connect(self.exit_slot)
   
   self.person_menu_action   =self.config_menu.addAction("Persons")
   self.vehicle_menu_action  =self.config_menu.addAction("Vehicles")
   self.device_menu_action   =self.config_menu.addAction("Devices")
   self.company_menu_action  =self.config_menu.addAction("Companies")
   self.area_menu_action     =self.config_menu.addAction("Areas")
   
   self.area_permissions_action =self.perm_menu.addAction("Area Permissions")
   self.area_per_company_action =self.perm_menu.addAction("Area per Company Permissions")
   
   self.person_menu_action.triggered.  connect(self.person_menu_slot)
   self.vehicle_menu_action.triggered. connect(self.vehicle_menu_slot)
   self.device_menu_action.triggered.  connect(self.device_menu_slot)
   self.company_menu_action.triggered. connect(self.company_menu_slot)
   self.area_menu_action.triggered.    connect(self.area_menu_slot)
   
   self.area_permissions_action.triggered. connect(self.area_permission_slot)
   self.area_per_company_action.triggered. connect(self.area_per_company_slot)