def runWrappedExtendedSyntaxCommandAndReturnException(self, command):
		'''(time, e) = runWrappedExtendedSyntaxCommandAndCollectAnyException(command)
		
		NOTE: pickle won't pickle-up exc_info() output from in here for some reason.
		Returns the exception instead.'''
		wrappedCommand = """
import pickle
import sys
from time import clock
def trySomething():
	try:
		unlikelyName8466_t = clock()
		%s
		unlikelyName8466_t = clock() - unlikelyName8466_t
	except (Exception, java.lang.Exception), unlikelyName8466_exception:
		print '* returning: ', unlikelyName8466_exception, '*'
		return pickle.dumps((None, unlikelyName8466_exception))
	return pickle.dumps((unlikelyName8466_t, None))
""" % command

		JythonServerFacade.getInstance().runCommand(wrappedCommand)
		sleep(.1)
		mystdout = ExtendedSyntaxCommandTest.FileLikeObject()
		mystderr = ExtendedSyntaxCommandTest.FileLikeObject()
		saveout = sys.stdout
		saveerr = sys.stderr
		sys.stdout = mystdout
		sys.stderr = mystderr
		try:
			pickledTuple = JythonServerFacade.getInstance().evaluateCommand("trySomething()") #just an exception for now
		except (Exception, java.lang.Exception), e:
			sys.stdout = saveout
			sys.stderr = saveerr
			raise e
    def runWrappedExtendedSyntaxCommandAndReturnException(self, command):
        '''(time, e) = runWrappedExtendedSyntaxCommandAndCollectAnyException(command)
		
		NOTE: pickle won't pickle-up exc_info() output from in here for some reason.
		Returns the exception instead.'''
        wrappedCommand = """
import pickle
import sys
from time import clock
def trySomething():
	try:
		unlikelyName8466_t = clock()
		%s
		unlikelyName8466_t = clock() - unlikelyName8466_t
	except (Exception, java.lang.Exception), unlikelyName8466_exception:
		print '* returning: ', unlikelyName8466_exception, '*'
		return pickle.dumps((None, unlikelyName8466_exception))
	return pickle.dumps((unlikelyName8466_t, None))
""" % command

        JythonServerFacade.getInstance().runCommand(wrappedCommand)
        sleep(.1)
        mystdout = ExtendedSyntaxCommandTest.FileLikeObject()
        mystderr = ExtendedSyntaxCommandTest.FileLikeObject()
        saveout = sys.stdout
        saveerr = sys.stderr
        sys.stdout = mystdout
        sys.stderr = mystderr
        try:
            pickledTuple = JythonServerFacade.getInstance().evaluateCommand(
                "trySomething()")  #just an exception for now
        except (Exception, java.lang.Exception), e:
            sys.stdout = saveout
            sys.stderr = saveerr
            raise e
