本文整理汇总了Python中models.SqlHandler类的典型用法代码示例。如果您正苦于以下问题:Python SqlHandler类的具体用法?Python SqlHandler怎么用?Python SqlHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SqlHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: saveNewItem
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()
示例3: deleteItemFromSearch
def deleteItemFromSearch(self):
item = self.itemSearchEdit.getCurrentItem()
if item and self.askUser():
if self.itemCanBeDeleted(item):
SqlHandler.removeItem(self.session, item)
else:
pass #error
示例4: setPrices
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.)
示例5: saveDialog
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()
示例6: getData
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
示例7: __init__
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()
示例8: updateEndPrice
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))
示例9: setSpecie
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)
示例10: __init__
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()
示例11: __init__
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()
示例12: genTableRow
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)
示例13: setRace
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)
示例14: setColor
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)
示例15: setVet
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)