def connect(self,PondPort): try: pyport.open(int(PondPort),9600); except: print 'unable to open com %s, baud %s. quitting.' % (PondPort, 9600); return 0; rtn = a_pond.sp.XferAndWait('?','Thermal Conditioner\r\n\r\n') print rtn if not rtn.lower().count('pond'): print 'failed to start communication with the pond.' a_pond.stop() return 0 return 1
def Pond_Stop_Button_Click(self, event): global GetTempThreadPause, GetTempThreadStop, CycleThreadStop; #have to define GetTempThreadPause to be a global variable so it can be passed to GetTempThread func GetTempThreadPause = True; GetTempThreadStop = True CycleThreadStop = True; #print ThreadCompletyStop; count = 0; text = "."; print "Thread is closing", while(ThreadCompletyStop == False): if((count%20000)==1): print text,; count = count + 1; print "\n" + str(count) + "\n"; a_pond.stop() if(WMI_Flag): print "Found WMI" if(self.Pond_Start_Button.IsEnabled()): print "Auto" self.Start_Button_Status = "Auto Connect"; self.Start_Button_StatusCheck(); self.Pond_ManualStart_Button.Enable(); self.InputCOMPort_Text.Enable(); else: print "Manual" self.ManualStart_Button_Status = "Connect to COM"; self.ManualStart_Button_StatusCheck(); self.Pond_Start_Button.Enable(); self.InputCOMPort_Text.Enable(); else: print "Manual" self.ManualStart_Button_Status = "Connect to COM"; self.ManualStart_Button_StatusCheck(); self.Pond_GoToTemp_Button.Disable(); self.Pond_StartCycle_Button.Disable(); self.Pond_SaveSetting_Button.Disable(); Status = "Disconnected"; self.Log += Status + "\n"; self.Log_Text.SetValue(self.Log)