Пример #1
0
	def start_Event(self, event, app):
		'''Start an App'''
		if not(self.processes[app]['running']):
			print 'Starting ' + str(app) + '...'
			# Start the subprocess
			if app == 'IOC':
				CCD = self.ModelBox.GetValue()
				BitDepth = self.BitDepthBox.GetValue()
				if len(CCD)>0 and len(BitDepth)>0:	
				# Start the IOC
			
					# Start the subprocess
					tempFile = [self.processes['IOC']['file'], str(CCD) + "-" + str(BitDepth)]
					self.IOCsubprocess = subprocess.Popen(tempFile, preexec_fn=os.setsid)

					# Grab the subprocess I.D.
					self.processes['IOC']['pid'] = DPOStools.waitforprocess(self.processes['IOC']['search'])
					self.processes['IOC']['running'] = True
					self.button_status(app, 'on')
					print 'process id ' + str(app) + ' = ' + str(self.processes[app]['pid'])
			else:
			
				subprocess.Popen(self.processes[app]['file'], preexec_fn=os.setsid)
			
				# Grab the subprocess I.D.
				self.processes[app]['pid'] = DPOStools.waitforprocess(self.processes[app]['search'])
				self.processes[app]['running']=True
				# Set the button state
				self.button_status(app, 'on')
				print 'process id ' + str(app) + ' = ' + str(self.processes[app]['pid'])
		else:
			print str(app)+' already running!'
Пример #2
0
    def start_Event(self, event, app):
        """Start an App"""
        if not (self.processes[app]["running"]):
            print "Starting " + str(app) + "..."
            # Start the subprocess
            if app == "IOC":
                CCD = self.ModelBox.GetValue()
                BitDepth = self.BitDepthBox.GetValue()
                if len(CCD) > 0 and len(BitDepth) > 0:
                    # Start the IOC

                    # Start the subprocess
                    tempFile = [self.processes["IOC"]["file"], str(CCD) + "-" + str(BitDepth)]
                    self.IOCsubprocess = subprocess.Popen(tempFile, preexec_fn=os.setsid)

                    # Grab the subprocess I.D.
                    self.processes["IOC"]["pid"] = DPOStools.waitforprocess(self.processes["IOC"]["search"])
                    self.processes["IOC"]["running"] = True
                    self.button_status(app, "on")
                    print "process id " + str(app) + " = " + str(self.processes[app]["pid"])
            else:

                subprocess.Popen(self.processes[app]["file"], preexec_fn=os.setsid)

                # Grab the subprocess I.D.
                self.processes[app]["pid"] = DPOStools.waitforprocess(self.processes[app]["search"])
                self.processes[app]["running"] = True
                # Set the button state
                self.button_status(app, "on")
                print "process id " + str(app) + " = " + str(self.processes[app]["pid"])
        else:
            print str(app) + " already running!"
Пример #3
0
	def start_medm_Event(self, event):
		# Put the terminal command into a tuple

		if not(self.processes['MEDM']['running']):
			
			#stop other threads
			startMEDM=threading.Condition()
			startMEDM.acquire()
			
			tempCommand = ['/local/DPbin/Scripts/start_medm_coolsnap', pv_Prefix]
			
			# Start the subprocess
			subprocess.Popen(tempCommand,  preexec_fn=os.setsid)
			# Grab the subprocess I.D.
			self.processes['MEDM']['pid'] = DPOStools.waitforprocess("medm -x -macro P="+pv_Prefix)
			self.processes['MEDM']['running']=True
			#print self.pid_medm
			print "\nOpening MEDM..."
			#print "Process i.d. = " + str(self.pid_medm)
			# Set the Button Colour
			self.medm_alive()
			startMEDM.release()
			
		else:
			print "\nMEDM already running!"
Пример #4
0
	def start_ioc_Event(self, event):
		
		# Put the terminal command into a tuple (start_ioc, detector)
		
		if not(self.processes['IOC']['running']):
			
			#Have the psthread wait
			startIOC=threading.Condition()
			startIOC.acquire()
			# Start the subprocess
			subprocess.Popen(['/local/DPbin/Scripts/start_ioc', detector],  preexec_fn=os.setsid)
			# Grab the subprocess I.D.
			self.processes['IOC']['pid'] = DPOStools.waitforprocess(binary)
			self.processes['IOC']['running']=True
		
			print "\nOpening IOC..."
		
			# Set the Button Colour
			self.ioc_alive() 
			startIOC.release()
			self.SetWindowStyleFlag(wx.STAY_ON_TOP)
			self.SetWindowStyle(not(wx.STAY_ON_TOP))
			
			# Initialize camera in pvCam IOC
			epics.caput((pv_Prefix + ':cam1:Initialize'),1)
			
		else:
			print "\nIOC already running!"
Пример #5
0
	def start_Event(self, event, app):
		'''Start an App'''
		if not(self.processes[app]['running']):
			print 'Starting ' + str(app) + '...'
			# Start the subprocess
			tempCommand = self.processes[app]['file']
			
			if app=='MarDTB':
				Scanner = self.scannerBox.GetValue()
				if len(Scanner)>0:
					tempCommand = [self.processes['MarDTB']['file'], str(Scanner)]
				
					# Start the subprocess
					subprocess.Popen(tempCommand, preexec_fn=os.setsid)
					
			else:
				subprocess.Popen(tempCommand, preexec_fn=os.setsid)
			
			# Grab the subprocess I.D.
			self.processes[app]['pid'] = DPOStools.waitforprocess(self.processes[app]['search'])
			self.processes[app]['running']=True
			
			# Set the button state
			self.button_status(app, 'on')
			print 'process id ' + str(app) + ' = ' + str(self.processes[app]['pid'])
			
		else:
			print str(app)+' already running!'
