Ejemplo n.º 1
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)

        # self.data_model.dump()

        self.data_model.purge()
Ejemplo n.º 2
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)

        # 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)
Ejemplo n.º 3
0
 def getAreaForm(self):
     return EditFormSet(collection=self.area_collection)
Ejemplo n.º 4
0
 def getDeviceForm(self):
     return EditFormSet(collection=self.device_collection)
Ejemplo n.º 5
0
 def getCompanyForm(self):
     return EditFormSet(collection=self.company_collection)
Ejemplo n.º 6
0
 def getVehicleForm(self):
     return EditFormSet(collection=self.vehicle_collection)
Ejemplo n.º 7
0
 def getPersonForm(self):
     return EditFormSet(collection=self.person_collection)