Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions qubesmanager/common_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@


class ChangeTemplatesThread(QtCore.QThread):
def __init__(self, progress_dialog, items_to_change, qubes_app):
def __init__(self, main_dialog, items_to_change, qubes_app):
super().__init__()
self.dialog = progress_dialog
self.main_dialog = main_dialog

Check warning on line 80 in qubesmanager/common_threads.py

View check run for this annotation

Codecov / codecov/patch

qubesmanager/common_threads.py#L80

Added line #L80 was not covered by tests
self.items = items_to_change
self.qubes_app = qubes_app
self.errors = {}
Expand All @@ -91,4 +91,4 @@
'template', row.new_item.currentText())
except Exception as ex: # pylint: disable=broad-except
self.errors[vm] = str(ex)
self.dialog.setValue(i)
self.main_dialog.progress_signal.emit(i)

Check warning on line 94 in qubesmanager/common_threads.py

View check run for this annotation

Codecov / codecov/patch

qubesmanager/common_threads.py#L94

Added line #L94 was not covered by tests
9 changes: 7 additions & 2 deletions qubesmanager/template_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
class TemplateManagerWindow(
ui_templatemanager.Ui_MainWindow, QtWidgets.QMainWindow):

progress_signal = QtCore.pyqtSignal(int)

def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
# pylint: disable=unused-argument
super().__init__(parent)
Expand Down Expand Up @@ -247,13 +249,16 @@ def apply(self):
self.dialog.setCancelButton(None)
self.dialog.setModal(True)
self.dialog.show()

self.thread = common_threads.ChangeTemplatesThread(self.dialog,
self.progress_signal.connect(self.on_progress_changed)
self.thread = common_threads.ChangeTemplatesThread(self,
items_to_change,
self.qubes_app)
self.thread.finished.connect(self.finish_changes)
self.thread.start()

def on_progress_changed(self, value):
self.dialog.setValue(value)

def finish_changes(self):
self.dialog.hide()

Expand Down