diff --git a/schainpy/Graphics/SpectraPlot2.py b/schainpy/Graphics/SpectraPlot2.py index a148390..1a1ba9a 100644 --- a/schainpy/Graphics/SpectraPlot2.py +++ b/schainpy/Graphics/SpectraPlot2.py @@ -1,4 +1,5 @@ import numpy +import sys import schainPlot class RTIFigure(schainPlot.Figure): @@ -15,7 +16,7 @@ class RTIFigure(schainPlot.Figure): minvalue = None maxvalue = None - idfigure = None + id = None nframes = None wintitle = wintitle colormap = None @@ -24,9 +25,9 @@ class RTIFigure(schainPlot.Figure): frameObjList = [] - def __init__(self, idfigure, wintitle, xw=600, yw=800, overplot=0, driver='xwin', colormap='br_green', *showGraphs): + def __init__(self, id, wintitle, xw=600, yw=800, overplot=0, driver=None, colormap='br_green', *showGraphs): - self.idfigure = idfigure + self.id = id self.wintitle = wintitle self.colormap = colormap self.driver = driver @@ -34,11 +35,15 @@ class RTIFigure(schainPlot.Figure): self.showGraphs = showGraphs - self.__driverObj = Driver(driver) + showColorbar = showGraphs[0] + showPowerprofile = showGraphs[1] + self.__driverObj = Driver(id, wintitle,xw,yw,overplot,driver,colormap,showColorbar,showPowerprofile) + + def __openDriver(self): - self.__driverObj.openDriver(self.idfigure, self.wintitle, self.xw, self.yw) + self.__driverObj.openDriver(self.id, self.wintitle, self.xw, self.yw) def __openFigure(self): diff --git a/schainpy/Graphics/schainPlplotLib.py b/schainpy/Graphics/schainPlotLib.py similarity index 87% rename from schainpy/Graphics/schainPlplotLib.py rename to schainpy/Graphics/schainPlotLib.py index f646ae7..070bf54 100644 --- a/schainpy/Graphics/schainPlplotLib.py +++ b/schainpy/Graphics/schainPlotLib.py @@ -2,25 +2,39 @@ import plplot import numpy import sys -class Driver: +class PlplotDriver: __isDriverOpen = False - - def __init__(self, driver=plplot): + + def __init__(self, id=None, driver=None, wintitle, overplot, colormap, showGraph1, showGraph2): - self.idStream = idStream - self.nFrames = nFrames - self.winTitle = winTitle - self.colormap = colormap + if id == None: + raise ValueError, 'id input must be defined' + + if driver == None: + if sys.platform == "linux": + driver = "" + elif sys.platform == "darwin": + driver = "" + else: + driver = "" + + self.id = id self.driver = driver + + self.nFrames = nFrames + self.wintitle = wintitle + self.colormap = colormap self.showGraph1 = showGraph1 self.showGraph2 = showGraph2 self.overplot = overplot def configDriver(self): - + if self.driver == "": + import plplot + pass def openDriver(self): @@ -83,8 +97,13 @@ class Driver: pass -def config_driver(idStream, wintitle, width, height): - plplot.plsstrm(idStream) + +class MplDriver: + def __init__(self): + pass + +def config_driver(id, wintitle, width, height): + plplot.plsstrm(id) plplot.plparseopts([wintitle],plplot.PL_PARSE_FULL) plplot.plsetopt("geometry", "%dx%d"%(width,height))