def slot_open(self, force): """Open a database file. If 'force' is not True try to get the last used one from the settings mechanism. Return True if successful. """ if self.db: self.slot_pupilChanged(-1) # save current report while True: db = selectDBFile(self.gui.settings, force) if db: # Clear revisions dictionary (for undo/redo) self.revisionDict = {} self.db = db try: if self.initialize(): self.gui.showDbFile(self.db.descriptor) # Show teacher's name self.gui.showTeacher(self.db.getTeacherName( self.db.owner)) return True except: warning(_("Database file '%s' contains invalid data") % self.db.descriptor) force = True self.db = None continue break if self.db: return False signal("quit")
def slot_open(self, force): """Open a database file. If 'force' is not True try to get the last used one from the settings mechanism. """ self.open(selectDBFile(self.gui.settings, force, dbSuffix=u"zgb"))