41 self.__on = False |
43 self.__on = False |
42 |
44 |
43 self.setWhatsThis(self.trUtf8( |
45 self.setWhatsThis(self.trUtf8( |
44 """<p>This LED indicates the operating""" |
46 """<p>This LED indicates the operating""" |
45 """ status of the VCS monitor thread (off = monitoring off,""" |
47 """ status of the VCS monitor thread (off = monitoring off,""" |
46 """ green = monitoring on and ok, red = monitoring on, but not ok,""" |
48 """ green = monitoring on and ok, red = monitoring on, but""" |
47 """ yellow = checking VCS status). A status description is given""" |
49 """ not ok, yellow = checking VCS status). A status description""" |
48 """ in the tooltip.</p>""" |
50 """ is given in the tooltip.</p>""" |
49 )) |
51 )) |
50 self.setToolTip( |
52 self.setToolTip( |
51 self.trUtf8("Repository status checking is switched off") |
53 self.trUtf8("Repository status checking is switched off") |
52 ) |
54 ) |
53 self.setColor(self.vcsMonitorLedColors["off"]) |
55 self.setColor(self.vcsMonitorLedColors["off"]) |
54 |
56 |
55 # define a context menu |
57 # define a context menu |
56 self.__menu = QMenu(self) |
58 self.__menu = QMenu(self) |
57 self.__checkAct = \ |
59 self.__checkAct = self.__menu.addAction( |
58 self.__menu.addAction(self.trUtf8("Check status"), self.__checkStatus) |
60 self.trUtf8("Check status"), self.__checkStatus) |
59 self.__intervalAct = \ |
61 self.__intervalAct = self.__menu.addAction( |
60 self.__menu.addAction(self.trUtf8("Set interval..."), self.__setInterval) |
62 self.trUtf8("Set interval..."), self.__setInterval) |
61 self.__menu.addSeparator() |
63 self.__menu.addSeparator() |
62 self.__onAct = \ |
64 self.__onAct = self.__menu.addAction( |
63 self.__menu.addAction(self.trUtf8("Switch on"), self.__switchOn) |
65 self.trUtf8("Switch on"), self.__switchOn) |
64 self.__offAct = \ |
66 self.__offAct = self.__menu.addAction( |
65 self.__menu.addAction(self.trUtf8("Switch off"), self.__switchOff) |
67 self.trUtf8("Switch off"), self.__switchOff) |
66 self.__checkActions() |
68 self.__checkActions() |
67 |
69 |
68 # connect signals to our slots |
70 # connect signals to our slots |
69 self.setContextMenuPolicy(Qt.CustomContextMenu) |
71 self.setContextMenuPolicy(Qt.CustomContextMenu) |
70 self.customContextMenuRequested.connect(self._showContextMenu) |
72 self.customContextMenuRequested.connect(self._showContextMenu) |
71 self.project.vcsStatusMonitorStatus.connect(self.__projectVcsMonitorStatus) |
73 self.project.vcsStatusMonitorStatus.connect( |
|
74 self.__projectVcsMonitorStatus) |
72 |
75 |
73 def __checkActions(self): |
76 def __checkActions(self): |
74 """ |
77 """ |
75 Private method to set the enabled status of the context menu actions. |
78 Private method to set the enabled status of the context menu actions. |
76 """ |
79 """ |
77 if self.project.pudata["VCSSTATUSMONITORINTERVAL"]: |
80 if self.project.pudata["VCSSTATUSMONITORINTERVAL"]: |
78 vcsStatusMonitorInterval = self.project.pudata["VCSSTATUSMONITORINTERVAL"][0] |
81 vcsStatusMonitorInterval = \ |
|
82 self.project.pudata["VCSSTATUSMONITORINTERVAL"][0] |
79 else: |
83 else: |
80 vcsStatusMonitorInterval = Preferences.getVCS("StatusMonitorInterval") |
84 vcsStatusMonitorInterval = \ |
|
85 Preferences.getVCS("StatusMonitorInterval") |
81 self.__checkAct.setEnabled(self.__on) |
86 self.__checkAct.setEnabled(self.__on) |
82 self.__intervalAct.setEnabled(self.__on) |
87 self.__intervalAct.setEnabled(self.__on) |
83 self.__onAct.setEnabled((not self.__on) and vcsStatusMonitorInterval > 0) |
88 self.__onAct.setEnabled( |
|
89 (not self.__on) and vcsStatusMonitorInterval > 0) |
84 self.__offAct.setEnabled(self.__on) |
90 self.__offAct.setEnabled(self.__on) |
85 |
91 |
86 def __projectVcsMonitorStatus(self, status, statusMsg): |
92 def __projectVcsMonitorStatus(self, status, statusMsg): |
87 """ |
93 """ |
88 Private method to receive the status monitor status. |
94 Private method to receive the status monitor status. |