Beispiel #3
0
def pulse(*args, **kwargs):
    ''' send pulse sweep generated by Keithley 2461 to the sample via Synapse Switch Box.
    This command takes only 6 or 8 input parameters:
        The first 2 (in 6 parameters case) or 4 (in 8 parameters case) parameters defines the contact points in the Synapse Switch Box;
        The last 4 parameters defines pulse sweep to be generated by the Keithley 2461.
    Command syntax:
        pulse source_high source_low current width timeDelay numberOfPulses
            for 6 input parameters
        pulse source_1_high  source_2_high source_1_low source_2_low current width timeDelay  numberOfPulses
            for 8 input parameters
    '''
    if len(args) == 6:
        if args[0]==args[1]:
            raise Exception("Cannot use the same Synapse terminal for both high and low.")
        synapse_setall.rawAsynchronousMoveTo("Open circuit")
        #configure synapse    
        synapseHigh = whichSynapseTerminal(args[0])
        synapseHigh.rawAsynchronousMoveTo("Source high")
        synapseLow = whichSynapseTerminal(args[1])
        synapseLow.rawAsynchronousMoveTo("Source low")
        sleep(1) #ensure above finished before statement below 
        
        if kwargs.get('KEITHLEY_SOURCE_MODE', curr) == curr or str(JythonServerFacade.getInstance().getFromJythonNamespace('KEITHLEY_SOURCE_MODE')) == curr:
            generateCurrentPulseFromKeithley(args[2], args[3], args[4]/2, args[5])
        elif kwargs.get('KEITHLEY_SOURCE_MODE', curr) == volt or str(JythonServerFacade.getInstance().getFromJythonNamespace('KEITHLEY_SOURCE_MODE'))  == volt:
            generateVoltagePulseFromKeithley(args[2], args[3], args[4]/2, args[5])
        else:
            raise Exception("Keithley source mode %s is not supported" % KEITHLEY_SOURCE_MODE)
        synapse_setall.rawAsynchronousMoveTo("STV")
        print "Pulse sweep completed."
      
    elif len(args)== 8:
        if len(args[:4])!=len(set(args[:4])):
            raise Exception("Cannot use the same Synapse terminal more than once in this command.")
        synapse_setall.rawAsynchronousMoveTo("Open circuit")
        #configure synapse    
        synapseHigh1 = whichSynapseTerminal(args[0])
        synapseHigh1.rawAsynchronousMoveTo("Source high")
        synapseHigh2 = whichSynapseTerminal(args[1])
        synapseHigh2.rawAsynchronousMoveTo("Source high")
        synapseLow1 = whichSynapseTerminal(args[2])
        synapseLow1.rawAsynchronousMoveTo("Source low")
        synapseLow2 = whichSynapseTerminal(args[3])
        synapseLow2.rawAsynchronousMoveTo("Source low")
        sleep(1)#ensure above finished before statement below
        
        if kwargs.get('KEITHLEY_SOURCE_MODE', curr) == curr or str(JythonServerFacade.getInstance().getFromJythonNamespace('KEITHLEY_SOURCE_MODE'))  == curr:
            generateCurrentPulseFromKeithley(args[4], args[5], args[6]/2, args[7])
        elif kwargs.get('KEITHLEY_SOURCE_MODE', curr) == volt or str(JythonServerFacade.getInstance().getFromJythonNamespace('KEITHLEY_SOURCE_MODE'))  == volt:
            generateVoltagePulseFromKeithley(args[4], args[5], args[6]/2, args[7])
        else:
            raise Exception("Keithley source mode %s is not supported" % KEITHLEY_SOURCE_MODE)
       
        synapse_setall.rawAsynchronousMoveTo("STV")
        print "Pulse sweep completed."
    
    else:
        raise Exception("Number of parameters is wrong, require 6 or 8 arguments.")
Beispiel #4
0
 def run(self):
     '''rocking motion of the specified scannable during scan. This call must be non-blocking.'''
     while(self.runThread):
         if (JythonServerFacade.getInstance().getScanStatus() == JythonStatus.RUNNING):
             if not self.pd.isBusy():
                 self.pd.asynchronousMoveTo(self.getUpperGdaLimits()[0])
         if (JythonServerFacade.getInstance().getScanStatus() == JythonStatus.RUNNING):
             if not self.pd.isBusy():
                 self.pd.asynchronousMoveTo(self.getLowerGdaLimits()[0])
Beispiel #5
0
 def checkForAnglePause(self, npoints, start, end, step, collectionTime):
     if (self.paused):
         JythonServerFacade.getInstance().setScriptStatus(
             JythonStatus.PAUSED)
         while (self.paused):
             try:
                 print 'Angle Scan paused - Awaiting resume'
                 java.lang.Thread.sleep(10000)
             except lang.InterruptedException:
                 self.checkForAngleInterrupt(npoints, start, end, step,
                                             collectionTime)
Beispiel #6
0
 def run(self):
     '''rocking motion of the specified scannable during scan. This call must be non-blocking.'''
     while (self.runThread):
         if (JythonServerFacade.getInstance().getScanStatus() ==
                 JythonStatus.RUNNING):
             if not self.pd.isBusy():
                 self.pd.asynchronousMoveTo(self.getUpperGdaLimits()[0])
         if (JythonServerFacade.getInstance().getScanStatus() ==
                 JythonStatus.RUNNING):
             if not self.pd.isBusy():
                 self.pd.asynchronousMoveTo(self.getLowerGdaLimits()[0])
Beispiel #7
0
 def checkForKScanPause(self, npoints, start, end, step, edgeEnergy, twoD,
                        kStartTime, kEndTime, kWeighting):
     if (self.paused):
         JythonServerFacade.getInstance().setScriptStatus(
             JythonStatus.PAUSED)
         while (self.paused):
             try:
                 print 'K Scan Scan paused - Awaiting resume'
                 java.lang.Thread.sleep(10000)
             except lang.InterruptedException:
                 self.checkForKScanInterrupt(npoints, start, end, step,
                                             edgeEnergy, twoD, kStartTime,
                                             kEndTime, kWeighting)
