From a4a58cc527584fa792311a61833df2762decac77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Mon, 11 Dec 2017 01:32:26 +0100 Subject: [PATCH] Fixed progress bars Partial fix - the progress bars now move, although they do not really indicate progress (just dance back and forth). Future fix would include making a tray icon to signal backup progress instead. --- qubesmanager/backup.py | 12 +----------- qubesmanager/restore.py | 12 +----------- ui/backupdlg.ui | 16 ++++------------ ui/restoredlg.ui | 3 +++ 4 files changed, 9 insertions(+), 34 deletions(-) diff --git a/qubesmanager/backup.py b/qubesmanager/backup.py index ccdd531..5660ecc 100644 --- a/qubesmanager/backup.py +++ b/qubesmanager/backup.py @@ -47,8 +47,6 @@ import time class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard): - __pyqtSignals__ = ("backup_progress(int)",) - def __init__(self, app, qvm_collection, parent=None): super(BackupVMsWindow, self).__init__(parent) @@ -77,8 +75,6 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard): self.connect(self.select_vms_widget, QtCore.SIGNAL("items_added(PyQt_PyObject)"), self.vms_added) - self.connect(self, QtCore.SIGNAL("backup_progress(int)"), - self.progress_bar.setValue) self.dir_line_edit.connect(self.dir_line_edit, QtCore.SIGNAL("textChanged(QString)"), self.backup_location_changed) @@ -247,17 +243,10 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard): return True - def update_progress_bar(self, value): - self.emit(QtCore.SIGNAL("backup_progress(int)"), value) - def __do_backup__(self, t_monitor): msg = [] try: - # TODO: this does nothing, events are not handled - events_dispatcher = events.EventsDispatcher(self.app) - events_dispatcher.add_handler('backup-progress', - self.update_progress_bar) vm = self.qvm_collection.domains[ self.appvm_combobox.currentText()] if not vm.is_running(): @@ -328,6 +317,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard): self.tr("ERROR: {}").format( self.thread_monitor.error_msg)) else: + self.progress_bar.setMaximum(100) self.progress_bar.setValue(100) self.progress_status.setText(self.tr("Backup finished.")) if self.showFileDialog.isChecked(): diff --git a/qubesmanager/restore.py b/qubesmanager/restore.py index 8425946..11166a2 100644 --- a/qubesmanager/restore.py +++ b/qubesmanager/restore.py @@ -47,8 +47,6 @@ from qubesadmin.backup import restore class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard): - __pyqtSignals__ = ("restore_progress(int)", "backup_progress(int)") - def __init__(self, app, qvm_collection, parent=None): super(RestoreVMsWindow, self).__init__(parent) @@ -76,14 +74,9 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard): self.connect(self, QtCore.SIGNAL("restore_progress(QString)"), self.commit_text_edit.append) - self.connect(self, - QtCore.SIGNAL("backup_progress(int)"), - self.progress_bar.setValue) self.dir_line_edit.connect(self.dir_line_edit, QtCore.SIGNAL("textChanged(QString)"), self.backup_location_changed) - self.connect(self.verify_only, QtCore.SIGNAL("stateChanged(int)"), - self.on_verify_only_toogled) self.select_dir_page.isComplete = self.has_selected_dir self.select_vms_page.isComplete = self.has_selected_vms @@ -157,13 +150,9 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard): QtCore.SIGNAL("restore_progress(QString)"), u'{0}'.format(text))) - def update_progress_bar(self, value): - self.feedback_queue.put((QtCore.SIGNAL("backup_progress(int)"), value)) - def __do_restore__(self, t_monitor): err_msg = [] try: - self.backup_restore.progress_callback = self.update_progress_bar self.backup_restore.restore_do(self.vms_to_restore) except backup.BackupCanceledError as ex: @@ -276,6 +265,7 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard): file_dialog.getExistingDirectory( self, self.tr("Detach backup device"), os.path.dirname(self.dir_line_edit.text())) + self.progress_bar.setMaximum(100) self.progress_bar.setValue(100) self.button(self.FinishButton).setEnabled(True) self.button(self.CancelButton).setEnabled(False) diff --git a/ui/backupdlg.ui b/ui/backupdlg.ui index 1126671..48ec476 100644 --- a/ui/backupdlg.ui +++ b/ui/backupdlg.ui @@ -214,23 +214,12 @@ - + true - checkBox - groupBox_2 - groupBox_2 - label_8 - save_profile_checkbox - groupBox_2 - label_8 - label_8 - save_profile_checkbox - label_8 - save_profile_checkbox @@ -360,6 +349,9 @@ p, li { white-space: pre-wrap; } + + 0 + 0 diff --git a/ui/restoredlg.ui b/ui/restoredlg.ui index ba31f6b..284b867 100644 --- a/ui/restoredlg.ui +++ b/ui/restoredlg.ui @@ -244,6 +244,9 @@ p, li { white-space: pre-wrap; } + + 0 + 0