diff --git a/README b/README index 3dc3726..7b2047d 100644 --- a/README +++ b/README @@ -14,8 +14,6 @@ Core: GUI: -PyQt4 -wxPython - -msgpack-numpy - -cPickle Signal Chain Installation: diff --git a/schainpy/__init__.py b/schainpy/__init__.py index d8e4bb1..232e9f3 100644 --- a/schainpy/__init__.py +++ b/schainpy/__init__.py @@ -4,4 +4,4 @@ Created on Feb 7, 2012 @author $Author$ @version $Id$ ''' -__version__ = "2.1.5" \ No newline at end of file +__version__ = "2.2.0" \ No newline at end of file diff --git a/schainpy/controller.py b/schainpy/controller.py index 82902e9..a8fd3ea 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -384,6 +384,9 @@ class OperationConf(): if self.type == 'plotter': #Plotter(plotter_name) + if not plotter_queue: + raise ValueError, "plotter_queue is not defined. Use:\nmyProject = Project()\nmyProject.setPlotterQueue(plotter_queue)" + opObj = Plotter(self.name, plotter_queue) if self.type == 'external' or self.type == 'other': @@ -822,13 +825,12 @@ class Project(): __plotterQueue = None - def __init__(self, filename=None, plotter_queue=None): + def __init__(self, plotter_queue=None): self.id = None self.name = None self.description = None - self.filename = filename self.__plotterQueue = plotter_queue self.procUnitConfObjDict = {} @@ -960,7 +962,10 @@ class Project(): def writeXml(self, filename=None): if filename == None: - filename = self.filename + if self.filename: + filename = self.filename + else: + filename = "schain.xml" if not filename: print "filename has not been defined. Use setFilename(filename) for do it." @@ -980,12 +985,11 @@ class Project(): ElementTree(self.projectElement).write(abs_file, method='xml') + self.filename = abs_file + return 1 def readXml(self, filename = None): - - if filename == None: - filename = self.filename abs_file = os.path.abspath(filename) @@ -1026,8 +1030,7 @@ class Project(): self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj - if self.filename == None: - self.filename = abs_file + self.filename = abs_file return 1 @@ -1145,7 +1148,31 @@ class Project(): def getPlotterQueue(self): return self.__plotterQueue + + def useExternalPlotManager(self): + + plotterList = ['Scope', + 'SpectraPlot', 'RTIPlot', + 'CrossSpectraPlot', 'CoherenceMap', + 'PowerProfilePlot', 'Noise', 'BeaconPhase', + 'CorrelationPlot', + 'SpectraHeisScope','RTIfromSpectraHeis'] + for thisPUConfObj in self.procUnitConfObjDict.values(): + + inputId = thisPUConfObj.getInputId() + + if int(inputId) == 0: + continue + + for thisOpObj in thisPUConfObj.getOperationObjList(): + + if thisOpObj.type == "self": + continue + + if thisOpObj.name in plotterList: + thisOpObj.type = "plotter" + def run(self): print @@ -1199,8 +1226,7 @@ class Project(): def start(self): - if not self.writeXml(): - return + self.writeXml() self.createObjects() self.connectObjects() diff --git a/schainpy/controller_api.py b/schainpy/controller_api.py index 56d54ee..9fdc32b 100644 --- a/schainpy/controller_api.py +++ b/schainpy/controller_api.py @@ -4,10 +4,10 @@ from schainpy.controller import Project class ControllerThread(threading.Thread, Project): - def __init__(self, filename=None, plotter_queue=None): + def __init__(self, plotter_queue=None): threading.Thread.__init__(self) - Project.__init__(self, filename, plotter_queue) + Project.__init__(self, plotter_queue) self.setDaemon(True) @@ -57,8 +57,7 @@ class ControllerThread(threading.Thread, Project): self.control['stop'] = False self.control['pause'] = False - if not self.writeXml(self.filename): - return + self.writeXml() self.createObjects() self.connectObjects() diff --git a/schainpy/gui/viewcontroller/basicwindow.py b/schainpy/gui/viewcontroller/basicwindow.py index 3674a73..95acda0 100644 --- a/schainpy/gui/viewcontroller/basicwindow.py +++ b/schainpy/gui/viewcontroller/basicwindow.py @@ -23,8 +23,9 @@ from PyQt4.QtCore import pyqtSignature from PyQt4.QtCore import pyqtSignal from PyQt4 import QtCore from PyQt4 import QtGui -# from PyQt4.QtCore import QThread -# from PyQt4.QtCore import QObject, SIGNAL + +from propertiesViewModel import TreeModel, PropertyBuffer +from parametersModel import ProjectParms from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess from schainpy.gui.viewer.ui_ftp import Ui_Ftp @@ -33,9 +34,7 @@ from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow from schainpy.controller_api import ControllerThread from schainpy.controller import Project -from propertiesViewModel import TreeModel, PropertyBuffer -from parametersModel import ProjectParms - +from schainpy.model.graphics.jroplotter import PlotManager from schainpy.gui.figures import tools FIGURES_PATH = tools.get_path() @@ -145,6 +144,8 @@ class BasicWindow(QMainWindow, Ui_BasicWindow): self.__puLocalFolder2FTP = {} self.threadStarted = False + self.plotManager = None + # self.create_comm() self.create_updating_timer() self.setGUIStatus() @@ -4667,6 +4668,7 @@ class BasicWindow(QMainWindow, Ui_BasicWindow): self._enable_play_button() def create_updating_timer(self): + self.comm_data_timer = QtCore.QTimer(self) self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) self.comm_data_timer.start(1000) @@ -4679,7 +4681,27 @@ class BasicWindow(QMainWindow, Ui_BasicWindow): if self.controllerThread.isFinished(): self.stopProject() + return + + def use_plotmanager(self, controllerThread): + + plotter_queue = Queue(10) + controllerThread.setPlotterQueue(plotter_queue) + controllerThread.useExternalPlotManager() + + self.plotManager = PlotManager(plotter_queue) + + self.plot_timer = QtCore.QTimer() + self.plot_timer.timeout.connect(self.on_plotmanager_timer) + self.plot_timer.start(10) + def on_plotmanager_timer(self): + + if not self.plotManager: + return + + self.plotManager.run() + def playProject(self, ext=".xml", save=1): self._disable_play_button() @@ -4709,8 +4731,11 @@ class BasicWindow(QMainWindow, Ui_BasicWindow): self.console.clear() self.console.append("Please wait...") - self.controllerThread = ControllerThread(filename) + self.controllerThread = ControllerThread() self.controllerThread.readXml(filename) + + self.use_plotmanager(self.controllerThread) + self.controllerThread.start() sleep(0.5) @@ -4723,13 +4748,18 @@ class BasicWindow(QMainWindow, Ui_BasicWindow): def stopProject(self): -# self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) - self.controllerThread.stop() self.threadStarted = False + self.controllerThread.stop() while self.controllerThread.isRunning(): + self.plotManager.run() sleep(0.5) + if self.plotManager is not None: + self.plotManager.stop() + self.plotManager.close() + self.plotManager = None + self._disable_stop_button() self._enable_play_button()