def readData(self, url): ws_lw_acquisition_controller = self.linac_wizard_document.getWS_LW_Controller() da = XmlDataAdaptor.adaptorForUrl(url,false) root_da = da.childAdaptor("LINAC_Wizard") title = root_da.stringValue("Title") seqNames = root_da.stringValue("AccSequence").split() if(len(seqNames) != 0): #------set up selected names in the SetUp tables linac_setup_controller = self.linac_wizard_document.getSetUp_Controller() linac_setup_controller.setSelectedSequences(seqNames[0],seqNames[len(seqNames)-1]) #----------------------------------------------- lst = ArrayList() for seqName in seqNames: lst.add(self.accl.getSequence(seqName)) accSeq = AcceleratorSeqCombo("SEQUENCE", lst) self.linac_wizard_document.ws_lw_controller.cleanOldWSdata() self.linac_wizard_document.setAccSeq(accSeq) nodes = accSeq.getAllNodes(true) name_to_node_dict = {} for node in nodes: name_to_node_dict[node.getId()] = node #-----add cavities to the nodes dictinary ------------ for cav in ws_lw_acquisition_controller.cavs: name_to_node_dict[cav.getId()] = cav #----read WS or LW wave_form data self.readData_WS_LW_Records(root_da,name_to_node_dict) #----read Initial Twiss and beam parameters self.readTransverseTwiss(root_da) #---- read SCL Phase Scan data self.linac_wizard_document.scl_long_tuneup_controller.clean() self.linac_wizard_document.scl_long_tuneup_controller.readDataFromXML(root_da) self.linac_wizard_document.scl_long_tuneup_controller.updateAllTables()
class MEBT_Main_Orbit_Diff_Controller: def __init__(self,top_document,accl): #--- top_document is a parent document for all controllers self.top_document = top_document self.main_panel = JPanel(BorderLayout()) #----etched border etched_border = BorderFactory.createEtchedBorder() #---- set up accSeq self.accSeq = null seq_names = ["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6"] lst = ArrayList() for seqName in seq_names: lst.add(accl.getSequence(seqName)) self.accSeq = AcceleratorSeqCombo("SEQUENCE", lst) #---- setup magnets nodes = self.accSeq.getAllNodes() self.quad_wrappers = [] self.perm_quads_wrappers = [] self.dc_wrappers = [] for node in nodes: pos = self.accSeq.getPosition(node) if(node.isMagnet()): if(node.isPermanent()): self.perm_quads_wrappers.append(Magnet_Wrapper(node,pos)) else: if(node.isCorrector()): self.dc_wrappers.append(Magnet_Wrapper(node,pos)) else: self.quad_wrappers.append(Magnet_Wrapper(node,pos)) #---- cavs rf_gaps = self.accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(RfGap.s_strType))) self.cav_wrappers = [] self.mebt_cav_wrappers = [] cavs = [] for rf_gap in rf_gaps: cav = rf_gap.getParent() pos = self.accSeq.getPosition(cav) if((cav not in cavs) and cav.getId().find("DTL") >= 0): cavs.append(cav) self.cav_wrappers.append(Cavity_Wrapper(cav,pos)) if((cav not in cavs) and cav.getId().find("MEBT") >= 0): cavs.append(cav) self.mebt_cav_wrappers.append(Cavity_Wrapper(cav,pos)) #---- BPMs self.bpm_wrappers = [] bpms = self.accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(BPM.s_strType))) for bpm in bpms: pos = self.accSeq.getPosition(bpm) bpm_wrapper = BPM_Wrapper(bpm,pos) if(bpm_wrapper.bpm.getId().find("DTL") >= 0): bpm_wrapper.use = false self.bpm_wrappers.append(bpm_wrapper) #---- debug print """ for quad_wrapper in self.quad_wrappers: print "debug quad=",quad_wrapper.magnet.getId() for perm_quad_wrapper in self.perm_quads_wrappers: print "debug perm quad=",perm_quad_wrapper.magnet.getId() for dc_wrapper in self.dc_wrappers: print "debug dc=",dc_wrapper.magnet.getId() for cav_wrapper in self.cav_wrappers: print "debug cav=",cav_wrapper.cav.getId() for bpm_wrapper in self.bpm_wrappers: print "debug bpm=",bpm_wrapper.bpm.getId() """ #---- Panels setup self.magnet_and_bpm_panel = Magnet_and_BPM_Panel(self) self.correction_coeffs_panel = Correction_Coeffs_Panel(self) self.orbit_diff_graphs_panel = Orbit_Diff_Graphs_Panel(self) self.orbit_measurer_cotroller_panel = Orbit_Measurer_Controller_Panel(self) #---- Auxiliaries setup self.orbit_measurer = Orbit_Measurer(self) self.measure_running = false #--------------------------------------------- tmp0_panel = JPanel(BorderLayout()) tmp0_panel.add(self.orbit_diff_graphs_panel,BorderLayout.CENTER) tmp0_panel.add(self.orbit_measurer_cotroller_panel,BorderLayout.SOUTH) tmp0_panel.add(self.correction_coeffs_panel,BorderLayout.NORTH) self.main_panel.add(self.magnet_and_bpm_panel,BorderLayout.WEST) self.main_panel.add(tmp0_panel,BorderLayout.CENTER) def getMainPanel(self): return self.main_panel