Пример #6
0
    def start_Event(self, event, app):
        '''Start an App'''
        if not (self.processes[app]['running']):
            print 'Starting ' + str(app) + '...'

            # Start the subprocess
            tempCommand = self.processes[app]['file']
            if app == 'MEDM' or app == 'IMAGEJ':
                subprocess.Popen([tempCommand, pv_Prefix],
                                 preexec_fn=os.setsid)
            else:
                subprocess.Popen(tempCommand, preexec_fn=os.setsid)

            # Get the subprocess ID
            self.processes[app]['pid'] = DPOStools.waitforprocess(
                self.processes[app]['search'])
            self.processes[app]['running'] = True

            # Set the button state
            self.button_status(app, 'on')
            print 'process id ' + str(app) + ' = ' + str(
                self.processes[app]['pid'])

        else:
            print str(app) + ' already running!'
Пример #7
0
	def start_Event(self, event, app):
		'''Start an App'''
		if not(self.processes[app]['running']):
			print 'Starting ' + str(app) + '...'
			# Start the subprocess
			tempCommand = self.processes[app]['file']
			
			if app=='IOC':
				SaturnBoxChoice = self.saturn_entry.GetValue()
				tempFile = [self.processes['IOC']['file'], 'vortex' + '-' + str(SaturnBoxChoice)]
				subprocess.Popen(tempFile, preexec_fn=os.setsid)
					
			else:
				subprocess.Popen(tempCommand, preexec_fn=os.setsid)
			
			# Grab the subprocess I.D.
			self.processes[app]['pid'] = DPOStools.waitforprocess(self.processes[app]['search'])
			self.processes[app]['running']=True
			
			# Set the button state
			self.button_status(app, 'on')
			print 'process id ' + str(app) + ' = ' + str(self.processes[app]['pid'])
			
		else:
			print str(app)+' already running!'
Пример #8
0
	def start_imagej_Event(self, event):
		# Put the terminal command into a tuple
			
		
		# Start the subprocess	
		tempCommand = ['/local/DPbin/Scripts/start_imageJ', pv_Prefix]
		
		p_imagej = subprocess.Popen(tempCommand, preexec_fn=os.setsid)
		# Grab the subprocess I.D.
		self.pid_imagej = self.processes['ImageJ']['pid'] = DPOStools.waitforprocess("EPICS AD Viewer")
		print "\nOpen ImageJ..."
		#print "Process i.d. = " + str(self.pid_imagej)
		# Set the Button Colour
		self.new_alive(self.start_imagej_Btn)
Пример #9
0
	def start_Event(self, event, app):
		'''Start an App'''
		if not(self.processes[app]['running']):
			print 'Starting ' + str(app) + '...'
			
			# Start the subprocess
			subprocess.Popen(self.processes[app]['file'], preexec_fn=os.setsid)
			
			# Grab the subprocess I.D.
			self.processes[app]['pid'] = DPOStools.waitforprocess(self.processes[app]['search'])
			self.processes[app]['running']=True
			
			# Set the button state
			self.button_status(app, 'on')
			print 'process id ' + str(app) + ' = ' + str(self.processes[app]['pid'])
		else:
			print str(app)+' already running!'
Пример #10
0
	def start_ioc_Event(self, event):
		'''Start the IOC'''
		if not(self.processes['IOC']['running']):
			print "Starting IOC..."

			# Start the subprocess
			tempFile = self.processes['IOC']['file']
			self.IOCsubprocess = subprocess.Popen(tempFile, preexec_fn=os.setsid)

			# Grab the subprocess I.D.
			self.processes['IOC']['pid'] = DPOStools.waitforprocess(self.processes['IOC']['search'])
			self.processes['IOC']['running']=True
			
			# Set the Button Colour
			self.button_status('IOC', 'on')
		else:
			print "IOC already running!"
Пример #11
0
	def start_medm_Event(self, event):
		'''Start the MEDM'''
		if not(self.processes['MEDM']['running']):

			# Start the subprocess
			tempFile = self.processes['MEDM']['file']
			subprocess.Popen(tempFile, preexec_fn=os.setsid)

			# Grab the subprocess I.D.
			self.processes['MEDM']['pid'] = DPOStools.waitforprocess(self.processes['MEDM']['search'])
			self.processes['MEDM']['running']=True

			# Print self.pid_medm
			print "\nOpening MEDM..."

			# Set the Button Status
			self.button_status('MEDM', 'on')
		else:
			print "MEDM already running!"
Пример #12
0
    def start_Event(self, event, app):
        """Start an App"""
        if not (self.processes[app]["running"]):
            print "Starting " + str(app) + "..."
            # Start the subprocess
            tempCommand = self.processes[app]["file"]

            if app == "MEDM" or app == "IMAGEJ":
                subprocess.Popen([tempCommand, pv_Prefix], preexec_fn=os.setsid)
            else:
                subprocess.Popen(tempCommand, preexec_fn=os.setsid)

                # Grab the subprocess I.D.
            self.processes[app]["pid"] = DPOStools.waitforprocess(self.processes[app]["search"])
            self.processes[app]["running"] = True

            # Set the button state
            self.button_status(app, "on")
            print "process id " + str(app) + " = " + str(self.processes[app]["pid"])

        else:
            print str(app) + " already running!"