def closeEvent(self, event): # Save window state in SettingsModel SettingsModel.update({SettingsModel.str_value: str(self.width())})\ .where(SettingsModel.key == 'previous_window_width')\ .execute() SettingsModel.update({SettingsModel.str_value: str(self.height())})\ .where(SettingsModel.key == 'previous_window_height')\ .execute() if not is_system_tray_available(): if SettingsModel.get(key="enable_background_question").value: msg = QMessageBox() msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No) msg.setParent(self, QtCore.Qt.Sheet) msg.setText( self.tr("Should Vorta continue to run in the background?")) msg.button(QMessageBox.Yes).clicked.connect( lambda: self.miscTab.save_setting( "disable_background_state", True)) msg.button(QMessageBox.No).clicked.connect( lambda: (self.miscTab.save_setting( "disable_background_state", False), self.app.quit())) msg.setWindowTitle(self.tr("Quit")) dont_show_box = QCheckBox(self.tr("Don't show this again")) dont_show_box.clicked.connect( lambda x: self.miscTab.save_setting( "enable_background_question", not x)) dont_show_box.setTristate(False) msg.setCheckBox(dont_show_box) msg.exec() elif not SettingsModel.get(key="disable_background_state").value: self.app.quit() event.accept()
def profile_select_action(self, index): self.current_profile = BackupProfileModel.get(id=self.profileSelector.currentData()) self.archiveTab.populate_from_profile() self.repoTab.populate_from_profile() self.sourceTab.populate_from_profile() self.scheduleTab.populate_from_profile() SettingsModel.update({SettingsModel.str_value: self.current_profile.id})\ .where(SettingsModel.key == 'previous_profile_id')\ .execute()
def closeEvent(self, event): # Save window state in SettingsModel SettingsModel.update({SettingsModel.str_value: str(self.width())})\ .where(SettingsModel.key == 'previous_window_width')\ .execute() SettingsModel.update({SettingsModel.str_value: str(self.height())})\ .where(SettingsModel.key == 'previous_window_height')\ .execute() if not is_system_tray_available(): run_in_background = QMessageBox.question( self, trans_late("MainWindow QMessagebox", "Quit"), trans_late("MainWindow QMessagebox", "Should Vorta continue to run in the background?"), QMessageBox.Yes | QMessageBox.No) if run_in_background == QMessageBox.No: self.app.quit() event.accept()