Beispiel #8
0
 def __init__(self, filename):
     self.__version__ = '1.00'
     self.hplcFile = filename
     self.bean = HplcSessionBean.createFromXML(filename)
     finder = gda.factory.Finder.getInstance()
     find = finder.find
     self.shutter = find('shutter')
     self.bsdiode = find('bsdiode')
     self.sample_type = find('sample_type')
     self.sampleName = find("samplename")
     self.environment = find("sample_environment")
     self.tfg = finder.listAllLocalObjects("gda.device.Timer")[0]
     self.ncddetectors = finder.listAllLocalObjects(
         "uk.ac.gda.server.ncd.detectorsystem.NcdDetectorSystem")[0]
     self.jsf = JythonServerFacade.getInstance()
     self.readout_time = 0.1
     #CREATE A LOGGER
     self.logger = logging.getLogger('HPLC')
     self.logger.setLevel(logging.INFO)
     formatter = logging.Formatter(
         '%(asctime)s: %(levelname)s: %(module)s: %(message)s',
         "[%Y-%m-%d %H:%M:%S]")
     streamhandler = logging.StreamHandler()
     streamhandler.setFormatter(formatter)
     if len(self.logger.handlers) == 0:
         self.logger.addHandler(streamhandler)
     self.logger.info('HPLC class version ' + self.__version__ +
                      ' was instantiated')
Beispiel #9
0
 def waitWhileBusy(self):
     if not self._operating_continuously:
         if JythonServerFacade.getInstance().getScanStatus()==RUNNING:
             # loop until okay
             while not self._getStatusAndHandleChange():  
                 # not okay
                 sleep(self.secondsBetweenChecks)
                 self._collectNewMonitorValue()  
Beispiel #10
0
 def checkForKScanInterrupt(self, npoints, start, end, step, edgeEnergy,
                            twoD, kStartTime, kEndTime, kWeighting):
     #if(self.facade.getScanStatus()==0 and self.facade.getScriptStatus()==0):
     if (self.interrupted):
         print 'Stopping k scan:Writing out data taken'
         # write the data we have so far and return
         self.stopDetector()
         self.writeKScanSummary(npoints, start, end, step, edgeEnergy, twoD,
                                kStartTime, kEndTime, kWeighting)
         self.interrupted = Boolean(0)
         self.paused = Boolean(0)
         JythonServerFacade.getInstance().setScriptStatus(JythonStatus.IDLE)
         scandata = Vector()
         scandata.add("STOP")
         self.controller.update(None, scandata)
         self.mcontroller.update(None, scandata)
         print 'Now the nasty bit: throw an exception to stop running'
         raise lang.InterruptedException()
Beispiel #11
0
    def getLastScanCommand(self):
        #jsf=InterfaceProvider.getJythonNamespace()
        jsf = JythonServerFacade.getInstance()
        sdp = jsf.getLastScanDataPoint()

        strCmd = "GDA command"

        if isinstance(sdp, ScanDataPoint):
            strCmd = sdp.getCommand()
        return strCmd
Beispiel #12
0
	def run(self):
	#	print "Thread: " + self.getName() + " started"
		while (self.runThread):
			if (JythonServerFacade.getInstance().getScanStatus() == JythonStatus.RUNNING and self.currenttemp >= float(MAXTEMP)):
				JythonServerFacade.getInstance().pauseCurrentScan()	
				print "Scan paused as temperature " + self.getName() +" returns: "+str(self.currenttemp)
			elif (JythonServerFacade.getInstance().getScanStatus() == JythonStatus.PAUSED and self.currenttemp <= float(MINTEMP)):
				print "Scan resumed as temperature " + self.getName() +" returns: "+str(self.currenttemp)
				JythonServerFacade.getInstance().resumeCurrentScan()
			sleep(10)
Beispiel #13
0
	def getLastCommand(self):
		#jsf=InterfaceProvider.getJythonNamespace()
		jsf=JythonServerFacade.getInstance();
		
		historyFilePath = LocalProperties.get("gda.jythonTerminal.commandHistory.path", jsf.getDefaultScriptProjectFolder());
		historyFileName = os.path.join(historyFilePath, ".cmdHistory.txt")
		
		if not os.path.exists(historyFileName):
			print "No history found"
			strCmd=''
		else:
			historyFile=open(historyFileName, 'r');
			strCmd=( historyFile.readlines() )[-1];
			historyFile.close();
			
		#print "The last command is: " + strCmd;
		return strCmd
