Fixed inconsisted icon in Qube Manager messages

Now success will not be accompanied by a 'warning'
icon.

fixes QubesOS/qubes-issues#4922
This commit is contained in:
Marta Marczykowska-Górecka 2019-03-29 17:01:15 +01:00
parent ee8bce269f
commit fe810c5ad0
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
2 changed files with 21 additions and 4 deletions

View File

@ -30,12 +30,14 @@ class RemoveVMThread(QtCore.QThread):
QtCore.QThread.__init__(self)
self.vm = vm
self.msg = None
self.is_error = False
def run(self):
try:
del self.vm.app.domains[self.vm.name]
except (exc.QubesException, KeyError) as ex:
self.msg = ("Error removing qube!", str(ex))
self.is_error = True
# pylint: disable=too-few-public-methods
@ -45,6 +47,7 @@ class CloneVMThread(QtCore.QThread):
self.src_vm = src_vm
self.dst_name = dst_name
self.msg = None
self.is_error = False
def run(self):
try:
@ -52,3 +55,4 @@ class CloneVMThread(QtCore.QThread):
self.msg = ("Sucess", "The qube was cloned sucessfully.")
except exc.QubesException as ex:
self.msg = ("Error while cloning qube!", str(ex))
self.is_error = True

View File

@ -254,12 +254,14 @@ class StartVMThread(QtCore.QThread):
QtCore.QThread.__init__(self)
self.vm = vm
self.msg = None
self.is_error = False
def run(self):
try:
self.vm.start()
except exc.QubesException as ex:
self.msg = ("Error starting Qube!", str(ex))
self.is_error = True
# pylint: disable=too-few-public-methods
@ -268,6 +270,7 @@ class UpdateVMThread(QtCore.QThread):
QtCore.QThread.__init__(self)
self.vm = vm
self.msg = None
self.is_error = False
def run(self):
try:
@ -298,6 +301,7 @@ class UpdateVMThread(QtCore.QThread):
user="root", wait=False)
except (ChildProcessError, exc.QubesException) as ex:
self.msg = ("Error on qube update!", str(ex))
self.is_error = True
# pylint: disable=too-few-public-methods
@ -307,12 +311,14 @@ class RunCommandThread(QtCore.QThread):
self.vm = vm
self.command_to_run = command_to_run
self.msg = None
self.is_error = False
def run(self):
try:
self.vm.run(self.command_to_run)
except (ChildProcessError, exc.QubesException) as ex:
self.msg = ("Error while running command!", str(ex))
self.is_error = True
class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
@ -515,10 +521,17 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
if thread.msg:
(title, msg) = thread.msg
QtGui.QMessageBox.warning(
None,
self.tr(title),
self.tr(msg))
if thread.is_error:
QtGui.QMessageBox.warning(
None,
self.tr(title),
self.tr(msg))
else:
QtGui.QMessageBox.information(
None,
self.tr(title),
self.tr(msg))
self.threads_list.remove(thread)
return