def initial_farm_wtgs(self): #set option for farm and wtgs self.comboBox_farm_set_db2.clear() # 清空items self.comboBox_wtgs_set_db2.clear() # 清空items self.comboBox_farm_set_db2.addItem(u'全部') self.comboBox_wtgs_set_db2.addItem(u'全部') # initial the items of comboBox_farm (self.farm, self.wtgs) = dataIO.farmcodeDirectory() for (keys, val) in self.farm.items(): self.comboBox_farm_set_db2.addItem(val, QVariant(keys))
def on_comboBox_farm_set_db2_activated(self, index): """ Slot documentation goes here. @param index DESCRIPTION @type int """ # TODO: not implemented yet if self.comboBox_farm_set_db2.currentText() != "全部": (self.farm, self.wtgs) = dataIO.farmcodeDirectory() index = self.comboBox_farm_set_db2.currentIndex() intdata = self.comboBox_farm_set_db2.itemData(index) self.comboBox_wtgs_set_db2.clear() self.comboBox_wtgs_set_db2.addItem(u'全部') for (keys, val) in self.wtgs[intdata].items(): self.comboBox_wtgs_set_db2.addItem(val, QVariant(keys))