Beispiel #14
0
    def __init__(self, beanFile):
        self.__version__ = '1.02'
        finder = gda.factory.Finder.getInstance()
        find = finder.find
        self.simulate = False
        self.holdsample = SAMPLE_HOLD
        self.samplevolume = 35
        self.beanFile = beanFile
        self.bean = BSSCSessionBean.createFromXML(beanFile)
        self.bssc = finder.listAllLocalObjects(
            "uk.ac.gda.devices.bssc.BioSAXSSampleChanger")[0]
        self.tfg = finder.listAllLocalObjects("gda.device.Timer")[0]
        self.jsf = JythonServerFacade.getInstance()
        self.detector = finder.listAllLocalObjects(
            "uk.ac.gda.server.ncd.detectorsystem.NcdDetectorSystem")[0]
        self.shutter = find("shutter")
        self.bsscscannable = find("bsscscannable")
        self.processing = find("bssc_proc")
        #self.energy = float(find("dcm_energy").getPosition())
        self.sampleConcentration = find("sample_concentration")
        self.sampleName = find("samplename")
        self.sample_type = find('sample_type')
        self.sample_environment = find('sample_environment')
        self.experiment_definition = gdaserver.experiment_definition
        self.metashop = gdaserver.metashop
        self.meta = GDAMetadataProvider.getInstance()

        #need to remove hardcoding
        find("sample_thickness").asynchronousMoveTo(1.6)

        self.progresscounter = 0
        self.overheadsteps = 5
        self.stepspersample = 8

        if self.simulate:
            print "running in simulation mode"
            self.scannables = [self.detector, self.bsscscannable]
        else:
            self.cam = gda.factory.Finder.getInstance().find("bsaxscam")
            self.scannables = [self.detector, self.bsscscannable, self.cam]

        currentVisit = GDAMetadataProvider.getInstance().getMetadataValue(
            "visit")
        self.totalSteps = self.overheadsteps + self.bean.getMeasurements(
        ).size() * self.stepspersample
Beispiel #15
0
    def __init__(self, detectorList=None):
        # EXAFS PANEL CODE
        self.scannableNamesVector = Vector()
        self.scannableNamesVector.add("dcm_mono")
        self.detectorNamesVector = Vector()
        self.detectorNamesVector.add("counterTimer01")
        self.detectorNamesVector.add("counterTimer02")
        self.controller = Finder.find("ExafsController")
        self.mcontroller = Finder.find("MicroFocusController")
        self.title = "TITLE"
        self.condition1 = "CONDITION1"
        self.condition2 = "CONDITION2"
        self.condition3 = "CONDITION3"
        # Script code
        self.das = Finder.find("daserver")
        self.ionchambers = SlaveCounterTimer()
        self.converter = Finder.find("auto_mDeg_idGap_mm_converter")
        self.windowValues = [[0, 4095]] * 9
        self.windowName = 'ALL'
        self.ionchamberData = []
        self.mcaList = []
        self.scalarList = []
        self.runs = NumTracker("tmp")
        self.runprefix = 'i18exafs'
        self.runext = '.dat'
        self.fileno = self.runs.getCurrentFileNumber() + 1
        self.runs.incrementNumber()
        self.datadir = InterfaceProvider.getPathConstructor(
        ).createFromProperty("gda.data.scan.datawriter.datadir")
        self.datafilename = self.datadir + '/' + str(self.fileno) + self.runext
        if (detectorList != None):
            self.detectorMask = detectorList
        else:
            self.detectorMask = [1, 1, 1, 1, 1, 1, 1, 1, 1]

        self.mcadir = self.datadir + '/mca/' + str(self.fileno) + '/'
        self.mcarootname = self.mcadir + str(self.fileno)
        if not os.path.isdir(self.mcadir):
            os.mkdir(self.mcadir)
        self.tag = 1
        self.facade = JythonServerFacade.getInstance()
        self.scanList = []
        self.noOfRepeats = 1
        self.noOfPoints = 0
