From 3f7fd7ceb7038a15201454d4185c608bd1ca891c Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Thu, 5 Jul 2012 01:08:10 +0200 Subject: [PATCH] New status icon: some error occured (#615) --- icons/warning.png | Bin 0 -> 1354 bytes qubesmanager/main.py | 33 ++++++++++++++++++++++++++++++++- resources.qrc | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 icons/warning.png diff --git a/icons/warning.png b/icons/warning.png new file mode 100644 index 0000000000000000000000000000000000000000..8e9133789b0c5f9a2fd7cfd29fce85a35e8fa120 GIT binary patch literal 1354 zcmV-Q1-1H#P)E2L1Q&_V>FBm^-K zqXA4L(MT}7Nc71>ebr!yF~$TFjp&0f`pyGBX@Z#WqA!LtVgSFQAzIM3(C+TcZ0GZO zr#p3;-Bd|wC7$G$b29gyIsbEJ=VM7qiF;{G@jn)DmiRn(VavY+pHdOM#pCd2YY1=- z`{e9@C*VBgBAtI7wVxORB-rf7msy*?8#|=4`j_A$iAZBF26pGD=y)2U?J$BFeKfMf zO91iJ7Z4yPUG}nQe~Msq0GS?$j$;(rcm)@bUo`<~_u|#i>*`{?2LZ1-59@mjp;PFD z5GUh3t0$m_+Wvzj{;E*fm=gVS2z~@xf&2v!E);%(Utdo_FkN`asqs;^&NVGm-YjZ zHD8RgsuEx!bZX$d3dooWc>69TiVnd=-^vI$OL}0j_emel@=PBPHHvYe1gPRtO+n}t z05yd=Zsq|okO^$|VVrw+0*DA5*bvs~QQo;5AWM-HQblFmR#-|v6`%ynK$M0M*mNMy z1raS@z-Q3?fSo~htIo|#Tv$q23IQIiwfwoKmL}=5t zdlug#%3A=cGz72)+^B*)3*=j>V5M=KC+jo|t=tR0hCR5YZ3C8`g1}Pt2@J0syvy^$ z8W&RlbU-rz5{e8U0+{6-h--kZ1Gxx*Y#;$n1e%%<-t5E~{d4Ta<8bd>z$s$bCm!~0 zuwCYT)4<#h044LHm^jG8`z;UY+JI95++-~_*>GBSH|kg9PS(Tsic|C@UYF6G2^fJ< zzZJgC+IqMs{Qh_0)JMu!k?Cr53$8GcSSmmm(_p1;=FLu?79)5FK>ZGW1H{5ke%QO6 z9n*VVKt}^3!A!gc^gmle|M6O~-h{5uLYPAuyh$1j+xVe)vj6@;a+9*w7Z|5C8-{b6 zeg;_5Axoe%c7D{sG7{!Gf1&Hxr$n)5u*U}=r>_5$--_+cA1$o;8_yqS$NWmiMsr;i z&=xvLSk&pvg&c04E@I-160C7^q3d+NNZ=7N_Y>SnZKHpK9R-LjEnpBi=em4N-`GdI zFbN2xXsM5j`M(Nq!aUwDT3VPdniw@;+3PU3u7^7JNnAy?NkH1YJHcKEoSs2*Xfj@D zVeyIE57uFHsqO|s6b{sZ2(8G4SR%72fIDpt)~~VW<65o1fs0g}`G&3;+aBo2Zoag* zUfFaVm+a#!;ASmrLHfnyzq&|rg(*3RZ1bA7P8?peaN3ECO zD&^Ek#qSEtfcW`0mcBAnf{sc=AeHhz8zbi17A@AzSsdxu0^wj3XXKM zTq0&F4i~B>F$-lpVE{Lf$7PI3yJ-SV?|~5zR>Q7BHop(<`QP)u0Nfb>!wJQD)Bpeg M07*qoM6N<$g1EwNvj6}9 literal 0 HcmV?d00001 diff --git a/qubesmanager/main.py b/qubesmanager/main.py index 4ac4c29..5df12fe 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -240,10 +240,12 @@ class VmInfoWidget (QWidget): self.on_icon = VmStatusIcon(vm) self.upd_info = VmUpdateInfoWidget(vm, show_text=False) + self.error_icon = VmIconWidget(":/warning.png") self.blk_icon = VmIconWidget(":/mount.png") layout.addWidget(self.on_icon) layout.addWidget(self.upd_info) + layout.addWidget(self.error_icon) layout.addItem(QSpacerItem(0, 10, QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)) layout.addWidget(self.blk_icon) @@ -251,6 +253,7 @@ class VmInfoWidget (QWidget): self.setLayout(layout) self.blk_icon.setVisible(False) + self.error_icon.setVisible(False) self.tableItem = self.VmInfoItem(self.upd_info.tableItem, vm) @@ -259,6 +262,8 @@ class VmInfoWidget (QWidget): self.upd_info.update_outdated(vm) if blk_visible != None: self.blk_icon.setVisible(blk_visible) + self.error_icon.setToolTip(vm.error_msg) + self.error_icon.setVisible(vm.error_msg is not None) class VmTemplateItem (QTableWidgetItem): @@ -700,6 +705,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): self.running_vms_count = 0 + self.vm_errors = {} + self.frame_width = 0 self.frame_height = 0 @@ -862,6 +869,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): vm.last_running = vm.last_power_state in ["Running", "Transient"] if vm.last_running: running_count += 1 + vm.error_msg = self.vm_errors[vm.qid] if vm.qid in self.vm_errors else None self.running_vms_count = running_count @@ -932,6 +940,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): if not prev_running and vm.last_running: self.running_vms_count += 1 some_vms_have_changed_power_state = True + # Clear error state when VM just started + self.clear_error(vm.qid) elif prev_running and not vm.last_running: self.running_vms_count -= 1 some_vms_have_changed_power_state = True @@ -1089,7 +1099,27 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): self.hide() event.ignore() - + + def set_error(self, qid, message): + for vm in self.vms_list: + if vm.qid == qid: + vm.error_msg = message + # Store error in separate dict to make it immune to VM list reload + self.vm_errors[qid] = message + + def clear_error(self, qid): + self.vm_errors.pop(qid, None) + for vm in self.vms_list: + if vm.qid == qid: + vm.error_msg = None + + def clear_error_exact(self, qid, message): + for vm in self.vms_list: + if vm.qid == qid: + if vm.error_msg == message: + vm.error_msg = None + self.vm_errors.pop(qid, None) + @pyqtSlot(name='on_action_createvm_triggered') def action_createvm_triggered(self): dialog = NewVmDlg(app, self.qvm_collection, trayIcon) @@ -1205,6 +1235,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): trayIcon.showMessage ("VM '{0}' has been started.".format(vm.name), msecs=3000) else: trayIcon.showMessage ("Error starting VM '{0}': {1}".format(vm.name, thread_monitor.error_msg ), msecs=3000) + self.set_error(vm.qid, "Error starting VM: %s" % thread_monitor.error_msg) def do_start_vm(self, vm, thread_monitor): try: diff --git a/resources.qrc b/resources.qrc index e418cf4..08ec6fd 100644 --- a/resources.qrc +++ b/resources.qrc @@ -11,6 +11,7 @@ icons/update-recommended.png icons/show-all-running.png icons/mount.png + icons/warning.png icons/log.png icons/run-command.png icons/kbd-layout.png