aux_program_loader.py
1 import hal 2 import os 3 import subprocess 4 5 # path to TCL for external programs eg. halshow 6 try: 7 TCLPATH = os.environ['LINUXCNC_TCL_DIR'] 8 INIPATH = os.environ.get('INI_FILE_NAME', '/dev/null') 9 except: 10 pass 11 12 class Aux_program_loader: 13 def _init_(self): 14 pass 15 16 # check for classicladder realtime if so load the user GUI 17 def load_ladder(self,*args): 18 if hal.component_exists('classicladder_rt'): 19 p = os.popen("classicladder &","w") 20 21 # opens halshow 22 def load_halshow(self,*args): 23 print "halshow",TCLPATH 24 p = os.popen("tclsh %s/bin/halshow.tcl &" % (TCLPATH)) 25 26 # opens the calibration program 27 def load_calibration(self): 28 print "calibration --%s"% INIPATH 29 p = os.popen("tclsh %s/bin/emccalib.tcl -- -ini %s > /dev/null &" % (TCLPATH, INIPATH), "w") 30 31 # opens the linuxcnc status program 32 def load_status(self,*args): 33 p = os.popen("linuxcnctop > /dev/null &","w") 34 35 # opens a halmeter 36 def load_halmeter(self,*args): 37 print "halmeter" 38 p = os.popen("halmeter &") 39 40 # opens the halscope 41 def load_halscope(self,*args): 42 p = os.popen("halscope > /dev/null &","w") 43 44 # open linuxcnc standard tool edit program 45 def load_tooledit(self, filepath): 46 p = os.popen("tooledit %s" % (filepath)) 47 48 def keyboard_onboard(self,args="",width="",height=""): 49 try: 50 self.ob = subprocess.Popen(["onboard",args,width,height], 51 stdin=subprocess.PIPE, 52 stdout=subprocess.PIPE, 53 close_fds=True) 54 if 'xid' in args: 55 idnum = self.ob.stdout.readline() 56 return idnum 57 else: 58 return True 59 except: 60 print 'Onboard keyboard could not be loaded by aux_program_loader' 61 return False 62