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.
This commit is contained in:
Marta Marczykowska-Górecka 2017-12-11 01:32:26 +01:00
parent 78b4747e81
commit a4a58cc527
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
4 changed files with 9 additions and 34 deletions

View File

@ -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():

View File

@ -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'<font color="black">{0}</font>'.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)

View File

@ -214,23 +214,12 @@
</rect>
</property>
<property name="text">
<string> </string>
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<zorder>checkBox</zorder>
<zorder>groupBox_2</zorder>
<zorder>groupBox_2</zorder>
<zorder>label_8</zorder>
<zorder>save_profile_checkbox</zorder>
<zorder>groupBox_2</zorder>
<zorder>label_8</zorder>
<zorder>label_8</zorder>
<zorder>save_profile_checkbox</zorder>
<zorder>label_8</zorder>
<zorder>save_profile_checkbox</zorder>
</widget>
</item>
<item row="2" column="0">
@ -360,6 +349,9 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QProgressBar" name="progress_bar">
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>

View File

@ -244,6 +244,9 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QProgressBar" name="progress_bar">
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>