diff --git a/backupdlg.ui b/backupdlg.ui index 522ce78..fe92990 100644 --- a/backupdlg.ui +++ b/backupdlg.ui @@ -178,7 +178,7 @@ p, li { white-space: pre-wrap; } - 24 + 0 Qt::AlignCenter diff --git a/qubesmanager/backup.py b/qubesmanager/backup.py index ef3623d..c74e0de 100644 --- a/qubesmanager/backup.py +++ b/qubesmanager/backup.py @@ -173,9 +173,17 @@ class BackupVMsWindow(Ui_Backup, QWizard): if not self.thread_monitor.success: QMessageBox.warning (None, "Backup error!", "ERROR: {1}".format(self.vm.name, self.thread_monitor.error_msg)) - umount_device(self.dev_mount_path) + if self.dev_mount_path != None: + umount_device(self.dev_mount_path) self.button(self.FinishButton).setEnabled(True) + + def reject(self): + if self.dev_mount_path != None: + umount_device(self.dev_mount_path) + self.done(0) + + def has_selected_vms(self): return self.select_vms_widget.selected_list.count() > 0 diff --git a/qubesmanager/backup_utils.py b/qubesmanager/backup_utils.py index 0978b03..d7ab726 100644 --- a/qubesmanager/backup_utils.py +++ b/qubesmanager/backup_utils.py @@ -81,8 +81,7 @@ def fill_devs_list(dialog): dialog.dev_combobox.setCurrentIndex(0) #current selected is null "" dialog.prev_dev_idx = 0 dialog.dir_line_edit.clear() - dialog.dir_line_edit.setEnabled(False) - dialog.select_path_button.setEnabled(False) + enable_dir_line_edit(dialog, True) def enable_dir_line_edit(dialog, boolean): @@ -100,12 +99,10 @@ def dev_combobox_activated(dialog, idx): if dialog.dev_mount_path != None: dialog.dev_mount_path = umount_device(dialog.dev_mount_path) - if dialog_dev_mount_path != None: + if dialog.dev_mount_path != None: dialog.dev_combobox.setCurrentIndex(dialog.prev_dev_idx) return - enable_dir_line_edit(dialog, False) - if dialog.dev_combobox.currentText() != "None": #An existing device chosen dev_name = str(dialog.dev_combobox.itemData(idx).toString()) @@ -123,16 +120,13 @@ def dev_combobox_activated(dialog, idx): #check if device mounted dialog.dev_mount_path = check_if_mounted(dev_path) - if dialog.dev_mount_path != None: - enable_dir_line_edit(dialog, True) - else: + if dialog.dev_mount_path == None: dialog.dev_mount_path = mount_device(dev_path) - if dialog.dev_mount_path != None: - enable_dir_line_edit(dialog, True) - else: + if dialog.dev_mount_path == None: dialog.dev_combobox.setCurrentIndex(0) #if couldn't mount - set current device to "None" + dialog.prev_dev_idx = 0 + return - dialog.prev_dev_idx = idx dialog.select_dir_page.emit(SIGNAL("completeChanged()")) @@ -141,7 +135,12 @@ def select_path_button_clicked(dialog): dialog.backup_dir = dialog.dir_line_edit.text() file_dialog = QFileDialog() file_dialog.setReadOnly(True) - new_path = file_dialog.getExistingDirectory(dialog, "Select backup directory.", dialog.dev_mount_path) + + if dialog.dev_mount_path != None: + new_path = file_dialog.getExistingDirectory(dialog, "Select backup directory.", dialog.dev_mount_path) + else: + new_path = file_dialog.getExistingDirectory(dialog, "Select backup directory.", "~") + if new_path: dialog.dir_line_edit.setText(new_path) dialog.backup_dir = new_path diff --git a/qubesmanager/restore.py b/qubesmanager/restore.py index a2d509e..787c02c 100644 --- a/qubesmanager/restore.py +++ b/qubesmanager/restore.py @@ -97,7 +97,6 @@ class RestoreVMsWindow(Ui_Restore, QWizard): def dev_combobox_activated(self, idx): dev_combobox_activated(self, idx) - @pyqtSlot(name='on_select_path_button_clicked') def select_path_button_clicked(self): select_path_button_clicked(self) @@ -209,8 +208,14 @@ class RestoreVMsWindow(Ui_Restore, QWizard): #if not self.thread_monitor.success: #QMessageBox.warning (None, "Backup error!", "ERROR: {1}".format(self.vm.name, self.thread_monitor.error_msg)) - umount_device(self.dev_mount_path) + if self.dev_mount_path != None: + umount_device(self.dev_mount_path) self.button(self.FinishButton).setEnabled(True) + + def reject(self): + if self.dev_mount_path != None: + umount_device(self.dev_mount_path) + self.done(0)