VCS/StatusMonitorThread.py

changeset 248
f4561c24989a
parent 216
6f9713e8d570
child 500
c3abc7895a01
child 792
a13346916170
equal deleted inserted replaced
247:b3da30a52337 248:f4561c24989a
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the VCS status monitor thread base class. 7 Module implementing the VCS status monitor thread base class.
8 """ 8 """
9
10 import os
11 9
12 from PyQt4.QtCore import QThread, QMutex, QWaitCondition, SIGNAL 10 from PyQt4.QtCore import QThread, QMutex, QWaitCondition, SIGNAL
13 11
14 class VcsStatusMonitorThread(QThread): 12 class VcsStatusMonitorThread(QThread):
15 """ 13 """
17 15
18 @signal vcsStatusMonitorData(QStringList) emitted to update the VCS status 16 @signal vcsStatusMonitorData(QStringList) emitted to update the VCS status
19 @signal vcsStatusMonitorStatus(QString, QString) emitted to signal the status of the 17 @signal vcsStatusMonitorStatus(QString, QString) emitted to signal the status of the
20 monitoring thread (ok, nok, op) and a status message 18 monitoring thread (ok, nok, op) and a status message
21 """ 19 """
22 def __init__(self, interval, projectDir, vcs, parent = None): 20 def __init__(self, interval, project, vcs, parent = None):
23 """ 21 """
24 Constructor 22 Constructor
25 23
26 @param interval new interval in seconds (integer) 24 @param interval new interval in seconds (integer)
27 @param projectDir project directory to monitor (string) 25 @param project reference to the project object (Project)
28 @param vcs reference to the version control object 26 @param vcs reference to the version control object
29 @param parent reference to the parent object (QObject) 27 @param parent reference to the parent object (QObject)
30 """ 28 """
31 QThread.__init__(self, parent) 29 QThread.__init__(self, parent)
32 self.setObjectName("VcsStatusMonitorThread") 30 self.setObjectName("VcsStatusMonitorThread")
33 31
34 self.setTerminationEnabled(True) 32 self.setTerminationEnabled(True)
35 33
36 self.projectDir = projectDir 34 self.projectDir = project.getProjectPath()
35 self.project = project
37 self.vcs = vcs 36 self.vcs = vcs
38 37
39 self.interval = interval 38 self.interval = interval
40 self.autoUpdate = False 39 self.autoUpdate = False
41 40
156 """ 155 """
157 Public method to clear the cached VCS state of a file/directory. 156 Public method to clear the cached VCS state of a file/directory.
158 157
159 @param name name of the entry to be cleared (string) 158 @param name name of the entry to be cleared (string)
160 """ 159 """
161 key = name.replace(self.projectDir + os.sep, '') 160 key = self.project.getRelativePath(name)
162 try: 161 try:
163 del self.reportedStates[key] 162 del self.reportedStates[key]
164 except KeyError: 163 except KeyError:
165 pass 164 pass
166 165

eric ide

mercurial