18 Class implementing the VCS status monitor thread base class. |
18 Class implementing the VCS status monitor thread base class. |
19 |
19 |
20 @signal vcsStatusMonitorData(list of str) emitted to update the VCS status |
20 @signal vcsStatusMonitorData(list of str) emitted to update the VCS status |
21 @signal vcsStatusMonitorStatus(str, str) emitted to signal the status of |
21 @signal vcsStatusMonitorStatus(str, str) emitted to signal the status of |
22 the monitoring thread (ok, nok, op) and a status message |
22 the monitoring thread (ok, nok, op) and a status message |
|
23 @signal vcsStatusMonitorInfo(str) emitted to signal some info of the |
|
24 monitoring thread |
23 """ |
25 """ |
24 vcsStatusMonitorData = pyqtSignal(list) |
26 vcsStatusMonitorData = pyqtSignal(list) |
25 vcsStatusMonitorStatus = pyqtSignal(str, str) |
27 vcsStatusMonitorStatus = pyqtSignal(str, str) |
|
28 vcsStatusMonitorInfo = pyqtSignal(str) |
26 |
29 |
27 def __init__(self, interval, project, vcs, parent=None): |
30 def __init__(self, interval, project, vcs, parent=None): |
28 """ |
31 """ |
29 Constructor |
32 Constructor |
30 |
33 |
72 self.vcsStatusMonitorStatus.emit( |
75 self.vcsStatusMonitorStatus.emit( |
73 "op", QCoreApplication.translate( |
76 "op", QCoreApplication.translate( |
74 "VcsStatusMonitorThread", |
77 "VcsStatusMonitorThread", |
75 "Checking repository status")) |
78 "Checking repository status")) |
76 res, statusMsg = self._performMonitor() |
79 res, statusMsg = self._performMonitor() |
|
80 infoMsg = self._getInfo() |
77 finally: |
81 finally: |
78 self.vcs.vcsExecutionMutex.unlock() |
82 self.vcs.vcsExecutionMutex.unlock() |
79 if res: |
83 if res: |
80 status = "ok" |
84 status = "ok" |
81 else: |
85 else: |
83 self.vcsStatusMonitorStatus.emit( |
87 self.vcsStatusMonitorStatus.emit( |
84 "send", QCoreApplication.translate( |
88 "send", QCoreApplication.translate( |
85 "VcsStatusMonitorThread", "Sending data")) |
89 "VcsStatusMonitorThread", "Sending data")) |
86 self.vcsStatusMonitorData.emit(self.statusList) |
90 self.vcsStatusMonitorData.emit(self.statusList) |
87 self.vcsStatusMonitorStatus.emit(status, statusMsg) |
91 self.vcsStatusMonitorStatus.emit(status, statusMsg) |
|
92 self.vcsStatusMonitorInfo.emit(infoMsg) |
88 else: |
93 else: |
89 self.vcsStatusMonitorStatus.emit( |
94 self.vcsStatusMonitorStatus.emit( |
90 "timeout", QCoreApplication.translate( |
95 "timeout", QCoreApplication.translate( |
91 "VcsStatusMonitorThread", |
96 "VcsStatusMonitorThread", |
92 "Timed out waiting for lock")) |
97 "Timed out waiting for lock")) |
|
98 self.vcsStatusMonitorInfo.emit("") |
93 |
99 |
94 if self.autoUpdate and self.shouldUpdate: |
100 if self.autoUpdate and self.shouldUpdate: |
95 self.vcs.vcsUpdate(self.projectDir, True) |
101 self.vcs.vcsUpdate(self.projectDir, True) |
96 continue # check again |
102 continue # check again |
97 self.shouldUpdate = False |
103 self.shouldUpdate = False |
196 @exception RuntimeError to indicate that this method must be |
202 @exception RuntimeError to indicate that this method must be |
197 implemented by a subclass |
203 implemented by a subclass |
198 """ |
204 """ |
199 raise RuntimeError('Not implemented') |
205 raise RuntimeError('Not implemented') |
200 |
206 |
|
207 def _getInfo(self): |
|
208 """ |
|
209 Protected method implementing the real info action. |
|
210 |
|
211 This method should be overridden and create a short info message to be |
|
212 shown in the main window status bar right next to the status indicator. |
|
213 |
|
214 @return short info message |
|
215 @rtype str |
|
216 """ |
|
217 return "" |
|
218 |
201 def _shutdown(self): |
219 def _shutdown(self): |
202 """ |
220 """ |
203 Protected method performing shutdown actions. |
221 Protected method performing shutdown actions. |
204 |
222 |
205 The default implementation does nothing. |
223 The default implementation does nothing. |