diff --git a/qubesmanager/backup.py b/qubesmanager/backup.py index 126841c..81b88f6 100644 --- a/qubesmanager/backup.py +++ b/qubesmanager/backup.py @@ -73,7 +73,7 @@ class BackupVMsWindow(Ui_Backup, QWizard): if vm.qid == 0: self.vm = vm break; - + assert self.vm != None self.setupUi(self) @@ -118,9 +118,9 @@ class BackupVMsWindow(Ui_Backup, QWizard): home_dir = pwd.getpwnam(local_user).pw_dir self.size = qubesutils.get_disk_usage(home_dir) else: - self.size = self.get_vm_size(vm) + self.size = self.get_vm_size(vm) super(BackupVMsWindow.VmListItem, self).__init__(vm.name+ " (" + qubesutils.size_to_human(self.size) + ")") - + def get_vm_size(self, vm): size = 0 if vm.private_img is not None: @@ -169,7 +169,7 @@ class BackupVMsWindow(Ui_Backup, QWizard): item.setForeground(QBrush(QColor(0, 0, 0))) self.show_running_vms_warning(some_selected_vms_running) - + for i in range(self.select_vms_widget.available_list.count()): item = self.select_vms_widget.available_list.item(i) if item.vm.is_running() and item.vm.qid != 0: @@ -195,7 +195,7 @@ class BackupVMsWindow(Ui_Backup, QWizard): self.app.processEvents() if reply == QMessageBox.Yes: - + wait_time = 60.0 for vm in vms: self.shutdown_vm_func(vm, wait_time*1000) @@ -212,7 +212,6 @@ class BackupVMsWindow(Ui_Backup, QWizard): progress.hide() - def get_running_vms(self): names = [] vms = [] @@ -223,12 +222,8 @@ class BackupVMsWindow(Ui_Backup, QWizard): vms.append(item.vm) return (names, vms) - - - def dev_combobox_activated(self, idx): dev_combobox_activated(self, idx) - @pyqtSlot(name='on_select_path_button_clicked') def select_path_button_clicked(self): @@ -276,7 +271,7 @@ class BackupVMsWindow(Ui_Backup, QWizard): thread_monitor.set_finished() - + def current_page_changed(self, id): if self.currentPage() is self.confirm_page: @@ -323,7 +318,7 @@ class BackupVMsWindow(Ui_Backup, QWizard): if self.dev_mount_path != None: umount_device(self.dev_mount_path) self.button(self.FinishButton).setEnabled(True) - + def reject(self): #cancell clicked while the backup is in progress. @@ -348,7 +343,7 @@ class BackupVMsWindow(Ui_Backup, QWizard): 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 89cd237..54a253a 100644 --- a/qubesmanager/backup_utils.py +++ b/qubesmanager/backup_utils.py @@ -80,7 +80,7 @@ def fill_appvms_list(dialog): dialog.appvm_combobox.addItem("None") dialog.appvm_combobox.setCurrentIndex(0) #current selected is null "" - + for vm in dialog.qvm_collection.values(): if vm.is_appvm() and vm.internal: continue @@ -93,7 +93,7 @@ def fill_appvms_list(dialog): def fill_devs_list(dialog): dialog.dev_combobox.clear() dialog.dev_combobox.addItem("None") - + dialog.blk_manager.blk_lock.acquire() for a in dialog.blk_manager.attached_devs: if dialog.blk_manager.attached_devs[a]['attached_to']['vm'] == dialog.vm.name : @@ -112,7 +112,7 @@ def fill_devs_list(dialog): def enable_dir_line_edit(dialog, boolean): dialog.dir_line_edit.setEnabled(boolean) - dialog.select_path_button.setEnabled(boolean) + dialog.select_path_button.setEnabled(boolean) def dev_combobox_activated(dialog, idx): @@ -129,7 +129,7 @@ def dev_combobox_activated(dialog, idx): dialog.dev_combobox.setCurrentIndex(dialog.prev_dev_idx) return - if dialog.dev_combobox.currentText() != "None": #An existing device chosen + if dialog.dev_combobox.currentText() != "None": #An existing device chosen dev_name = str(dialog.dev_combobox.itemData(idx).toString()) dialog.blk_manager.blk_lock.acquire() @@ -155,7 +155,7 @@ def dev_combobox_activated(dialog, idx): 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 if dialog.dev_mount_path != None: diff --git a/qubesmanager/restore.py b/qubesmanager/restore.py index e218627..f4ebe6b 100644 --- a/qubesmanager/restore.py +++ b/qubesmanager/restore.py @@ -72,7 +72,7 @@ class RestoreVMsWindow(Ui_Restore, QWizard): if vm.qid == 0: self.vm = vm break; - + assert self.vm != None self.setupUi(self) @@ -98,7 +98,7 @@ 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) @@ -148,14 +148,12 @@ class RestoreVMsWindow(Ui_Restore, QWizard): if 'dom0-home' in self.restore_options: self.skip_dom0.setChecked(self.restore_options['dom0-home']) - - def gather_output(self, s): self.func_output.append(s) def restore_error_output(self, s): self.emit(SIGNAL("restore_progress(QString)"), '{0}'.format(s)) - + def restore_output(self, s): self.emit(SIGNAL("restore_progress(QString)"),'{0}'.format(s)) @@ -181,7 +179,6 @@ class RestoreVMsWindow(Ui_Restore, QWizard): thread_monitor.set_finished() - def current_page_changed(self, id): if self.currentPage() is self.select_vms_page: @@ -206,7 +203,7 @@ class RestoreVMsWindow(Ui_Restore, QWizard): elif self.currentPage() is self.commit_page: self.button(self.CancelButton).setDisabled(True) self.button(self.FinishButton).setDisabled(True) - + self.thread_monitor = ThreadMonitor() thread = threading.Thread (target= self.__do_restore__ , args=(self.thread_monitor,)) thread.daemon = True @@ -227,8 +224,6 @@ class RestoreVMsWindow(Ui_Restore, QWizard): if self.dev_mount_path != None: umount_device(self.dev_mount_path) self.done(0) - - def has_selected_dir(self): return self.backup_dir != None