Beispiel #16
0
 def getPosition(self):
     '''Pauses until status is okay'''
     self.statusRemainedGoodSinceLastGetPosition = 1.0
     # loop until okay (note that the count will have been triggered if count time was given)
     if JythonServerFacade.getInstance().getScanStatus() == RUNNING:
         while not self.getStatusAndReport():
             # not okay
             self.statusRemainedGoodSinceLastGetPosition = 0.0
             sleep(self.secondsBetweenChecks)
             if self.countTime != None:
                 self.__triggerCount(self.countTime)  #
                 self.__waitForCountToComplete()
     else:  # scan not running
         currentStatus = self.getStatus()
         if not currentStatus:  # bad
             print "WaitBelowAndShutter not holding readback as no scan is running"
         self.statusRemainedGoodSinceLastGetPosition = currentStatus
     # now okay
     return self.statusRemainedGoodSinceLastGetPosition
Beispiel #17
0
    def __init__(self, beanFile):
        self.__version__ = '1.02'
        finder = gda.factory.Finder.getInstance()
        find = finder.find
        self.simulate = False
        self.holdsample = SAMPLE_HOLD
        self.samplevolume = 35
        self.beanFile = beanFile
        self.bean = BSSCSessionBean.createFromXML(beanFile)
        self.bssc = finder.listAllLocalObjects("uk.ac.gda.devices.bssc.BioSAXSSampleChanger")[0]
        self.tfg = finder.listAllLocalObjects("gda.device.Timer")[0]
        self.jsf = JythonServerFacade.getInstance()
        self.detector = finder.listAllLocalObjects("uk.ac.gda.server.ncd.detectorsystem.NcdDetectorSystem")[0]
        self.shutter = find("shutter")
        self.bsscscannable = find("bsscscannable")
        self.processing = find("bssc_proc")
        #self.energy = float(find("dcm_energy").getPosition())
        self.sampleConcentration = find("sample_concentration")
        self.sampleName = find("samplename")
        self.sample_type = find('sample_type')
        self.sample_environment = find('sample_environment')
        self.experiment_definition = gdaserver.experiment_definition
        self.metashop = gdaserver.metashop
        self.meta = GDAMetadataProvider.getInstance()

        #need to remove hardcoding
        find("sample_thickness").asynchronousMoveTo(1.6)

        self.progresscounter = 0
        self.overheadsteps = 5
        self.stepspersample = 8

        if self.simulate:
            print "running in simulation mode"
            self.scannables = [self.detector, self.bsscscannable]
        else:
            self.cam = gda.factory.Finder.getInstance().find("bsaxscam")
            self.scannables = [self.detector, self.bsscscannable, self.cam]

        currentVisit = GDAMetadataProvider.getInstance().getMetadataValue("visit")
        self.totalSteps = self.overheadsteps + self.bean.getMeasurements().size() * self.stepspersample
Beispiel #18
0
    def getPosition(self):
        '''If scan is running then pauses until status is okay and returning False
		if the scan was not okay. If scan is not running, return the current state
		and print a warning that the scan is not being paused.'''

        self.statusRemainedGoodSinceLastGetPosition = 1.0

        if JythonServerFacade.getInstance().getScanStatus() == RUNNING:
            # loop until okay
            while not self.getStatusAndReport():
                # not okay
                self.statusRemainedGoodSinceLastGetPosition = 0.0
                sleep(self.secondsBetweenChecks)
            # now okay
        else:  # scan not running
            currentStatus = self.getStatus()
            if not currentStatus:  # bad
                print "WaitBelowAndShutter not holding readback as no scan is running"
            self.statusRemainedGoodSinceLastGetPosition = currentStatus

        return self.statusRemainedGoodSinceLastGetPosition
Beispiel #19
0
 def run(self):
     #	print "Thread: " + self.getName() + " started"
     while (self.runThread):
         if (JythonServerFacade.getInstance().getScanStatus()
                 == JythonStatus.RUNNING
                 and self.currenttemp >= float(MAXTEMP)):
             JythonServerFacade.getInstance().pauseCurrentScan()
             print "Scan paused as temperature " + self.getName(
             ) + " returns: " + str(self.currenttemp)
         elif (JythonServerFacade.getInstance().getScanStatus()
               == JythonStatus.PAUSED
               and self.currenttemp <= float(MINTEMP)):
             print "Scan resumed as temperature " + self.getName(
             ) + " returns: " + str(self.currenttemp)
             JythonServerFacade.getInstance().resumeCurrentScan()
         sleep(10)
