##// END OF EJS Templates
v2.2.0: Controller updated
Miguel Valdez -
r708:e5ce72bc2207
parent child
Show More
@@ -14,8 +14,6 Core:
14 14 GUI:
15 15 -PyQt4
16 16 -wxPython
17 -msgpack-numpy
18 -cPickle
19 17
20 18 Signal Chain Installation:
21 19
@@ -4,4 +4,4 Created on Feb 7, 2012
4 4 @author $Author$
5 5 @version $Id$
6 6 '''
7 __version__ = "2.1.5" No newline at end of file
7 __version__ = "2.2.0" No newline at end of file
@@ -384,6 +384,9 class OperationConf():
384 384
385 385 if self.type == 'plotter':
386 386 #Plotter(plotter_name)
387 if not plotter_queue:
388 raise ValueError, "plotter_queue is not defined. Use:\nmyProject = Project()\nmyProject.setPlotterQueue(plotter_queue)"
389
387 390 opObj = Plotter(self.name, plotter_queue)
388 391
389 392 if self.type == 'external' or self.type == 'other':
@@ -822,13 +825,12 class Project():
822 825
823 826 __plotterQueue = None
824 827
825 def __init__(self, filename=None, plotter_queue=None):
828 def __init__(self, plotter_queue=None):
826 829
827 830 self.id = None
828 831 self.name = None
829 832 self.description = None
830 833
831 self.filename = filename
832 834 self.__plotterQueue = plotter_queue
833 835
834 836 self.procUnitConfObjDict = {}
@@ -960,7 +962,10 class Project():
960 962 def writeXml(self, filename=None):
961 963
962 964 if filename == None:
963 filename = self.filename
965 if self.filename:
966 filename = self.filename
967 else:
968 filename = "schain.xml"
964 969
965 970 if not filename:
966 971 print "filename has not been defined. Use setFilename(filename) for do it."
@@ -980,12 +985,11 class Project():
980 985
981 986 ElementTree(self.projectElement).write(abs_file, method='xml')
982 987
988 self.filename = abs_file
989
983 990 return 1
984 991
985 992 def readXml(self, filename = None):
986
987 if filename == None:
988 filename = self.filename
989 993
990 994 abs_file = os.path.abspath(filename)
991 995
@@ -1026,8 +1030,7 class Project():
1026 1030
1027 1031 self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj
1028 1032
1029 if self.filename == None:
1030 self.filename = abs_file
1033 self.filename = abs_file
1031 1034
1032 1035 return 1
1033 1036
@@ -1145,7 +1148,31 class Project():
1145 1148 def getPlotterQueue(self):
1146 1149
1147 1150 return self.__plotterQueue
1151
1152 def useExternalPlotManager(self):
1153
1154 plotterList = ['Scope',
1155 'SpectraPlot', 'RTIPlot',
1156 'CrossSpectraPlot', 'CoherenceMap',
1157 'PowerProfilePlot', 'Noise', 'BeaconPhase',
1158 'CorrelationPlot',
1159 'SpectraHeisScope','RTIfromSpectraHeis']
1148 1160
1161 for thisPUConfObj in self.procUnitConfObjDict.values():
1162
1163 inputId = thisPUConfObj.getInputId()
1164
1165 if int(inputId) == 0:
1166 continue
1167
1168 for thisOpObj in thisPUConfObj.getOperationObjList():
1169
1170 if thisOpObj.type == "self":
1171 continue
1172
1173 if thisOpObj.name in plotterList:
1174 thisOpObj.type = "plotter"
1175
1149 1176 def run(self):
1150 1177
1151 1178 print
@@ -1199,8 +1226,7 class Project():
1199 1226
1200 1227 def start(self):
1201 1228
1202 if not self.writeXml():
1203 return
1229 self.writeXml()
1204 1230
1205 1231 self.createObjects()
1206 1232 self.connectObjects()
@@ -4,10 +4,10 from schainpy.controller import Project
4 4
5 5 class ControllerThread(threading.Thread, Project):
6 6
7 def __init__(self, filename=None, plotter_queue=None):
7 def __init__(self, plotter_queue=None):
8 8
9 9 threading.Thread.__init__(self)
10 Project.__init__(self, filename, plotter_queue)
10 Project.__init__(self, plotter_queue)
11 11
12 12 self.setDaemon(True)
13 13
@@ -57,8 +57,7 class ControllerThread(threading.Thread, Project):
57 57 self.control['stop'] = False
58 58 self.control['pause'] = False
59 59
60 if not self.writeXml(self.filename):
61 return
60 self.writeXml()
62 61
63 62 self.createObjects()
64 63 self.connectObjects()
@@ -23,8 +23,9 from PyQt4.QtCore import pyqtSignature
23 23 from PyQt4.QtCore import pyqtSignal
24 24 from PyQt4 import QtCore
25 25 from PyQt4 import QtGui
26 # from PyQt4.QtCore import QThread
27 # from PyQt4.QtCore import QObject, SIGNAL
26
27 from propertiesViewModel import TreeModel, PropertyBuffer
28 from parametersModel import ProjectParms
28 29
29 30 from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess
30 31 from schainpy.gui.viewer.ui_ftp import Ui_Ftp
@@ -33,9 +34,7 from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow
33 34 from schainpy.controller_api import ControllerThread
34 35 from schainpy.controller import Project
35 36
36 from propertiesViewModel import TreeModel, PropertyBuffer
37 from parametersModel import ProjectParms
38
37 from schainpy.model.graphics.jroplotter import PlotManager
39 38 from schainpy.gui.figures import tools
40 39
41 40 FIGURES_PATH = tools.get_path()
@@ -145,6 +144,8 class BasicWindow(QMainWindow, Ui_BasicWindow):
145 144 self.__puLocalFolder2FTP = {}
146 145 self.threadStarted = False
147 146
147 self.plotManager = None
148
148 149 # self.create_comm()
149 150 self.create_updating_timer()
150 151 self.setGUIStatus()
@@ -4667,6 +4668,7 class BasicWindow(QMainWindow, Ui_BasicWindow):
4667 4668 self._enable_play_button()
4668 4669
4669 4670 def create_updating_timer(self):
4671
4670 4672 self.comm_data_timer = QtCore.QTimer(self)
4671 4673 self.comm_data_timer.timeout.connect(self.on_comm_updating_timer)
4672 4674 self.comm_data_timer.start(1000)
@@ -4679,7 +4681,27 class BasicWindow(QMainWindow, Ui_BasicWindow):
4679 4681
4680 4682 if self.controllerThread.isFinished():
4681 4683 self.stopProject()
4684 return
4685
4686 def use_plotmanager(self, controllerThread):
4687
4688 plotter_queue = Queue(10)
4689 controllerThread.setPlotterQueue(plotter_queue)
4690 controllerThread.useExternalPlotManager()
4691
4692 self.plotManager = PlotManager(plotter_queue)
4693
4694 self.plot_timer = QtCore.QTimer()
4695 self.plot_timer.timeout.connect(self.on_plotmanager_timer)
4696 self.plot_timer.start(10)
4682 4697
4698 def on_plotmanager_timer(self):
4699
4700 if not self.plotManager:
4701 return
4702
4703 self.plotManager.run()
4704
4683 4705 def playProject(self, ext=".xml", save=1):
4684 4706
4685 4707 self._disable_play_button()
@@ -4709,8 +4731,11 class BasicWindow(QMainWindow, Ui_BasicWindow):
4709 4731 self.console.clear()
4710 4732 self.console.append("Please wait...")
4711 4733
4712 self.controllerThread = ControllerThread(filename)
4734 self.controllerThread = ControllerThread()
4713 4735 self.controllerThread.readXml(filename)
4736
4737 self.use_plotmanager(self.controllerThread)
4738
4714 4739 self.controllerThread.start()
4715 4740
4716 4741 sleep(0.5)
@@ -4723,13 +4748,18 class BasicWindow(QMainWindow, Ui_BasicWindow):
4723 4748
4724 4749 def stopProject(self):
4725 4750
4726 # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True))
4727 self.controllerThread.stop()
4728 4751 self.threadStarted = False
4752 self.controllerThread.stop()
4729 4753
4730 4754 while self.controllerThread.isRunning():
4755 self.plotManager.run()
4731 4756 sleep(0.5)
4732 4757
4758 if self.plotManager is not None:
4759 self.plotManager.stop()
4760 self.plotManager.close()
4761 self.plotManager = None
4762
4733 4763 self._disable_stop_button()
4734 4764 self._enable_play_button()
4735 4765
General Comments 0
You need to be logged in to leave comments. Login now