@@ -14,8 +14,6 Core: | |||||
14 | GUI: |
|
14 | GUI: | |
15 | -PyQt4 |
|
15 | -PyQt4 | |
16 | -wxPython |
|
16 | -wxPython | |
17 | -msgpack-numpy |
|
|||
18 | -cPickle |
|
|||
19 |
|
17 | |||
20 | Signal Chain Installation: |
|
18 | Signal Chain Installation: | |
21 |
|
19 |
@@ -4,4 +4,4 Created on Feb 7, 2012 | |||||
4 | @author $Author$ |
|
4 | @author $Author$ | |
5 | @version $Id$ |
|
5 | @version $Id$ | |
6 | ''' |
|
6 | ''' | |
7 |
__version__ = "2. |
|
7 | __version__ = "2.2.0" No newline at end of file |
@@ -384,6 +384,9 class OperationConf(): | |||||
384 |
|
384 | |||
385 | if self.type == 'plotter': |
|
385 | if self.type == 'plotter': | |
386 | #Plotter(plotter_name) |
|
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 | opObj = Plotter(self.name, plotter_queue) |
|
390 | opObj = Plotter(self.name, plotter_queue) | |
388 |
|
391 | |||
389 | if self.type == 'external' or self.type == 'other': |
|
392 | if self.type == 'external' or self.type == 'other': | |
@@ -822,13 +825,12 class Project(): | |||||
822 |
|
825 | |||
823 | __plotterQueue = None |
|
826 | __plotterQueue = None | |
824 |
|
827 | |||
825 |
def __init__(self, |
|
828 | def __init__(self, plotter_queue=None): | |
826 |
|
829 | |||
827 | self.id = None |
|
830 | self.id = None | |
828 | self.name = None |
|
831 | self.name = None | |
829 | self.description = None |
|
832 | self.description = None | |
830 |
|
833 | |||
831 | self.filename = filename |
|
|||
832 | self.__plotterQueue = plotter_queue |
|
834 | self.__plotterQueue = plotter_queue | |
833 |
|
835 | |||
834 | self.procUnitConfObjDict = {} |
|
836 | self.procUnitConfObjDict = {} | |
@@ -960,7 +962,10 class Project(): | |||||
960 | def writeXml(self, filename=None): |
|
962 | def writeXml(self, filename=None): | |
961 |
|
963 | |||
962 | if filename == None: |
|
964 | if filename == None: | |
963 |
|
|
965 | if self.filename: | |
|
966 | filename = self.filename | |||
|
967 | else: | |||
|
968 | filename = "schain.xml" | |||
964 |
|
969 | |||
965 | if not filename: |
|
970 | if not filename: | |
966 | print "filename has not been defined. Use setFilename(filename) for do it." |
|
971 | print "filename has not been defined. Use setFilename(filename) for do it." | |
@@ -980,12 +985,11 class Project(): | |||||
980 |
|
985 | |||
981 | ElementTree(self.projectElement).write(abs_file, method='xml') |
|
986 | ElementTree(self.projectElement).write(abs_file, method='xml') | |
982 |
|
987 | |||
|
988 | self.filename = abs_file | |||
|
989 | ||||
983 | return 1 |
|
990 | return 1 | |
984 |
|
991 | |||
985 | def readXml(self, filename = None): |
|
992 | def readXml(self, filename = None): | |
986 |
|
||||
987 | if filename == None: |
|
|||
988 | filename = self.filename |
|
|||
989 |
|
993 | |||
990 | abs_file = os.path.abspath(filename) |
|
994 | abs_file = os.path.abspath(filename) | |
991 |
|
995 | |||
@@ -1026,8 +1030,7 class Project(): | |||||
1026 |
|
1030 | |||
1027 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
1031 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
1028 |
|
1032 | |||
1029 |
|
|
1033 | self.filename = abs_file | |
1030 | self.filename = abs_file |
|
|||
1031 |
|
1034 | |||
1032 | return 1 |
|
1035 | return 1 | |
1033 |
|
1036 | |||
@@ -1145,7 +1148,31 class Project(): | |||||
1145 | def getPlotterQueue(self): |
|
1148 | def getPlotterQueue(self): | |
1146 |
|
1149 | |||
1147 | return self.__plotterQueue |
|
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 | def run(self): |
|
1176 | def run(self): | |
1150 |
|
1177 | |||
1151 |
|
1178 | |||
@@ -1199,8 +1226,7 class Project(): | |||||
1199 |
|
1226 | |||
1200 | def start(self): |
|
1227 | def start(self): | |
1201 |
|
1228 | |||
1202 |
|
|
1229 | self.writeXml() | |
1203 | return |
|
|||
1204 |
|
1230 | |||
1205 | self.createObjects() |
|
1231 | self.createObjects() | |
1206 | self.connectObjects() |
|
1232 | self.connectObjects() |
@@ -4,10 +4,10 from schainpy.controller import Project | |||||
4 |
|
4 | |||
5 | class ControllerThread(threading.Thread, Project): |
|
5 | class ControllerThread(threading.Thread, Project): | |
6 |
|
6 | |||
7 |
def __init__(self, |
|
7 | def __init__(self, plotter_queue=None): | |
8 |
|
8 | |||
9 | threading.Thread.__init__(self) |
|
9 | threading.Thread.__init__(self) | |
10 |
Project.__init__(self, |
|
10 | Project.__init__(self, plotter_queue) | |
11 |
|
11 | |||
12 | self.setDaemon(True) |
|
12 | self.setDaemon(True) | |
13 |
|
13 | |||
@@ -57,8 +57,7 class ControllerThread(threading.Thread, Project): | |||||
57 | self.control['stop'] = False |
|
57 | self.control['stop'] = False | |
58 | self.control['pause'] = False |
|
58 | self.control['pause'] = False | |
59 |
|
59 | |||
60 |
|
|
60 | self.writeXml() | |
61 | return |
|
|||
62 |
|
61 | |||
63 | self.createObjects() |
|
62 | self.createObjects() | |
64 | self.connectObjects() |
|
63 | self.connectObjects() |
@@ -23,8 +23,9 from PyQt4.QtCore import pyqtSignature | |||||
23 | from PyQt4.QtCore import pyqtSignal |
|
23 | from PyQt4.QtCore import pyqtSignal | |
24 | from PyQt4 import QtCore |
|
24 | from PyQt4 import QtCore | |
25 | from PyQt4 import QtGui |
|
25 | from PyQt4 import QtGui | |
26 | # from PyQt4.QtCore import QThread |
|
26 | ||
27 | # from PyQt4.QtCore import QObject, SIGNAL |
|
27 | from propertiesViewModel import TreeModel, PropertyBuffer | |
|
28 | from parametersModel import ProjectParms | |||
28 |
|
29 | |||
29 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess |
|
30 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess | |
30 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp |
|
31 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp | |
@@ -33,9 +34,7 from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow | |||||
33 | from schainpy.controller_api import ControllerThread |
|
34 | from schainpy.controller_api import ControllerThread | |
34 | from schainpy.controller import Project |
|
35 | from schainpy.controller import Project | |
35 |
|
36 | |||
36 | from propertiesViewModel import TreeModel, PropertyBuffer |
|
37 | from schainpy.model.graphics.jroplotter import PlotManager | |
37 | from parametersModel import ProjectParms |
|
|||
38 |
|
||||
39 | from schainpy.gui.figures import tools |
|
38 | from schainpy.gui.figures import tools | |
40 |
|
39 | |||
41 | FIGURES_PATH = tools.get_path() |
|
40 | FIGURES_PATH = tools.get_path() | |
@@ -145,6 +144,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
145 | self.__puLocalFolder2FTP = {} |
|
144 | self.__puLocalFolder2FTP = {} | |
146 | self.threadStarted = False |
|
145 | self.threadStarted = False | |
147 |
|
146 | |||
|
147 | self.plotManager = None | |||
|
148 | ||||
148 | # self.create_comm() |
|
149 | # self.create_comm() | |
149 | self.create_updating_timer() |
|
150 | self.create_updating_timer() | |
150 | self.setGUIStatus() |
|
151 | self.setGUIStatus() | |
@@ -4667,6 +4668,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
4667 | self._enable_play_button() |
|
4668 | self._enable_play_button() | |
4668 |
|
4669 | |||
4669 | def create_updating_timer(self): |
|
4670 | def create_updating_timer(self): | |
|
4671 | ||||
4670 | self.comm_data_timer = QtCore.QTimer(self) |
|
4672 | self.comm_data_timer = QtCore.QTimer(self) | |
4671 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) |
|
4673 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) | |
4672 | self.comm_data_timer.start(1000) |
|
4674 | self.comm_data_timer.start(1000) | |
@@ -4679,7 +4681,27 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
4679 |
|
4681 | |||
4680 | if self.controllerThread.isFinished(): |
|
4682 | if self.controllerThread.isFinished(): | |
4681 | self.stopProject() |
|
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 | def playProject(self, ext=".xml", save=1): |
|
4705 | def playProject(self, ext=".xml", save=1): | |
4684 |
|
4706 | |||
4685 | self._disable_play_button() |
|
4707 | self._disable_play_button() | |
@@ -4709,8 +4731,11 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
4709 | self.console.clear() |
|
4731 | self.console.clear() | |
4710 | self.console.append("Please wait...") |
|
4732 | self.console.append("Please wait...") | |
4711 |
|
4733 | |||
4712 |
self.controllerThread = ControllerThread( |
|
4734 | self.controllerThread = ControllerThread() | |
4713 | self.controllerThread.readXml(filename) |
|
4735 | self.controllerThread.readXml(filename) | |
|
4736 | ||||
|
4737 | self.use_plotmanager(self.controllerThread) | |||
|
4738 | ||||
4714 | self.controllerThread.start() |
|
4739 | self.controllerThread.start() | |
4715 |
|
4740 | |||
4716 | sleep(0.5) |
|
4741 | sleep(0.5) | |
@@ -4723,13 +4748,18 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
4723 |
|
4748 | |||
4724 | def stopProject(self): |
|
4749 | def stopProject(self): | |
4725 |
|
4750 | |||
4726 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
|||
4727 | self.controllerThread.stop() |
|
|||
4728 | self.threadStarted = False |
|
4751 | self.threadStarted = False | |
|
4752 | self.controllerThread.stop() | |||
4729 |
|
4753 | |||
4730 | while self.controllerThread.isRunning(): |
|
4754 | while self.controllerThread.isRunning(): | |
|
4755 | self.plotManager.run() | |||
4731 | sleep(0.5) |
|
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 | self._disable_stop_button() |
|
4763 | self._disable_stop_button() | |
4734 | self._enable_play_button() |
|
4764 | self._enable_play_button() | |
4735 |
|
4765 |
General Comments 0
You need to be logged in to leave comments.
Login now