def main(channelname = None): app = QApplication(sys.argv) app.setOrganizationName("NSLS II") app.setOrganizationDomain("BNL") app.setApplicationName("MASAR Viewer") if channelname: form = masarUI(channelname=channelname) else: form = masarUI() form.show() app.exec_() import atexit # clean Python local objects first, especially the cothread stuff. # Cothread adds a new function in catools._catools_atexit(), ca_flush_io(), since version 2.8 # to flush all io and do a clean up. This function registered at Python exit, and will be called # by Python exit handler. # This forces the clean up has be done before calling epicsExit(). atexit._run_exitfuncs() # it is safe to clean epics objects now. epicsExit() # call os.exit() instead of sys.exit() # os._exit(0) # however, os._exit() does nothing when exiting. # It would be better to call sys.exit sys.exit()
print '==== get live machine ====' for pv in pvlist: params[pv] = pv result = mc.getLiveMachine(params) return result if __name__ == "__main__": channel = 'masarService' mc = masarClient.client(channelname=channel) res1 = saveMasarSnapshot(mc) print res1 print "event id:", res1[0] print "value:", res1[2] res2 = retrieveMasarSnapshot(mc, res1[0]) #res2 = retrieveMasarSnapshot(mc, 17) print "name:", res2[0][-10:] print "value:", res2[1][-10:] pvlist = [ "masarExampleCharArray", "masarExampleFloatArray", "masarExampleShortArray", "masarExampleUCharArray" ] print "((pv name),(value),(isConnected),(secondsPastEpoch),(nanoSeconds),(timeStampTag),(alarmSeverity),(alarmStatus),(alarmMessage))" for i in range(len(pvlist)): print getLiveMachine(mc, pvlist[i:]) # Call this function before exit. sys.exit(epicsExit())
print '==== get live machine ====' for pv in pvlist: params[pv] = pv result = mc.getLiveMachine(params) return result if __name__ == "__main__": channel = 'masarService' mc = masarClient.client(channelname=channel) res1 = saveMasarSnapshot(mc) print res1 print "event id:", res1[0] print "value:", res1[2] res2 = retrieveMasarSnapshot(mc, res1[0]) #res2 = retrieveMasarSnapshot(mc, 17) print "name:", res2[0][-10:] print "value:", res2[1][-10:] pvlist = ["masarExampleCharArray", "masarExampleFloatArray", "masarExampleShortArray", "masarExampleUCharArray"] print "((pv name),(value),(isConnected),(secondsPastEpoch),(nanoSeconds),(timeStampTag),(alarmSeverity),(alarmStatus),(alarmMessage))" for i in range(len(pvlist)): print getLiveMachine(mc, pvlist[i:]) # Call this function before exit. sys.exit(epicsExit())