def rawAsynchronousMoveTo(self, mode): if mode not in SourceMode.SOURCE_MODES: print "mode string is wrong: legal values are %s" % ( SourceMode.SOURCE_MODES) return self.amIBusy = True # need to block to ensure script run complete before any other actions if mode == SourceMode.SOURCE_MODES[0]: GeneralCommands.run(self.remove_zacscan_script) sleep(1) if installation.isLive(): GeneralCommands.run(self.idd_fast_energy_scan_script) else: print("zacscan is not available in DUMMY mode") elif mode == SourceMode.SOURCE_MODES[1]: GeneralCommands.run(self.remove_zacscan_script) sleep(1) if installation.isLive(): GeneralCommands.run(self.idu_fast_energy_scan_script) else: print("zacscan is not available in DUMMY mode") elif mode == SourceMode.SOURCE_MODES[ 2] or mode == SourceMode.SOURCE_MODES[3]: GeneralCommands.run(self.remove_zacscan_script) sleep(1) else: print "Input mode is wrong: legal values %s or [SourceModeScannable.idd, SourceModeScannable.idu, SourceModeScannable.dpu, SourceModeScannable.dmu]." % ( SourceMode.SOURCE_MODES) self.mode = SourceMode.SOURCE_MODES[4] raise ValueError("Input mode %s is not supported." % (str(mode))) self.mode = mode self.amIBusy = False
def __init__(self, name, defaultmode='unknown'): ''' Constructor - default source mode is 'idd' ''' self.setName(name) self.amIBusy = False self.mode = defaultmode self.idd_fast_energy_scan_script = str( gda_git_loc + "/gda-diamond.git/configurations/i06-shared/scripts/i06shared/scan/idd_fast_energy_scan.py" ) self.idu_fast_energy_scan_script = str( gda_git_loc + "/gda-diamond.git/configurations/i06-shared/scripts/i06shared/scan/idu_fast_energy_scan.py" ) self.remove_zacscan_script = str( gda_git_loc + "/gda-diamond.git/configurations/i06-shared/scripts/i06shared/scan/remove_zacscan.py" ) if installation.isLive(): GeneralCommands.run(self.idd_fast_energy_scan_script)