12 |
12 |
13 from E5Gui.E5Led import E5Led, E5LedRectangular |
13 from E5Gui.E5Led import E5Led, E5LedRectangular |
14 |
14 |
15 import Preferences |
15 import Preferences |
16 |
16 |
|
17 |
17 class StatusMonitorLed(E5Led): |
18 class StatusMonitorLed(E5Led): |
18 """ |
19 """ |
19 Class implementing a LED to indicate the status of the VCS status monitor thread. |
20 Class implementing a LED to indicate the status of the VCS status monitor thread. |
20 """ |
21 """ |
21 def __init__(self, project, parent): |
22 def __init__(self, project, parent): |
23 Constructor |
24 Constructor |
24 |
25 |
25 @param project reference to the project object (Project.Project) |
26 @param project reference to the project object (Project.Project) |
26 @param parent reference to the parent object (QWidget) |
27 @param parent reference to the parent object (QWidget) |
27 """ |
28 """ |
28 E5Led.__init__(self, parent, shape = E5LedRectangular, rectRatio = 1.0) |
29 E5Led.__init__(self, parent, shape=E5LedRectangular, rectRatio=1.0) |
29 |
30 |
30 self.project = project |
31 self.project = project |
31 self.vcsMonitorLedColors = { |
32 self.vcsMonitorLedColors = { |
32 "off" : QColor(Qt.lightGray), |
33 "off": QColor(Qt.lightGray), |
33 "ok" : QColor(Qt.green), |
34 "ok": QColor(Qt.green), |
34 "nok" : QColor(Qt.red), |
35 "nok": QColor(Qt.red), |
35 "op" : QColor(Qt.yellow), |
36 "op": QColor(Qt.yellow), |
36 "send" : QColor(Qt.blue), |
37 "send": QColor(Qt.blue), |
37 "wait" : QColor(Qt.cyan), |
38 "wait": QColor(Qt.cyan), |
38 "timeout" : QColor(Qt.darkRed) |
39 "timeout": QColor(Qt.darkRed) |
39 } |
40 } |
40 self.__on = False |
41 self.__on = False |
41 |
42 |
42 self.setWhatsThis(self.trUtf8( |
43 self.setWhatsThis(self.trUtf8( |
43 """<p>This LED indicates the operating""" |
44 """<p>This LED indicates the operating""" |
56 self.__checkAct = \ |
57 self.__checkAct = \ |
57 self.__menu.addAction(self.trUtf8("Check status"), self.__checkStatus) |
58 self.__menu.addAction(self.trUtf8("Check status"), self.__checkStatus) |
58 self.__intervalAct = \ |
59 self.__intervalAct = \ |
59 self.__menu.addAction(self.trUtf8("Set interval..."), self.__setInterval) |
60 self.__menu.addAction(self.trUtf8("Set interval..."), self.__setInterval) |
60 self.__menu.addSeparator() |
61 self.__menu.addSeparator() |
61 self.__onAct = \ |
62 self.__onAct = \ |
62 self.__menu.addAction(self.trUtf8("Switch on"), self.__switchOn) |
63 self.__menu.addAction(self.trUtf8("Switch on"), self.__switchOn) |
63 self.__offAct = \ |
64 self.__offAct = \ |
64 self.__menu.addAction(self.trUtf8("Switch off"), self.__switchOff) |
65 self.__menu.addAction(self.trUtf8("Switch off"), self.__switchOff) |
65 self.__checkActions() |
66 self.__checkActions() |
66 |
67 |
118 """ |
119 """ |
119 interval, ok = QInputDialog.getInteger( |
120 interval, ok = QInputDialog.getInteger( |
120 None, |
121 None, |
121 self.trUtf8("VCS Status Monitor"), |
122 self.trUtf8("VCS Status Monitor"), |
122 self.trUtf8("Enter monitor interval [s]"), |
123 self.trUtf8("Enter monitor interval [s]"), |
123 self.project.getStatusMonitorInterval(), |
124 self.project.getStatusMonitorInterval(), |
124 0, 3600, 1) |
125 0, 3600, 1) |
125 if ok: |
126 if ok: |
126 self.project.setStatusMonitorInterval(interval) |
127 self.project.setStatusMonitorInterval(interval) |
127 |
128 |
128 def __switchOn(self): |
129 def __switchOn(self): |