def __init__(self, setplot='setplot.py', outdir=None, \ completekey='tab', stdin=None, stdout=None): """Instantiate a line-oriented interpreter framework. The optional argument 'completekey' is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used. """ import sys if stdin is not None: self.stdin = stdin else: self.stdin = sys.stdin if stdout is not None: self.stdout = stdout else: self.stdout = sys.stdout self.cmdqueue = [] self.completekey = completekey self.setplot = setplot plotdata = data.ClawPlotData() plotdata.setplot = self.setplot plotdata._mode = 'iplotclaw' if outdir is None: try: # possibly set by 'make .output' and stored in .output: dot_output = open('.output', 'r') outdir = dot_output.readline().strip() dot_output.close() except: outdir = '.' plotdata.outdir = outdir # Note also that outdir might be reset by setplot! try: plotdata = frametools.call_setplot(self.setplot, plotdata) except: print('*** Problem executing setplot in Iplotclaw') #print ' plotdata = ', plotdata print((' setplot = ', self.setplot)) print('*** Either this file does not exist or ') print( ' there is a problem executing the function setplot in this file.' ) print('*** PLOT PARAMETERS MAY NOT BE SET! ***') raise #return self.plotdata = plotdata self.prevplotdata = plotdata self.restart = False self.prevframeno = 0
def __init__(self, setplot='setplot.py', outdir=None, \ completekey='tab', stdin=None, stdout=None): """Instantiate a line-oriented interpreter framework. The optional argument 'completekey' is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used. """ import sys if stdin is not None: self.stdin = stdin else: self.stdin = sys.stdin if stdout is not None: self.stdout = stdout else: self.stdout = sys.stdout self.cmdqueue = [] self.completekey = completekey self.setplot = setplot plotdata = data.ClawPlotData() plotdata.setplot = self.setplot plotdata._mode = 'iplotclaw' if outdir is None: try: # possibly set by 'make .output' and stored in .output: dot_output = open('.output','r') outdir = dot_output.readline().strip() dot_output.close() except: outdir = '.' plotdata.outdir = outdir # Note also that outdir might be reset by setplot! try: plotdata = frametools.call_setplot(self.setplot,plotdata) except: print '*** Problem executing setplot in Iplotclaw' #print ' plotdata = ', plotdata print ' setplot = ', self.setplot print '*** Either this file does not exist or ' print ' there is a problem executing the function setplot in this file.' print '*** PLOT PARAMETERS MAY NOT BE SET! ***' raise #return self.plotdata = plotdata self.prevplotdata = plotdata self.restart = False self.prevframeno = 0
def do_resetplot(self, rest): if rest: self.setplot = rest print '*** Resetting setplot to: ',rest self.plotdata.setplot = self.setplot print 'Executing setplot from ',self.setplot try: plotdata = frametools.call_setplot(self.setplot,self.plotdata) except: print '*** Problem re-executing setplot' raise