The requested changes are too big and content was truncated. Show full diff
@@ -1,139 +1,141 | |||
|
1 | 1 | import threading |
|
2 | 2 | |
|
3 | 3 | from schainpy.controller import Project |
|
4 | 4 | |
|
5 | 5 | class ControllerThread(threading.Thread, Project): |
|
6 | 6 | |
|
7 | 7 | def __init__(self, filename=None, plotter_queue=None): |
|
8 | 8 | |
|
9 | 9 | threading.Thread.__init__(self) |
|
10 | 10 | Project.__init__(self, filename, plotter_queue) |
|
11 | 11 | |
|
12 | 12 | self.setDaemon(True) |
|
13 | 13 | |
|
14 | 14 | self.lock = threading.Lock() |
|
15 | 15 | self.control = {'stop':False, 'pause':False} |
|
16 | 16 | |
|
17 | 17 | def __del__(self): |
|
18 | 18 | |
|
19 | 19 | self.control['stop'] = True |
|
20 | 20 | |
|
21 | 21 | def stop(self): |
|
22 | 22 | |
|
23 | 23 | self.lock.acquire() |
|
24 | 24 | |
|
25 | 25 | self.control['stop'] = True |
|
26 | 26 | |
|
27 | 27 | self.lock.release() |
|
28 | 28 | |
|
29 | 29 | def pause(self): |
|
30 | 30 | |
|
31 | 31 | self.lock.acquire() |
|
32 | 32 | |
|
33 | 33 | self.control['pause'] = not(self.control['pause']) |
|
34 | 34 | paused = self.control['pause'] |
|
35 | 35 | |
|
36 | 36 | self.lock.release() |
|
37 | 37 | |
|
38 | 38 | return paused |
|
39 | 39 | |
|
40 | 40 | def isPaused(self): |
|
41 | 41 | |
|
42 | 42 | self.lock.acquire() |
|
43 | 43 | paused = self.control['pause'] |
|
44 | 44 | self.lock.release() |
|
45 | 45 | |
|
46 | 46 | return paused |
|
47 | 47 | |
|
48 | 48 | def isStopped(self): |
|
49 | 49 | |
|
50 | 50 | self.lock.acquire() |
|
51 | 51 | stopped = self.control['stop'] |
|
52 | 52 | self.lock.release() |
|
53 | 53 | |
|
54 | 54 | return stopped |
|
55 | 55 | |
|
56 | 56 | def run(self): |
|
57 | 57 | self.control['stop'] = False |
|
58 | 58 | self.control['pause'] = False |
|
59 | 59 | |
|
60 |
self.re |
|
|
60 | if not self.writeXml(self.filename): | |
|
61 | return | |
|
62 | ||
|
61 | 63 | self.createObjects() |
|
62 | 64 | self.connectObjects() |
|
63 | 65 | Project.run(self) |
|
64 | 66 | |
|
65 | 67 | def isRunning(self): |
|
66 | 68 | |
|
67 | 69 | return self.is_alive() |
|
68 | 70 | |
|
69 | 71 | def isFinished(self): |
|
70 | 72 | |
|
71 | 73 | return not self.is_alive() |
|
72 | 74 | |
|
73 | 75 | # from PyQt4 import QtCore |
|
74 | 76 | # from PyQt4.QtCore import SIGNAL |
|
75 | 77 | # |
|
76 | 78 | # class ControllerQThread(QtCore.QThread, Project): |
|
77 | 79 | # |
|
78 | 80 | # def __init__(self, filename): |
|
79 | 81 | # |
|
80 | 82 | # QtCore.QThread.__init__(self) |
|
81 | 83 | # Project.__init__(self) |
|
82 | 84 | # |
|
83 | 85 | # self.filename = filename |
|
84 | 86 | # |
|
85 | 87 | # self.lock = threading.Lock() |
|
86 | 88 | # self.control = {'stop':False, 'pause':False} |
|
87 | 89 | # |
|
88 | 90 | # def __del__(self): |
|
89 | 91 | # |
|
90 | 92 | # self.control['stop'] = True |
|
91 | 93 | # self.wait() |
|
92 | 94 | # |
|
93 | 95 | # def stop(self): |
|
94 | 96 | # |
|
95 | 97 | # self.lock.acquire() |
|
96 | 98 | # |
|
97 | 99 | # self.control['stop'] = True |
|
98 | 100 | # |
|
99 | 101 | # self.lock.release() |
|
100 | 102 | # |
|
101 | 103 | # def pause(self): |
|
102 | 104 | # |
|
103 | 105 | # self.lock.acquire() |
|
104 | 106 | # |
|
105 | 107 | # self.control['pause'] = not(self.control['pause']) |
|
106 | 108 | # paused = self.control['pause'] |
|
107 | 109 | # |
|
108 | 110 | # self.lock.release() |
|
109 | 111 | # |
|
110 | 112 | # return paused |
|
111 | 113 | # |
|
112 | 114 | # def isPaused(self): |
|
113 | 115 | # |
|
114 | 116 | # self.lock.acquire() |
|
115 | 117 | # paused = self.control['pause'] |
|
116 | 118 | # self.lock.release() |
|
117 | 119 | # |
|
118 | 120 | # return paused |
|
119 | 121 | # |
|
120 | 122 | # def isStopped(self): |
|
121 | 123 | # |
|
122 | 124 | # self.lock.acquire() |
|
123 | 125 | # stopped = self.control['stop'] |
|
124 | 126 | # self.lock.release() |
|
125 | 127 | # |
|
126 | 128 | # return stopped |
|
127 | 129 | # |
|
128 | 130 | # def run(self): |
|
129 | 131 | # |
|
130 | 132 | # self.control['stop'] = False |
|
131 | 133 | # self.control['pause'] = False |
|
132 | 134 | # |
|
133 | 135 | # self.readXml(self.filename) |
|
134 | 136 | # self.createObjects() |
|
135 | 137 | # self.connectObjects() |
|
136 | 138 | # self.emit( SIGNAL( "jobStarted( PyQt_PyObject )" ), 1) |
|
137 | 139 | # Project.run(self) |
|
138 | 140 | # self.emit( SIGNAL( "jobFinished( PyQt_PyObject )" ), 1) |
|
139 | 141 | # No newline at end of file |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now