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 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 refresh(self): SqlHandler.commitSession(self.session)