Beispiel #20
0
 def __init__(self, filename):
     self.__version__ = '1.00'
     self.hplcFile = filename
     self.bean = HplcSessionBean.createFromXML(filename)
     finder = gda.factory.Finder.getInstance()
     find = finder.find
     self.shutter = find('shutter')
     self.bsdiode = find('bsdiode')
     self.sample_type = find('sample_type')
     self.sampleName = find("samplename")
     self.environment = find("sample_environment")
     self.tfg = finder.listAllLocalObjects("gda.device.Timer")[0]
     self.ncddetectors = finder.listAllLocalObjects("uk.ac.gda.server.ncd.detectorsystem.NcdDetectorSystem")[0]
     self.jsf = JythonServerFacade.getInstance()
     self.readout_time = 0.1
     #CREATE A LOGGER
     self.logger = logging.getLogger('HPLC')
     self.logger.setLevel(logging.INFO)
     formatter = logging.Formatter('%(asctime)s: %(levelname)s: %(module)s: %(message)s',"[%Y-%m-%d %H:%M:%S]")
     streamhandler = logging.StreamHandler()
     streamhandler.setFormatter(formatter)
     if len(self.logger.handlers) == 0:
         self.logger.addHandler(streamhandler)
     self.logger.info('HPLC class version '+self.__version__+' was instantiated')
Beispiel #21
0
 def getPosition(self):
     '''If scan is running then pauses until status is okay and returning False
     if the scan was not okay. If scan is not running, return the current state
     and print a warning that the scan is not being paused.
     This only works if scan is not continuous.
     '''
     self.statusRemainedGoodSinceLastGetPosition = 1.0
     
     if not self._operating_continuously:
         if JythonServerFacade.getInstance().getScanStatus()==RUNNING:
             # loop until okay
             while not self._getStatusAndHandleChange():  
                 # not okay
                 self.statusRemainedGoodSinceLastGetPosition = 0.0
                 sleep(self.secondsBetweenChecks)
                 self._collectNewMonitorValue()  
             # now okay
         else: # scan not running
             currentStatus = self._getStatus()
             if not currentStatus: # bad
                 print self.name + " not holding read-back as no scan is running"
             self.statusRemainedGoodSinceLastGetPosition = currentStatus
     
     return self.statusRemainedGoodSinceLastGetPosition
Beispiel #22
0
will automatically be translated through this pre-processing step.

There are problems to this preprocessor approach.  The main one is debugging. 
All python sees is the pre-processed file, so if you have performed significant translation,
this may be very different from your source text.

Created on 16 Nov 2009

@author: fy65
'''
import tokenize
from gda.jython import JythonServerFacade
#from java.util import Vector

jsf=JythonServerFacade.getInstance()

gdaAlias = jsf.getAliasedCommands()
gdaAliasVararg = jsf.getAliasedVarargCommands().getAliasedCommands()

def translate(readline):
    '''
    translate GDA specific commands, i.e. alias, to true Jython syntax.
    '''
    firstInLoop = True
    aliased = False
    vararg_aliased = False
    for type, name, _,_,_  in tokenize.generate_tokens(readline):
        # convert to GDA commands to Jython functions 
        if type==tokenize.NAME:
            if gdaAlias.contains(name):
Beispiel #23
0
 def getLastScanPoint(self):
     #jsf=InterfaceProvider.getJythonNamespace()
     jsf = JythonServerFacade.getInstance()
     lsdp = jsf.getLastScanDataPoint()
     return lsdp
Beispiel #24
0
    def __call__(self):
        jsf = JythonServerFacade.getInstance()
        for command in self.commands:

            jsf.runCommand(command)
            time.sleep(self.delay)
Beispiel #25
0
will automatically be translated through this pre-processing step.

There are problems to this preprocessor approach.  The main one is debugging. 
All python sees is the pre-processed file, so if you have performed significant translation,
this may be very different from your source text.

Created on 16 Nov 2009

@author: fy65
'''
import tokenize
from gda.jython import JythonServerFacade
#from java.util import Vector

jsf = JythonServerFacade.getInstance()

gdaAlias = jsf.getAliasedCommands()
gdaAliasVararg = jsf.getAliasedVarargCommands().getAliasedCommands()


def translate(readline):
    '''
    translate GDA specific commands, i.e. alias, to true Jython syntax.
    '''
    firstInLoop = True
    aliased = False
    vararg_aliased = False
    for type, name, _, _, _ in tokenize.generate_tokens(readline):
        # convert to GDA commands to Jython functions
        if type == tokenize.NAME:
Beispiel #26
0
 def go(self):
     psc = self.makePathScan()
     JythonServerFacade.getInstance().runCommand(psc)