當前位置: 首頁>>代碼示例>>Python>>正文


Python SqlHandler.newSession方法代碼示例

本文整理匯總了Python中models.SqlHandler.newSession方法的典型用法代碼示例。如果您正苦於以下問題:Python SqlHandler.newSession方法的具體用法?Python SqlHandler.newSession怎麽用?Python SqlHandler.newSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.SqlHandler的用法示例。


在下文中一共展示了SqlHandler.newSession方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from models import SqlHandler [as 別名]
# 或者: from models.SqlHandler import newSession [as 別名]
 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()
開發者ID:mape90,項目名稱:VetApp,代碼行數:9,代碼來源:login_dialog.py

示例2: __init__

# 需要導入模塊: from models import SqlHandler [as 別名]
# 或者: from models.SqlHandler import newSession [as 別名]
    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()
開發者ID:mape90,項目名稱:VetApp,代碼行數:35,代碼來源:summarytab.py

示例3: __init__

# 需要導入模塊: from models import SqlHandler [as 別名]
# 或者: from models.SqlHandler import newSession [as 別名]
 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()
開發者ID:mape90,項目名稱:VetApp,代碼行數:11,代碼來源:itemcreatordialog.py

示例4: __init__

# 需要導入模塊: from models import SqlHandler [as 別名]
# 或者: from models.SqlHandler import newSession [as 別名]
 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()
開發者ID:mape90,項目名稱:VetApp,代碼行數:13,代碼來源:generictreewidget.py

示例5: __init__

# 需要導入模塊: from models import SqlHandler [as 別名]
# 或者: from models.SqlHandler import newSession [as 別名]
 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)
開發者ID:mape90,項目名稱:VetApp,代碼行數:13,代碼來源:addNewDialog.py

示例6: __init__

# 需要導入模塊: from models import SqlHandler [as 別名]
# 或者: from models.SqlHandler import newSession [as 別名]
 def __init__(self, parent=None,item=None):
     GenericTab.__init__(self, parent=parent, item=item)
     self.ui = Ui_ItemCreatorTab()
     self.ui.setupUi(self)
     
     self.session = SqlHandler.newSession()
     
     self.itemSearchEdit = SearchLineEdit(tabcreator=ItemCreatorDialog, 
                                          session=self.session, 
                                          parent=self, 
                                          function=SqlHandler.searchItem)
     
     self.configure()
     self.configureConnctions()
     self.modifyItemCreator()
開發者ID:mape90,項目名稱:VetApp,代碼行數:17,代碼來源:itemcreatortab.py

示例7: __init__

# 需要導入模塊: from models import SqlHandler [as 別名]
# 或者: from models.SqlHandler import newSession [as 別名]
    def __init__(self, parent=None, item=None):
        QDialog.__init__(self, parent)
        self.ui = Ui_OperationCreator()
        self.ui.setupUi(self)
        self.session = SqlHandler.newSession()
        if item != None:
            self.item = SqlHandler.makeCopy(self.session, item)
        else:
            self.item = None


        from models.operation import SurgeryBaseItem
        self.itemTreeWidget =  ItemTreeWidget(session = self.session, parent=self, creator=SurgeryBaseItem)
        self.itemTreeWidget.setTitle("Leikkauksen tavarat")
        self.ui.itemPageLayout.addWidget(self.itemTreeWidget)
        
        self.itemSearchEdit = SearchLineEdit(tabcreator=ItemCreatorDialog, session=self.session, 
                                             parent=self, function=SqlHandler.searchItem)
        
        self.ui.searchLineEditLayout.insertWidget(0,self.itemSearchEdit)
        self.configureConnections()
        self.setBasicInfo()
開發者ID:mape90,項目名稱:VetApp,代碼行數:24,代碼來源:operationbasecreator.py

示例8: init

# 需要導入模塊: from models import SqlHandler [as 別名]
# 或者: from models.SqlHandler import newSession [as 別名]
def init(status):
    if not status:
        session = SqlHandler.newSession()
        SqlHandler.addItems(session,[SqlHandler.ALV(alv=24,alv_class=1),    #Normal items
                                     SqlHandler.ALV(alv=10,alv_class=2),    #Medicines
                                     SqlHandler.ALV(alv=14,alv_class=3)])   #Feed

        SqlHandler.addItems(session, [SqlHandler.GlobalVar(key="clinicpayment", value="20.00"),
                                      SqlHandler.GlobalVar(key="km_price", value="0.48")])

        #create species
        koira = SqlHandler.Specie('Koira')
        kissa = SqlHandler.Specie('Kissa')
        hevonen = SqlHandler.Specie('Hevonen')
        #add species
        SqlHandler.addItems(session, [koira, kissa, hevonen])
    
        item_list = []
        dogs_file_name = "koirarodut.txt"
        cats_file_name = "kissarodut.txt"
        horse_file_name = "hevosrodut.txt"
        try:
            f = open(dogs_file_name, "r", encoding="utf-8")
            for race_name in f.readlines():
                item_list.append(SqlHandler.Race(race_name.strip(),koira.id)) 
            f.close()
        except IOError:
            print("Can not find file named: " + dogs_file_name)
            pass
        try:
            f = open(cats_file_name, "r", encoding="utf-8")
            for race_name in f.readlines():
                item_list.append(SqlHandler.Race(race_name.strip(),kissa.id)) 
            f.close()
        except IOError:
            print("Can not find file named: "+ cats_file_name)
            pass
        try:
            f = open(horse_file_name, "r", encoding="utf-8")
            for race_name in f.readlines():
                item_list.append(SqlHandler.Race(race_name.strip(),hevonen.id)) 
            f.close()
        except IOError:
            print("Can not find file named: "+ cats_file_name)
            pass
        
        SqlHandler.addItems(session,item_list)
        
        try:
            f = open('postinumerot.txt', "r", encoding="utf-8")
            raw_p_data  = f.readlines()
            
            offices = []
            offices_dict = {}
            for line in raw_p_data:
                if len(line) > 1:
                    office = SqlHandler.PostOffice(line.split(' ')[0])
                    offices.append(office)
                    offices_dict[line.split(' ')[0]] = office;
            
            SqlHandler.addItems(session,offices)
            
            numbers = []
            for line in raw_p_data:
                if len(line) > 1:
                    for item in line.split(' ')[1].strip().split(','):
                        numbers.append(SqlHandler.PostNumber(offices_dict[line.split(' ')[0]].id, int(item)))
            
            SqlHandler.addItems(session,numbers)
            f.close()
        except IOError:
            print("Can not find file named: "+ cats_file_name)
            pass
開發者ID:mape90,項目名稱:VetApp,代碼行數:75,代碼來源:vettap.py


注:本文中的models.SqlHandler.newSession方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。