##// END OF EJS Templates
minor changes
Miguel Valdez -
r736:c5f1a66dbd6e
parent child
Show More
@@ -1,184 +1,179
1 1 import threading
2 2 import Queue
3 3
4 4 from schainpy.controller import Project
5 5 from schainpy.model.graphics.jroplotter import PlotManager
6 6
7 7 class ControllerThread(threading.Thread, Project):
8 8
9 9 def __init__(self, plotter_queue=None):
10 10
11 11 threading.Thread.__init__(self)
12 12 Project.__init__(self, plotter_queue)
13 13
14 14 self.setDaemon(True)
15 15
16 16 self.lock = threading.Lock()
17 17 self.control = {'stop':False, 'pause':False}
18 18
19 19 def __del__(self):
20 20
21 21 self.control['stop'] = True
22 22
23 23 def stop(self):
24 24
25 25 self.lock.acquire()
26 26
27 27 self.control['stop'] = True
28 28
29 29 self.lock.release()
30 30
31 31 def pause(self):
32 32
33 33 self.lock.acquire()
34 34
35 35 self.control['pause'] = not(self.control['pause'])
36 36 paused = self.control['pause']
37 37
38 38 self.lock.release()
39 39
40 40 return paused
41 41
42 42 def isPaused(self):
43 43
44 44 self.lock.acquire()
45 45 paused = self.control['pause']
46 46 self.lock.release()
47 47
48 48 return paused
49 49
50 50 def isStopped(self):
51 51
52 52 self.lock.acquire()
53 53 stopped = self.control['stop']
54 54 self.lock.release()
55 55
56 56 return stopped
57 57
58 58 def run(self):
59 59 self.control['stop'] = False
60 60 self.control['pause'] = False
61 61
62 62 self.writeXml()
63 63
64 64 self.createObjects()
65 65 self.connectObjects()
66 66 Project.run(self)
67 67
68 68 def isRunning(self):
69 69
70 70 return self.is_alive()
71 71
72 72 def isFinished(self):
73 73
74 74 return not self.is_alive()
75 75
76 76 def setPlotters(self):
77 77
78 plotterList = ['Scope',
79 'SpectraPlot', 'RTIPlot',
80 'CrossSpectraPlot', 'CoherenceMap',
81 'PowerProfilePlot', 'Noise', 'BeaconPhase',
82 'CorrelationPlot',
83 'SpectraHeisScope','RTIfromSpectraHeis']
78 plotterList = PlotManager.plotterList
84 79
85 80 for thisPUConfObj in self.procUnitConfObjDict.values():
86 81
87 82 inputId = thisPUConfObj.getInputId()
88 83
89 84 if int(inputId) == 0:
90 85 continue
91 86
92 87 for thisOpObj in thisPUConfObj.getOperationObjList():
93 88
94 89 if thisOpObj.type == "self":
95 90 continue
96 91
97 92 if thisOpObj.name in plotterList:
98 93 thisOpObj.type = "plotter"
99 94
100 95 def setPlotterQueue(self, plotter_queue):
101 96
102 97 self.plotterQueue = plotter_queue
103 98
104 99 def getPlotterQueue(self):
105 100
106 101 return self.plotterQueue
107 102
108 103 def useExternalPlotter(self):
109 104
110 105 self.plotterQueue = Queue.Queue(10)
111 106 self.setPlotters()
112 107
113 108 plotManagerObj = PlotManager(self.plotterQueue)
114 109 plotManagerObj.setController(self)
115 110
116 111 return plotManagerObj
117 112
118 113 # from PyQt4 import QtCore
119 114 # from PyQt4.QtCore import SIGNAL
120 115 #
121 116 # class ControllerQThread(QtCore.QThread, Project):
122 117 #
123 118 # def __init__(self, filename):
124 119 #
125 120 # QtCore.QThread.__init__(self)
126 121 # Project.__init__(self)
127 122 #
128 123 # self.filename = filename
129 124 #
130 125 # self.lock = threading.Lock()
131 126 # self.control = {'stop':False, 'pause':False}
132 127 #
133 128 # def __del__(self):
134 129 #
135 130 # self.control['stop'] = True
136 131 # self.wait()
137 132 #
138 133 # def stop(self):
139 134 #
140 135 # self.lock.acquire()
141 136 #
142 137 # self.control['stop'] = True
143 138 #
144 139 # self.lock.release()
145 140 #
146 141 # def pause(self):
147 142 #
148 143 # self.lock.acquire()
149 144 #
150 145 # self.control['pause'] = not(self.control['pause'])
151 146 # paused = self.control['pause']
152 147 #
153 148 # self.lock.release()
154 149 #
155 150 # return paused
156 151 #
157 152 # def isPaused(self):
158 153 #
159 154 # self.lock.acquire()
160 155 # paused = self.control['pause']
161 156 # self.lock.release()
162 157 #
163 158 # return paused
164 159 #
165 160 # def isStopped(self):
166 161 #
167 162 # self.lock.acquire()
168 163 # stopped = self.control['stop']
169 164 # self.lock.release()
170 165 #
171 166 # return stopped
172 167 #
173 168 # def run(self):
174 169 #
175 170 # self.control['stop'] = False
176 171 # self.control['pause'] = False
177 172 #
178 173 # self.readXml(self.filename)
179 174 # self.createObjects()
180 175 # self.connectObjects()
181 176 # self.emit( SIGNAL( "jobStarted( PyQt_PyObject )" ), 1)
182 177 # Project.run(self)
183 178 # self.emit( SIGNAL( "jobFinished( PyQt_PyObject )" ), 1)
184 179 # No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now