##// END OF EJS Templates
GUI: Every icon were resized
Miguel Valdez -
r668:9569bc5c6731
parent child
Show More
@@ -1,137 +1,139
1 1 import threading
2 2
3 3 from PyQt4 import QtCore
4 4 from PyQt4.QtCore import SIGNAL
5 5
6 6 from schainpy.controller import Project
7 7
8 8 class ControllerThread(threading.Thread, Project):
9 9
10 10 def __init__(self, filename):
11 11
12 12 threading.Thread.__init__(self)
13 13 Project.__init__(self)
14 14
15 15 self.setDaemon(True)
16 16
17 17 self.filename = filename
18 18 self.control = {'stop':False, 'pause':False}
19 19
20 20 def __del__(self):
21 21
22 22 self.control['stop'] = True
23 23 # self.pause(1)
24 24 # self.wait()
25 25
26 26 def stop(self):
27 27 self.control['stop'] = True
28 28
29 29 def pause(self):
30 30 self.control['pause'] = not(self.control['pause'])
31 31
32 return self.control['pause']
33
32 34 def __run(self):
33 35
34 36 print
35 37 print "*"*40
36 38 print " Starting SIGNAL CHAIN PROCESSING "
37 39 print "*"*40
38 40 print
39 41
40 42 keyList = self.procUnitConfObjDict.keys()
41 43 keyList.sort()
42 44
43 45 while(True):
44 46
45 47 finalSts = False
46 48 #executed proc units
47 49 procUnitExecutedList = []
48 50
49 51 for procKey in keyList:
50 52 # print "Running the '%s' process with %s" %(procUnitConfObj.name, procUnitConfObj.id)
51 53
52 54 procUnitConfObj = self.procUnitConfObjDict[procKey]
53 55
54 56 inputId = procUnitConfObj.getInputId()
55 57
56 58 sts = procUnitConfObj.run()
57 59 finalSts = finalSts or sts
58 60
59 61 procUnitExecutedList.append(procUnitConfObj.id)
60 62
61 63 #If every process unit finished so end process
62 64 if not(finalSts):
63 65 print "Every process unit have finished"
64 66 break
65 67
66 68 if self.control['pause']:
67 69 print "Process suspended"
68 70
69 71 while True:
70 72 sleep(0.1)
71 73
72 74 if not self.control['pause']:
73 75 break
74 76
75 77 if self.control['stop']:
76 78 break
77 79 print "Process reinitialized"
78 80
79 81 if self.control['stop']:
80 82 # print "Process stopped"
81 83 break
82 84
83 85 #Closing every process
84 86 for procKey in keyList:
85 87 procUnitConfObj = self.procUnitConfObjDict[procKey]
86 88 procUnitConfObj.close()
87 89
88 90 print "Process finished"
89 91
90 92 def run(self):
91 93 self.control['stop'] = False
92 94 self.control['pause'] = False
93 95
94 96 self.readXml(self.filename)
95 97 self.createObjects()
96 98 self.connectObjects()
97 99 Project.run(self)
98 100
99 101 def isRunning(self):
100 102
101 103 return self.is_alive()
102 104
103 105 def isFinished(self):
104 106
105 107 return not self.is_alive()
106 108
107 109 class ControllerQThread(QtCore.QThread, Project):
108 110
109 111 def __init__(self, filename):
110 112
111 113 QtCore.QThread.__init__(self)
112 114 Project.__init__(self)
113 115
114 116 self.filename = filename
115 117 self.control = {'stop':False, 'pause':False}
116 118
117 119 def __del__(self):
118 120
119 121 self.control['stop'] = True
120 122 self.wait()
121 123
122 124 def stop(self):
123 125 self.control['stop'] = True
124 126
125 127 def pause(self):
126 128 self.control['pause'] = not(self.control['pause'])
127 129
128 130 def run(self):
129 131 self.control['stop'] = False
130 132 self.control['pause'] = False
131 133
132 134 self.readXml(self.filename)
133 135 self.createObjects()
134 136 self.connectObjects()
135 137 self.emit( SIGNAL( "jobStarted( PyQt_PyObject )" ), 1)
136 138 Project.run(self)
137 139 self.emit( SIGNAL( "jobFinished( PyQt_PyObject )" ), 1) No newline at end of file
1 NO CONTENT: file was removed, binary diff hidden
General Comments 0
You need to be logged in to leave comments. Login now