def closeEvent(self, event): if self.db and self.db.vcs.localChanges(): ans = QtWidgets.QMessageBox.question(self, "Local changes present", "Database was modified locally. Are you sure you want to quit " "without committing the changes?", QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes) if ans == QtWidgets.QMessageBox.Yes: config.setDefaultDatabase(self.db) event.accept() else: event.ignore() else: if self.db: config.setDefaultDatabase(self.db) event.accept()
def setDefault(self): """Set this database as default in config.""" from bibtexvcs import config config.setDefaultDatabase(self)