def saveNewItem(self): item = SqlHandler.WeightControl(animal_id=self.item.id, weight=self.priceSelector.value()) SqlHandler.addItem(self.session, item) print('WeightControl saveNweItem, ', item) self.parent().addAskedItem(item) self.closeDialog()
def saveNewItem(self): specie = self.ui.comboBox.itemData(self.ui.comboBox.currentIndex()) if specie != None: SqlHandler.addItem(self.session, SqlHandler.Color(self.ui.lineEdit.text(), specie.id)) if self.parent().specieName() == specie.name: self.parent().setColor(self.ui.lineEdit.text()) self.closeDialog()
def __init__(self, parent=None, item=None): owner = None animal = None #check if item is dictionary. So it is called by ownerTab if(item != None and item.__class__.__name__ == 'dict'): if("owner" in item): owner = item["owner"] if("animal" in item): animal = item["animal"] item = None GenericTab.__init__(self, parent=parent, item=item) self.ui = Ui_Visit() self.ui.setupUi(self) self.ui.stackedWidget.setCurrentIndex(0) #TODO:remove if needed self.currentVisitAnimal = None self.currentOperation = None self.configure() self.createConnections() self.setBasicInfo() if(owner != None): owner = SqlHandler.makeCopy(self.session,owner) self.ownerserachline.setCurrentItem(owner) if(animal != None): animal = SqlHandler.makeCopy(self.session,animal) self.animalTreeWidget.addAskedItem(animal) #TODO find function to add animal self.disableAnimalTree(False)
def deleteItemFromSearch(self): item = self.itemSearchEdit.getCurrentItem() if item and self.askUser(): if self.itemCanBeDeleted(item): SqlHandler.removeItem(self.session, item) else: pass #error
def __init__(self, parent=None, item=None): owner = None animal = None #check if item is dictionary. So it is called by ownerTab if (item != None and item.__class__.__name__ == 'dict'): if ("owner" in item): owner = item["owner"] if ("animal" in item): animal = item["animal"] item = None GenericTab.__init__(self, parent=parent, item=item) self.ui = Ui_Visit() self.ui.setupUi(self) self.ui.stackedWidget.setCurrentIndex(0) #TODO:remove if needed self.currentVisitAnimal = None self.currentOperation = None self.configure() self.createConnections() self.setBasicInfo() if (owner != None): owner = SqlHandler.makeCopy(self.session, owner) self.ownerserachline.setCurrentItem(owner) if (animal != None): animal = SqlHandler.makeCopy(self.session, animal) self.animalTreeWidget.addAskedItem( animal) #TODO find function to add animal self.disableAnimalTree(False)
def deleteItemFromSearch(self): item = self.itemSearchEdit.getCurrentItem() if item and self.askUser(): if self.itemCanBeDeleted(item): SqlHandler.removeItem(self.session, item) else: pass #error
def __init__(self, parent=None, item=None): QWidget.__init__(self, parent) self.session = SqlHandler.newSession() self.item = SqlHandler.makeCopy(self.session, item) if item != None else None self.number = ''
def setPrices(self, visit): price_dict = visit.getPriceDict() self.ui.operationSpinBox.setValue(price_dict["operation_price"] * (100+SqlHandler.getALV(1))/100.) self.ui.accessoriesSpinBox.setValue(price_dict["accesories_price"] * (100+SqlHandler.getALV(1))/100.) self.ui.labSpinBox.setValue( price_dict["lab_price"] * (100+SqlHandler.getALV(1))/100.) self.ui.medicineSpinBox.setValue(price_dict["medicine_price"] * (100+SqlHandler.getALV(2))/100.) self.ui.dietSpinBox.setValue(price_dict["diet_price"] * (100+SqlHandler.getALV(3))/100.)
def saveNewItem(self): postoffice = self.ui.comboBox.itemData(self.ui.comboBox.currentIndex()) if postoffice != None: SqlHandler.addItem( self.session, SqlHandler.PostNumber(postoffice.id, self.ui.lineEdit.text())) self.parent().setPostNumber(self.ui.lineEdit.text()) self.closeDialog()
def saveNewItem(self): specie = self.ui.comboBox.itemData(self.ui.comboBox.currentIndex()) if specie != None: SqlHandler.addItem( self.session, SqlHandler.Color(self.ui.lineEdit.text(), specie.id)) if self.parent().specieName() == specie.name: self.parent().setColor(self.ui.lineEdit.text()) self.closeDialog()
def saveDialog(self): if self.animalsearch.getCurrentItem() != None: if self.item != None: self.item.update() self.parent().update() self.closeDialog() else: self.item = SqlHandler.PhoneRecipie(self.animalsearch.getCurrentItem(), self.recipieMedicineTreeWidget.getItemsFromList()) self.item.update(self.getData()) SqlHandler.addItem(self.session, self.item) self.parent().update() self.closeDialog()
def saveNewItem(self): tmp = SqlHandler.SummaryText(self.ui.lineEdit.text(), self.textEdit.toPlainText()) if(tmp): SqlHandler.addItem(self.session, tmp) try: self.parent().addAskedItem(tmp) except: logERROR(self,"Failed to add text to parent!") self.closeDialog() else: popErrorMessage(g_error_msg_dict['summary_name_used'])
def getData(self): print("DEBUG: getData") data = {} data['visit'] = self.visit if self.ui.clinic_radio_button.isChecked(): data['clinic_payment'] = self.ui.clinicPriceSpinBox.value() / ((100+SqlHandler.getALV(1))/100.) data['km'] = 0.0 data['km_payment'] = 0.0 else: data['clinic_payment'] = self.ui.visitPriceSpinBox.value() / ((100+SqlHandler.getALV(1))/100.) data['km'] = self.ui.KmSpinBox.value() data['km_payment'] = self.ui.KmPriceSpinBox.value() / ((100+SqlHandler.getALV(1))/100.) data['operations_payment'] = self.ui.operationSpinBox.value() / ((100+SqlHandler.getALV(1))/100.) data['lab_payment'] = self.ui.labSpinBox.value() / ((100+SqlHandler.getALV(1))/100.) data['accessories_payment'] = self.ui.accessoriesSpinBox.value() / ((100+SqlHandler.getALV(1))/100.) data['extra_percent'] = self.ui.precentSlider.value() data['medicines_payment'] = self.ui.medicineSpinBox.value() / ((100+SqlHandler.getALV(2))/100.) data['diet_payment'] = self.ui.dietSpinBox.value() / ((100+SqlHandler.getALV(3))/100.) data['payment_method'] = (self.ui.paymentComboBox.itemData(self.ui.paymentComboBox.currentIndex())) data['due_date'] = self.qdateToPy(self.ui.DueDateEdit.date()) data['paid_time'] = self.qdateToPy(self.ui.paidDateEdit.date()) data['paid_value'] = self.ui.paidSpinBox.value() data['index_number'] = self.ui.indexNumberLabel.text() data['other_info'] = self.ui.otherInfoTextEdit.toPlainText() data['satus'] = 0 #status TODO: implement if needed print('operations_payment ',data['operations_payment']) return data
def __init__(self, parent=None, item=None, animal=None): from uipy.ui_phonerecipiedialog import Ui_PhoneRecipieDialog QDialog.__init__(self, parent=parent) self.ui = Ui_PhoneRecipieDialog() self.ui.setupUi(self) self.session = SqlHandler.newSession() self.item = item self.animal = None if animal != None: self.animal = SqlHandler.makeCopy(self.session, animal) self.configure() self.createConnections() self.setBasicInfo()
def saveNewItem(self): tmp = SqlHandler.SummaryText(self.ui.lineEdit.text(), self.textEdit.toPlainText()) if (tmp): SqlHandler.addItem(self.session, tmp) try: self.parent().addAskedItem(tmp) except: logERROR(self, "Failed to add text to parent!") self.closeDialog() else: popErrorMessage(g_error_msg_dict['summary_name_used'])
def __init__(self, parent=None, item=None, animal=None): from uipy.ui_phonerecipiedialog import Ui_PhoneRecipieDialog QDialog.__init__(self, parent=parent) self.ui = Ui_PhoneRecipieDialog() self.ui.setupUi(self) self.session = SqlHandler.newSession() self.item = item self.animal = None if animal != None: self.animal = SqlHandler.makeCopy(self.session, animal) self.configure() self.createConnections() self.setBasicInfo()
def saveDialog(self): if self.animalsearch.getCurrentItem() != None: if self.item != None: self.item.update() self.parent().update() self.closeDialog() else: self.item = SqlHandler.PhoneRecipie( self.animalsearch.getCurrentItem(), self.recipieMedicineTreeWidget.getItemsFromList()) self.item.update(self.getData()) SqlHandler.addItem(self.session, self.item) self.parent().update() self.closeDialog()
def updateEndPrice(self): price_ALV1 = self.getALV1Price() * (100+SqlHandler.getALV(1))/100. price_ALV2 = self.getALV2Price() * (100+SqlHandler.getALV(2))/100. price_ALV3 = self.getALV3Price() * (100+SqlHandler.getALV(3))/100. self.ui.price_ALV1_total_label.setText('%.2f' % price_ALV1) self.ui.ALV1_total.setText('%.2f' % (price_ALV1-self.getALV1Price())) self.ui.price_ALV2_total_label.setText('%.2f' % price_ALV2) self.ui.ALV2_total.setText('%.2f' % (price_ALV2-self.getALV2Price())) self.ui.price_ALV3_total_label.setText('%.2f' % price_ALV3) self.ui.ALV3_total.setText('%.2f' % (price_ALV3-self.getALV3Price())) self.ui.endPriceLabel.setText('%.2f' % (price_ALV1 + price_ALV2 + price_ALV3))
def setRace(self, newName=''): self.ui.raceBox.clear() self.ui.raceBox.addItem('', None) specie = self.specie() if specie != None: for race in SqlHandler.searchRace(self.session, specie.id): self.ui.raceBox.addItem(race.name, race)
def setRace(self, newName=''): self.ui.raceBox.clear() self.ui.raceBox.addItem('', None) specie = self.specie() if specie != None: for race in SqlHandler.searchRace(self.session, specie.id): self.ui.raceBox.addItem(race.name, race)
def genTableRow(self, operation): counter = 0 tmp_rows = '' tmp_rows += self.genTableRowPrue(name = operation.base.name, count = operation.count, type_ = "kpl", price = operation.price, alv = SqlHandler.getALV(1)) counter += 1 if(hasattr(operation.base, 'item')): print("operation.base.item: ", operation.base.item) tmp_rows += self.genTableRowPrue(name = ('- ' + operation.base.item.name), count = operation.count, type_ = operation.base.item.count_type, price = operation.base.item.price, alv = operation.base.item.getALV()) counter += 1 if(hasattr(operation, 'items')): print("items listing strt") for surgeryitem in operation.items: total_count = operation.count*surgeryitem.count tmp_rows += self.genTableRowPrue(name = ('- ' + surgeryitem.item.name), count = total_count, type_ = surgeryitem.item.count_type, price = surgeryitem.item.price, alv = surgeryitem.item.getALV()) counter += 1 return (tmp_rows, counter)
def setColor(self): self.ui.colorBox.clear() self.ui.colorBox.addItem('', None) specie = self.specie() if specie != None: for color in SqlHandler.searchColor(self.session, specie.id): self.ui.colorBox.addItem(color.name, color)
def genTableRow(self, operation): counter = 0 tmp_rows = '' tmp_rows += self.genTableRowPrue(name=operation.base.name, count=operation.count, type_="kpl", price=operation.price, alv=SqlHandler.getALV(1)) counter += 1 if (hasattr(operation.base, 'item')): print("operation.base.item: ", operation.base.item) tmp_rows += self.genTableRowPrue( name=('- ' + operation.base.item.name), count=operation.count, type_=operation.base.item.count_type, price=operation.base.item.price, alv=operation.base.item.getALV()) counter += 1 if (hasattr(operation, 'items')): print("items listing strt") for surgeryitem in operation.items: total_count = operation.count * surgeryitem.count tmp_rows += self.genTableRowPrue( name=('- ' + surgeryitem.item.name), count=total_count, type_=surgeryitem.item.count_type, price=surgeryitem.item.price, alv=surgeryitem.item.getALV()) counter += 1 return (tmp_rows, counter)
def setColor(self): self.ui.colorBox.clear() self.ui.colorBox.addItem('', None) specie = self.specie() if specie != None: for color in SqlHandler.searchColor(self.session, specie.id): self.ui.colorBox.addItem(color.name, color)
def setPostOffice(self): for postoffice in SqlHandler.searchPostOffice(self.session): self.ui.comboBox.addItem(postoffice.name, postoffice) current = self.ui.comboBox.findText(self.parent().postOfficeName()) if current > 0: self.ui.comboBox.setCurrentIndex(current)
def __init__(self, parent=None): QDialog.__init__(self, parent=parent) self.ui = Ui_LoginDialog() self.ui.setupUi(self) self.session = SqlHandler.newSession() self.configureConnections() self.setVets()
def setSpecie(self): for specie in SqlHandler.searchSpecie(self.session): self.ui.comboBox.addItem(specie.name, specie) current = self.ui.comboBox.findText(self.parent().specieName()) if current > 0: self.ui.comboBox.setCurrentIndex(current)
def __init__(self, parent=None,item=None): GenericTab.__init__(self, parent=parent, item=None) self.ui = Ui_SummaryTab() self.ui.setupUi(self) self.returnItem = False self.visitanimal = None if type(item) is dict: if 'owner' in item: self.ui.ownerNameLabel.setText(item['owner'].name) else: logERROR(self, "SummaryTab.init: owner not found from dict") if 'visitanimal' in item: self.visitanimal = item['visitanimal'] self.ui.animalNameLabel.setText(item['visitanimal'].animal.name) else: logERROR(self, "SummaryTab.init: owner not found from dict") if 'text' in item: self.addText(item['text']) else: logERROR(self, "SummaryTab.init: text not found from dict") else: logDEBUG(self, "SummaryTab.init: item is not dict it is: "+ item) self.session = SqlHandler.newSession() self.itemSearchEdit = SearchLineEdit(tabcreator=AddNewSummary, session=self.session, parent=self, function=SqlHandler.searchSummary) self.configure() self.configureConnctions()
def setSpecie(self): for specie in SqlHandler.searchSpecie(self.session): self.ui.comboBox.addItem(specie.name, specie) current = self.ui.comboBox.findText(self.parent().specieName()) if current > 0: self.ui.comboBox.setCurrentIndex(current)
def __init__(self, parent=None): QDialog.__init__(self, parent=parent) self.ui = Ui_LoginDialog() self.ui.setupUi(self) self.session = SqlHandler.newSession() self.configureConnections(); self.setVets()
def setVet(self): self.ui.billVetBox.clear() self.ui.visitVetBox.clear() self.ui.visitVetBox.addItem('',None) self.ui.billVetBox.addItem('',None) for vet_temp in SqlHandler.searchVet(self.session): self.ui.visitVetBox.addItem(vet_temp.name, vet_temp) self.ui.billVetBox.addItem(vet_temp.name, vet_temp)
def setVet(self): self.ui.billVetBox.clear() self.ui.visitVetBox.clear() self.ui.visitVetBox.addItem('', None) self.ui.billVetBox.addItem('', None) for vet_temp in SqlHandler.searchVet(self.session): self.ui.visitVetBox.addItem(vet_temp.name, vet_temp) self.ui.billVetBox.addItem(vet_temp.name, vet_temp)
def setPostOffice(self): for postoffice in SqlHandler.searchPostOffice(self.session): self.ui.comboBox.addItem(postoffice.name, postoffice) current = self.ui.comboBox.findText(self.parent().postOfficeName()) if current > 0: self.ui.comboBox.setCurrentIndex(current)
def saveTab(self): logDEBUG(self, 'GenericTab FUNCTIO: SaveTab') #check if tab is valid if self.saveAble(): #check if there is items if self.item == None: #here self.item can be set because newToSaved will handle it self.item = self.makeItem() SqlHandler.addItem(self.session, self.item) self.update() Tabmanager.newToSaved(self) else: self.item.update(self.getData()) SqlHandler.commitSession(self.session) else: from models.translationtables import g_save_error_message self.errorMessage(g_save_error_message)
def __init__(self, parent, item=None, deftype='Item'): QDialog.__init__(self,parent=parent) self.ui = Ui_ItemCreatorDialog() self.ui.setupUi(self) self.session = SqlHandler.newSession() self.deftype = deftype self.item = item if self.item != None: self.item = SqlHandler.makeCopy(self.session, self.item) self.session.add(self.item) self.configure() self.configureConnections() self.setBasicInfo() self.selectCorrectItem()
def setVets(self, vet=None): #TODO: select last used vet self.ui.vetComboBox.clear() for vet_temp in SqlHandler.searchVet(self.session): self.ui.vetComboBox.addItem(vet_temp.name, vet_temp) if vet != None and vet.name == vet_temp.name: tmp_index = self.ui.vetComboBox.findText(vet_temp.name) if tmp_index >= 0: self.ui.vetComboBox.setCurrentIndex(tmp_index)
def setAlv1Names(self): alv = str(SqlHandler.getALV(1)) self.ui.ALV1_1.setText(alv + '%') self.ui.ALV1_2.setText(alv + '%') self.ui.ALV1_3.setText(alv + '%') self.ui.ALV1_4.setText(alv + '%') #self.ui.ALV1_5.setText(alv + '%') self.ui.ALV1_6.setText(alv + '%') self.ui.ALV1_7.setText(alv + '%')
def setPostNumber(self, newName=''): self.ui.postNumberComboBox.clear() self.ui.postNumberComboBox.addItem('', None) for postNumber in SqlHandler.searchPostNumber(self.session, postOffice=self.postOffice()): self.ui.postNumberComboBox.addItem(postNumber.number, postNumber) if newName != None and len(newName) > 0: self.ui.postNumberComboBox.setCurrentIndex(self.ui.postNumberComboBox.findText(newName))
def setVets(self, vet=None): #TODO: select last used vet self.ui.vetComboBox.clear() for vet_temp in SqlHandler.searchVet(self.session): self.ui.vetComboBox.addItem(vet_temp.name, vet_temp) if vet != None and vet.name == vet_temp.name: tmp_index = self.ui.vetComboBox.findText(vet_temp.name) if tmp_index >= 0: self.ui.vetComboBox.setCurrentIndex(tmp_index)
def setSpecie(self, newName=''): self.ui.specieComboBox.clear() self.ui.specieComboBox.addItem('', None) for specie in SqlHandler.searchSpecie(self.session): self.ui.specieComboBox.addItem(specie.name, specie) if len(newName): self.ui.specieComboBox.setCurrentIndex(self.ui.specieComboBox.findText(newName))
def __init__(self, parent, item=None): QDialog.__init__(self,parent=parent) self.ui = Ui_OwnerDescriptionDialog() self.ui.setupUi(self) self.item = item self.session = SqlHandler.newSession() self.configureConnections() self.setBasicInfo()
def setSpecie(self, newName=''): self.ui.specieComboBox.clear() self.ui.specieComboBox.addItem('', None) for specie in SqlHandler.searchSpecie(self.session): self.ui.specieComboBox.addItem(specie.name, specie) if len(newName): self.ui.specieComboBox.setCurrentIndex(self.ui.specieComboBox.findText(newName))
def setSex(self, newName=''): self.ui.sexComboBox.clear() self.ui.sexComboBox.addItem('', None) for sex in SqlHandler.searchSex(self.session): self.ui.sexComboBox.addItem(sex.name, sex) if newName != '': self.ui.sexComboBox.setCurrentIndex(self.ui.sexComboBox.findText(newName))
def saveAndCloseTab(self): logDEBUG(self, 'GenericTab FUNCTIO: saveAndCloseTab') tmp_item = None if self.saveAble(): if self.item == None: self.item = self.makeItem() SqlHandler.addItem(self.session, self.item) else: if self.hasChanged(): #update item if it has changes self.item.update(self.getData()) SqlHandler.commitSession(self.session) else: pass #logDEBUG(self,'No') self.closeTab() else: from models.translationtables import g_save_error_message self.errorMessage(g_save_error_message)
def setPostOffice(self, newName=''): self.ui.postOfficeComboBox.clear() self.ui.postOfficeComboBox.addItem('', None) for postOffice in SqlHandler.searchPostOffice(self.session): self.ui.postOfficeComboBox.addItem(postOffice.name, postOffice) if newName != None and len(newName) > 0: self.ui.postOfficeComboBox.setCurrentIndex(self.ui.postOfficeComboBox.findText(newName))
def setColor(self, newName=''): self.ui.colorComboBox.clear() self.ui.colorComboBox.addItem('', None) specie = self.specie() if specie != None: for color in SqlHandler.searchColor(self.session, specie.id): self.ui.colorComboBox.addItem(color.name, color) if len(newName): self.ui.colorComboBox.setCurrentIndex(self.ui.colorComboBox.findText(newName))
def setRace(self, newName=''): self.ui.raceComboBox.clear() self.ui.raceComboBox.addItem('', None) specie = self.specie() if specie != None: for race in SqlHandler.searchRace(self.session, specie.id): self.ui.raceComboBox.addItem(race.name, race) if len(newName): self.ui.raceComboBox.setCurrentIndex(self.ui.raceComboBox.findText(newName))
def setBasicInfo(self): self.setPaymnetMethods() self.setDueDates() self.setAlv1Names() self.setAlv2Names() self.setAlv3Names() if self.item != None: if self.item.getType() != 'Visit': self.ui.ownerLabel.setText(self.item.visit.owner.name) if self.item.km < 0.001 and self.item.km_payment < 0.001: self.ui.clinic_radio_button.setChecked(True) self.ui.clinicPriceSpinBox.setValue(self.item.clinic_payment * ((100+SqlHandler.getALV(1))/100.)) else: self.ui.clinic_radio_button.setChecked(False) self.ui.KmSpinBox.setValue(self.item.km) self.ui.visitPriceSpinBox.setValue(self.item.clinic_payment * ((100+SqlHandler.getALV(1))/100.)) self.ui.KmPriceSpinBox.setValue(self.item.km_payment * ((100+SqlHandler.getALV(1))/100.)) self.ui.operationSpinBox.setValue(self.item.operations_payment * ((100+SqlHandler.getALV(1))/100.)) self.ui.accessoriesSpinBox.setValue(self.item.accessories_payment * ((100+SqlHandler.getALV(1))/100.)) self.ui.labSpinBox.setValue(self.item.lab_payment * ((100+SqlHandler.getALV(1))/100.)) self.ui.medicineSpinBox.setValue(self.item.medicines_payment * ((100+SqlHandler.getALV(2))/100.)) self.ui.dietSpinBox.setValue(self.item.diet_payment * ((100+SqlHandler.getALV(3))/100.)) self.ui.paidSpinBox.setValue(self.item.paid_value) #this has all alvs so it cant be out of them self.ui.otherInfoTextEdit.setPlainText(self.item.other_info) self.ui.paymentComboBox.setCurrentIndex(self.ui.paymentComboBox.findData(self.item.payment_method)) self.ui.paidDateEdit.setDate(self.item.paid_time) self.ui.DueDateEdit.setDate(self.item.due_date) self.ui.precentSlider.setValue(self.item.extra_percent) self.ui.indexNumberLabel.setText(str(self.item.index_number)) else: self.ui.ownerLabel.setText(self.item.owner.name) self.setDefaultClinicPrice() self.setPrices(self.item) #item is visit else: self.errorMessage("ERROR: BillTab: setBasicInfo: item is None")
def __init__(self, parent=None, item=None): from uipy.ui_recipiemeicineDialog import Ui_RecipieMedicineDialog QDialog.__init__(self, parent=parent) self.ui = Ui_RecipieMedicineDialog() self.ui.setupUi(self) self.item = item self.dialogitem = None self.session = SqlHandler.newSession() self.configure() self.createConnections() self.setBasicInfo()
def setPostOffice(self, newName=''): self.ui.postOfficeComboBox.clear() self.ui.postOfficeComboBox.addItem('', None) for postOffice in SqlHandler.searchPostOffice(self.session): self.ui.postOfficeComboBox.addItem(postOffice.name, postOffice) if newName != None and len(newName) > 0: self.ui.postOfficeComboBox.setCurrentIndex( self.ui.postOfficeComboBox.findText(newName))
def __init__(self, parent=None): QDialog.__init__(self, parent) self.ui = Ui_Dialog() self.ui.setupUi(self) self.session = SqlHandler.newSession() self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) #save button self.ui.saveButton.clicked.connect(self.saveCheck) #enter self.ui.cancelButton.clicked.connect(self.closeDialog)
def setPostNumber(self, newName=''): self.ui.postNumberComboBox.clear() self.ui.postNumberComboBox.addItem('', None) for postNumber in SqlHandler.searchPostNumber( self.session, postOffice=self.postOffice()): self.ui.postNumberComboBox.addItem(postNumber.number, postNumber) if newName != None and len(newName) > 0: self.ui.postNumberComboBox.setCurrentIndex( self.ui.postNumberComboBox.findText(newName))