#! /usr/env/python #-------------------------------------------------------------------------------- """ Application: Dialog_Msg for DAQ_96_Gui COOR Message Dialog for the Graphical User Interface to the DAQ_96 Control Program """ #-------------------------------------------------------------------------------- #-------------------------------------------------------------------------------- import string from Tkinter import * import Pmw from MultiShell import updateComboBox from MultiShell import updateIntVar from Print_Utils import printLine from Itc_Coor_Client import coor_reply_timeout_sec #-------------------------------------------------------------------------------- #-------------------------------------------------------------------------------- class Dialog_Msg : MsgTemplStr=[[ "Configure all FPGAs", "Configure_FPGAs" ], [ "Initialize", "Initialize" ], [ "Exclude EM Twr", "L1CAL_Exclude EM_Tower TT_Eta( ) TT_Phi(

)" ], [ "Exclude HD Twr", "L1CAL_Exclude HD_Tower TT_Eta( ) TT_Phi(

)" ], [ "", "" ] ] def __init__ ( self, MShell, FrameNum ) : self.MShell = MShell self.MsgFrame = FrameNum # printLine ( "Dialog", 'Frame #%d is "%s"' % ( FrameNum, MShell.frameName[FrameNum] ) ) #-------------------------------------------------------------------------------- def createInterface(self): MShell = self.MShell MShell.addFieldLabel ( nFrame = self.MsgFrame, labelName = 'Access: Send Simulated COOR Messages', column = 1, columnspan = 3, width = 35, row = MShell.nextFieldRow() ) MShell.addFieldLabel ( nFrame = self.MsgFrame, labelName = "Msg Template", column = 1, row = MShell.nextFieldRow() ) MsgTemplateFrame = \ MShell.addFieldFrame ( nFrame = self.MsgFrame, labelName = "Template for COOR Msg", column = 2, columnspan = 5, row = MShell.currentFieldRow() ) self.MsgTemplateNum_var = IntVar() self.MsgTemplateNum_var.set(0) for TemplateNum in range (len(self.MsgTemplStr)) : if ( self.MsgTemplStr[TemplateNum][0] != "" ) : MShell.addFieldRadioB ( frame = MsgTemplateFrame, labelName = self.MsgTemplStr[TemplateNum][0], value = TemplateNum, column = TemplateNum % 2, row = TemplateNum / 2, gridPady = 0, font = ('Verdana',7), variable = self.MsgTemplateNum_var, command = lambda t=TemplateNum : updateComboBox ( self.MsgCoor_box, self.MsgTemplStr[t][1] ) ) self.MsgCoor_box = \ MShell.addFieldCombo ( nFrame = self.MsgFrame, labelName ="COOR Msg", helpMessage ="COOR Message", statusMessage="COOR Message", initValue ="Pick a template above", font = ('Verdana',7), columnspan = 2, width = 43 ) MShell.addFieldButton ( nFrame = self.MsgFrame, labelName = 'Send Request', helpMessage = 'Send Request', statusMessage= 'Send Request', column = 2, gridSticky = W, row = MShell.nextFieldRow(), command = self.Msg_Send_COOR_Msg ) MShell.addFieldButton ( nFrame = self.MsgFrame, labelName = 'Expert Msg...', helpMessage = 'Send TrgMgr Expert Messages', statusMessage= 'Send TrgMgr Expert Messages', column = 3, row = MShell.currentFieldRow(), command = lambda: MShell.selectFrame(MShell.MgrFrame) ) self.MsgReply_box = \ MShell.addFieldEntry ( nFrame = self.MsgFrame, labelName ="Reply", helpMessage ="Reply", statusMessage="Reply", initValue ="-", bg = 'gray80', columnspan = 2, font = ('Verdana',7), width = 43 ) #-------------------------------------------------------------------------------- def Msg_Send_COOR_Msg ( self, CoorMsg = None, TimeOut_sec = coor_reply_timeout_sec, Comment = None ) : updateComboBox ( self.MsgCoor_box, CoorMsg ) CoorMsg_str = self.MsgCoor_box.get() if ( CoorMsg_str == "Initialize" ) : if ( self.MShell.confirm( "Initialize DAQ96" ) != TRUE ) : return "cancel" reply = self.MShell.coor_client.sendCoorMsg ( CoorMsg_str, TimeOut_sec ) self.MsgReply_box.setentry( string.split( reply, ' ', 1 )[1] ) return reply