Exemplo n.º 1
0
 def initUi(self):
     self.ui.cb_mainLocation.clear()
     self.ui.cb_subLocation.setEnabled(False)
     mainLocation = db.readLocations('main')
     self.ui.cb_mainLocation.addItem('', -1)
     for e in mainLocation:
         self.ui.cb_mainLocation.addItem(str(e['name']), e['id'])
     self.ui.cb_mainLocation.setCurrentIndex(-1)
     self.ui.cb_mainLocation.currentIndexChanged.connect(self.getSubLocations)
     self.ui.pB_loadImage.clicked.connect(self.openImage)
Exemplo n.º 2
0
    def updateSubLocationlist(self):
        self.sublocationlist.clear()
        mainlocation = self.mainlocationlist.selectedItems()[0].data(
            qt.UserRole)[0]
        sublocations = db.readLocations('sub', mainlocation)

        for e in sublocations:
            self.sublocationlist.addItem(self.makeListItem(e))

        if self.sublocationlist.count() == 0:
            self.ui.pb_removeSubLocation.setEnabled(False)
            self.ui.pb_editSubLocation.setEnabled(False)
Exemplo n.º 3
0
 def getSubLocations(self, index):
     mainLocation = self.ui.cb_mainLocation.itemData(index)
     if mainLocation == -1:
         self.ui.cb_subLocation.clear()
         self.ui.cb_subLocation.setEnabled(False)
     elif not self.ui.cb_mainLocation.currentIndex() == -1:
         self.ui.cb_subLocation.setEnabled(True)
         self.ui.cb_subLocation.clear()
         self.ui.cb_subLocation.addItem('', -1)
         if not mainLocation == None:
             subLocations = db.readLocations('sub', mainLocation)
             for e in subLocations:
                 self.ui.cb_subLocation.addItem(str(e['name']), e['id'])
             self.ui.cb_subLocation.setCurrentIndex(0)
     else:
         self.ui.cb_subLocation.setEnabled(False)
Exemplo n.º 4
0
    def mainlocationchanged(self, item):
        if item:
            self.sublocationlist.clear()
            self.ui.pb_removeSubLocation.setEnabled(False)
            self.ui.pb_editSubLocation.setEnabled(False)
            self.ui.pb_editMainLocation.setEnabled(True)
            self.ui.pb_removeMainLocation.setEnabled(True)
            self.newsublocationtextbox.setEnabled(True)
            mainLocation = item.data(qt.UserRole)
            sublocations = db.readLocations('sub', mainLocation[0])
            self.ui.lbl_SubLocation.setText(mainLocation[1])

            for e in sublocations:
                self.sublocationlist.addItem(self.makeListItem(e))

        else:
            pass
Exemplo n.º 5
0
 def readMainLocationinListWidget(self):
     self.mainlocationlist.clear()
     mainLocation = db.readLocations('main')
     for e in mainLocation:
         self.mainlocationlist.addItem(self.makeListItem(e))