def create_display(self): top = myTkTop.myTkTop() top.title('scanDisplay') self.widgets.top = top frame = Frame(top, borderwidth=1, relief='raised') frame.pack(fill=X) mb = Pmw.MenuBar(frame) mb.pack(fill=X) mb.addmenu('File', '', side='left') self.widgets.file = mb.component('File-menu') mb.addmenuitem('File', 'command', label='Scan record...', command=self.open_scan) mb.addmenuitem('File', 'command', label='Read file...', command=self.menu_open_file) mb.addmenuitem('File', 'command', label='Save Next = ' + self.file.next_filename, command=self.menu_save_next) mb.addmenuitem('File', 'command', label='Save As...', command=self.menu_save_as) mb.addmenuitem('File', 'command', label='Print setup...', command=self.menu_print_setup) mb.addmenuitem('File', 'command', label='Print...', command=self.menu_print) mb.addmenuitem('File', 'command', label='Preferences...', command=self.menu_preferences) mb.addmenuitem('File', 'command', label='Save settings...', command=self.menu_save_settings) mb.addmenuitem('File', 'command', label='Restore settings...', command=self.menu_restore_settings) mb.addmenuitem('File', 'command', 'Exit', label='Exit', command=self.menu_exit) mb.addmenu('Help', '', side='right') self.widgets.help = mb.component('Help-menu') mb.addmenuitem('Help', 'command', label='Usage', command=self.help) mb.addmenuitem('Help', 'command', label='About', command=self.about) mb.addmenu('View', '', side='left') self.widgets.display = mb.component('View-menu') mb.addmenuitem('View', 'command', label='Plot...', command=self.menu_plot) mb.addcascademenu('View', 'Preferences') mb.addmenuitem('Preferences', 'command', label='Update time...', command=self.update_time) mb.addmenuitem('Preferences', 'command', label='Plot...', command=lambda s=self: BltPlot.BltConfigureGraph(s.widgets.plot)) mb.addmenuitem('Preferences', 'command', label='Foreground plot...', command=lambda s=self: BltPlot.BltConfigureElement(s.widgets.plot, 'foreground')) mb.addmenuitem('Preferences', 'command', label='Background plot...', command=lambda s=self: BltPlot.BltConfigureElement(s.widgets.plot, 'background')) mb.addmenuitem('Preferences', 'command', label='X axis...', command=lambda s=self: BltPlot.BltConfigureAxis( s.widgets.plot, 'x', command=s.xaxis_callback)) mb.addmenuitem('Preferences', 'command', label='Y axis...', command=lambda s=self: BltPlot.BltConfigureAxis( s.widgets.plot, 'y', command=s.yaxis_callback)) mb.addmenuitem('Preferences', 'command', label='Grid...', command=lambda s=self: BltPlot.BltConfigureGrid(s.widgets.plot)) mb.addmenuitem('Preferences', 'command', label='Legend', command=lambda s=self: BltPlot.BltConfigureLegend(s.widgets.plot)) control_column = Frame(top) control_column.pack(side=LEFT, anchor=N) data_column = Frame(top, borderwidth=1, relief='raised') data_column.pack(side=LEFT, expand=YES, fill=BOTH) # Define padding fypad = 2 # pady for frames acquire = Frame(control_column, borderwidth=1, relief='solid') acquire.pack(fill=X, pady=fypad) t = Label(acquire, text='Acquisition'); t.pack() row = Frame(acquire); row.pack() self.widgets.start = t = Button(row, text="Start", command=self.menu_start) t.pack(side=LEFT) self.widgets.stop = t = Button(row, text="Stop", command=self.menu_stop) t.pack(side=LEFT) row = Frame(acquire); row.pack() self.widgets.erase = t = Button(row, text="Pause", command=self.menu_pause) t.pack(side=LEFT) self.widgets.erase = t = Button(row, text="Resume", command=self.menu_resume) t.pack(side=LEFT) status = Frame(control_column, borderwidth=1, relief='solid') status.pack(fill=X, pady=fypad) t = Label(status, text='Current point:', width=15); t.pack(side=TOP) self.widgets.current_point = t = Label(status, width=8, relief='groove', text='0', foreground=self.colors.label_foreground, background=self.colors.label_background) t.pack(side=TOP) t = Label(status, text='Status', width=5); t.pack(side=TOP) self.widgets.status = t = Label(status, width=8, relief='groove', text=' ', foreground=self.colors.label_foreground, background=self.colors.label_background) t.pack(side=TOP) display = Frame(control_column, borderwidth=1, relief='solid') display.pack(anchor=N, fill=X, pady=fypad) t = Label(display, text='Display'); t.pack() row = Frame(display); row.pack() self.widgets.zoom_down = t = Button(row, text= '<', padx='2m', command=self.menu_zoom_down) t.pack(side=LEFT) t = Label(row, text='Zoom', borderwidth=1, relief='solid', width=8) t.pack(side=LEFT) self.widgets.zoom_up = t = Button(row, text= '>', padx='2m', command=self.menu_zoom_up) t.pack(side=LEFT) row = Frame(display); row.pack() self.widgets.shift_down = t = Button(row, text= '<', padx='2m', command=self.menu_shift_down) t.pack(side=LEFT) t = Label(row, text='Shift', borderwidth=1, relief='solid', width=8) t.pack(side=LEFT) self.widgets.shift_up = t = Button(row, text= '>', padx='2m', command=self.menu_shift_up) t.pack(side=LEFT) self.widgets.lin_log = t = Pmw.OptionMenu(display, labelpos=N, label_text='Vertical Scale', items=('Linear','Logarithmic'), initialitem = self.display.vlog, command=self.menu_lin_log) t.pack() self.widgets.plot = t = Pmw.Blt.Graph(data_column) t.configure(plotbackground=self.colors.background) t.line_create('foreground', symbol="", pixels=2, color=self.colors.plot) t.pack(side=TOP, anchor=N, expand=YES, fill=BOTH) self.set_marker_colors()
def __init__(self, detector='13GE1:med:', element=1): class widgets: pass self.widgets = widgets() self.detector = detector self.element = element self.status = 'Ready' self.path = '.' self.file = 'test.xrf' self.next_file = self.file self.pvs = {} self.pvs['ElapsedReal'] = epicsPV.epicsPV(detector + 'ElapsedReal', wait=0) self.pvs['PresetReal'] = epicsPV.epicsPV(detector + 'PresetReal', wait=0) self.pvs['StartAll'] = epicsPV.epicsPV(detector + 'StartAll', wait=0) self.pvs['StopAll'] = epicsPV.epicsPV(detector + 'StopAll', wait=0) self.pvs['EraseAll'] = epicsPV.epicsPV(detector + 'EraseAll', wait=0) self.pvs['EraseStart'] = epicsPV.epicsPV(detector + 'EraseStart', wait=0) self.pvs['Acquiring'] = epicsPV.epicsPV(detector + 'Acquiring', wait=0) self.pvs['mca1.ERTM'] = epicsPV.epicsPV(detector + 'mca1.ERTM', wait=0) self.pvs['mca1.ERTM'].pend_io() self.preset_real = self.pvs['PresetReal'].getw() self.elapsed_real = self.pvs['ElapsedReal'].getw() self.update_time = .5 # menus top = myTkTop.myTkTop() top.title('medDisplay') self.widgets.top = top frame = Frame(top, borderwidth=1, relief='raised') frame.pack(fill=X) mb = Pmw.MenuBar(frame) mb.pack(fill=X) mb.addmenu('File', '', side='left') self.widgets.file = mb.component('File-menu') mb.addmenuitem('File', 'command', label='Save As ...', command=self.menu_save) mb.addmenuitem('File', 'command', label='Save Next = ' + self.next_file, command=self.menu_save_next) mb.addmenuitem('File', 'command', label='New MCA Display', command=self.menu_new_display) mb.addmenuitem('File', 'command', 'Exit', label='Exit', command=self.menu_exit) mb.addmenu('Help', '', side='right') self.widgets.help = mb.component('Help-menu') mb.addmenuitem('Help', 'command', label='Usage', command=self.menu_help) mb.addmenuitem('Help', 'command', label='About', command=self.menu_about) mb.addmenu('Options', '', side='left') self.widgets.options = mb.component('Options-menu') self.erase_on_start = IntVar() self.erase_on_start.set(1) mb.addmenuitem('Options', 'checkbutton', label='Erase on Start', variable=self.erase_on_start) # main page main_frame = Frame(self.widgets.top) main_frame.pack() left_frame = Frame(main_frame, borderwidth=1, relief='solid') left_frame.pack(side=LEFT, anchor=N) self.widgets.left_frame = left_frame right_frame = Frame(main_frame, borderwidth=1, relief='solid') right_frame.pack(side=LEFT, anchor=N) self.widgets.right_frame = right_frame # Right Hand Side for control buttons row = Frame(right_frame) row.pack(side=TOP, anchor=W) t = Label(row, text='Preset Real Time (s):', width=22, anchor=E) t.pack(side=LEFT) self.widgets.preset_real = t = Pmw.EntryField( row, value=0, entry_width=9, entry_justify=CENTER, validate={'validator': 'real'}, entry_background='light blue', command=self.menu_preset_real) t.pack(side=LEFT) row = Frame(right_frame) row.pack(side=TOP, anchor=W) t = Label(row, text='Elapsed Real Time (s):', width=22, anchor=E) t.pack(side=LEFT) self.widgets.elapsed_real = t = Label(row, text=str(self.elapsed_real), foreground='blue') t.pack(side=LEFT) self.widgets.preset_real.setentry(self.preset_real) row = Frame(right_frame) row.pack(side=TOP) t = Button(row, text='Start', command=self.menu_start) t.pack(side=LEFT) t = Button(row, text='Stop', command=self.menu_stop) t.pack(side=LEFT) t = Button(row, text='Erase', command=self.menu_erase) t.pack(side=LEFT) row = Frame(right_frame) row.pack(side=TOP) t = Button(row, text='Copy ROIS', command=self.menu_copy_rois) t.pack(side=LEFT) row = Frame(right_frame) row.pack(side=TOP, anchor=W) t = Button(row, text='Save As ...', command=self.menu_save) t.pack(side=LEFT) self.widgets.save_next = t = Button(row, text='Save Next = ' + self.next_file, command=self.menu_save_next) t.pack(side=LEFT) # row = Frame(right_frame) row.pack(side=TOP, anchor=W) t = Label(row, text='Viewing Element: ') t.pack(side=LEFT) self.widgets.element = t = Label(row, text=str(self.element), width=2, foreground='blue') t.pack(side=LEFT) row = Frame(right_frame) row.pack(side=TOP, anchor=W) t = Label(row, text='Status: ') t.pack(side=LEFT) self.widgets.status = t = Label(row, text='Initializing...', foreground='blue') t.pack(side=LEFT) t.pack(side=RIGHT) # # Left Hand Side shows Detector Element Layout # t = Label(left_frame, text='Detector Elements') t.pack(side=TOP) width = 230 height = 230 area = Frame(left_frame, width=width, height=height) area.pack(side=TOP) self.widgets.area = area self.detector_positions = localMedLayout.localMedLayout() self.n_detectors = len(self.detector_positions) button_width = 1 button_height = 1 self.geom_state = 0 self.widgets.det_buttons = [] for d in range(self.n_detectors): t = Button(area, text=str(d + 1), width=button_width, height=button_height, command=lambda s=self, d=d: s.menu_element(d + 1)) self.widgets.det_buttons.append(t) self.layout_detector() # Finally, load real versions of the mca_display and EPICS_MED objects # This will take some time, so we start with 'Initializing ...' in the # status message self.widgets.elapsed_real.configure(text=' ') self.mcaDisplay = mcaDisplay.mcaDisplay() self.mca = self.detector + 'mca' + str(self.element) self.mcaDisplay.open_detector(self.mca) self.med = epicsMed.epicsMed(self.detector, n_detectors=self.n_detectors) # when objects are really created, report 'Ready'. self.widgets.status.configure(text='Ready') # Start the timer routine self.widgets.top.after(int(self.update_time * 1000), self.menu_timer)
def __init__(self, mca, fit=None, command=None): class widgets: pass self.results_file = 'fit_results.txt' self.spreadsheet_file = 'fit_spreadsheet.txt' self.mca = mca self.callback_command = command self.widgets = widgets() self.background_mca = copy.deepcopy(mca) self.fit_mca = copy.deepcopy(mca) self.mark_peaks_mca = copy.deepcopy(mca) data = self.background_mca.get_data() * 0 self.background_mca.set_data(data) self.fit_mca.set_data(data) self.mark_peaks_mca.set_data(data) self.index=0 if (fit == None): self.fit = Mca.McaFit(mca) else: self.fit = fit # Update the fit object to be consistent with the Mca self.fit.update(self.fit_mca) if (len(self.fit.peaks) == 0): self.fit.peaks=[Mca.McaPeak()] xsize=10 top = myTkTop.myTkTop() Pmw.initialise(top) top.title('Peak Fit') self.widgets.top = top frame = Frame(top, borderwidth=1, relief='raised') frame.pack(fill=X) mb = Pmw.MenuBar(frame) mb.pack(fill=X) mb.addmenu('File', '', side='left') self.widgets.file = mb.component('File-menu') mb.addmenuitem('File', 'command', label='Read peaks...', command=self.read_peak_file) mb.addmenuitem('File', 'command', label='Write peaks...', command=self.write_peak_file) mb.addmenuitem('File', 'command', label='Results file...', command=self.set_results_file) mb.addmenuitem('File', 'command', label='Spreadsheet file...', command=self.set_spreadsheet_file) mb.addmenuitem('File', 'command', 'Exit', label='Exit', command=self.menu_exit) t = Pmw.Group(top, tag_text='Background Parameters'); t.pack(fill=X) bcol = t.interior() row = Frame(bcol); row.pack(side=TOP) background = self.fit.background self.exponent_options = ('2','4','6') self.widgets.exponent = t = Pmw.OptionMenu(row, labelpos=N, label_text='Exponent', items=self.exponent_options, initialitem = str(background.exponent)) t.pack(side=LEFT) self.widgets.top_width = t = Pmw.EntryField(row, value=background.top_width, entry_width=8, entry_justify=CENTER, labelpos=N, label_text='Top width', validate={'validator':'real'}) t.pack(side=LEFT) self.widgets.bottom_width = t = Pmw.EntryField(row, value=background.bottom_width, entry_width=8, entry_justify=CENTER, labelpos=N, label_text='Bottom width', validate={'validator':'real'}) t.pack(side=LEFT) self.tangent_options = ('No', 'Yes') self.widgets.tangent = t = Pmw.OptionMenu(row, labelpos=N, label_text='Tangent?', items=self.tangent_options, menubutton_width=3, initialitem = background.tangent) t.pack(side=LEFT) self.compress_options = ('1', '2', '4', '8', '16') self.widgets.compress = t = Pmw.OptionMenu(row, labelpos=N, label_text='Compression', items=self.compress_options, menubutton_width=2, initialitem = str(background.compress)) t.pack(side=LEFT) row = Frame(bcol); row.pack(side=TOP) self.widgets.fit_background = t = Button(row, text='Fit background', command=self.fit_background) t.pack(side=LEFT) self.widgets.plot_background = t = Button(row, text='Re-plot background', command=self.plot_background) t.pack(side=LEFT) t = Pmw.Group(top, tag_text='Peak Fit Parameters'); t.pack(fill=X) fcol = t.interior() t = Pmw.Group(fcol, tag_text='Initial energy calibration'); t.pack(side=TOP) row = t.interior() self.widgets.energy_cal_offset = t = Pmw.EntryField(row, value=self.fit.initial_energy_offset, entry_width=10, entry_justify=CENTER, labelpos=W, label_text='Offset:', validate={'validator':'real'}) t.pack(side=LEFT) self.widgets.energy_cal_slope = t = Pmw.EntryField(row, value=self.fit.initial_energy_slope, entry_width=10, entry_justify=CENTER, labelpos=W, label_text='Slope:', validate={'validator':'real'}) t.pack(side=LEFT) self.optimize_options = ('Fix', 'Optimize') self.widgets.energy_cal_flag = t = Pmw.OptionMenu(row, labelpos=W, label_text='Flag:', items=self.optimize_options, menubutton_width=8, initialitem = self.fit.energy_flag) t.pack(side=LEFT) t = Pmw.Group(fcol, tag_text='Initial FWHM calibration'); t.pack(side=TOP) row = t.interior() self.widgets.fwhm_cal_offset = t = Pmw.EntryField(row, value=self.fit.initial_fwhm_offset, command = self.update_peaks, entry_width=10, entry_justify=CENTER, labelpos=W, label_text='Offset:', validate={'validator':'real'}) t.pack(side=LEFT) self.widgets.fwhm_cal_slope = t = Pmw.EntryField(row, value=self.fit.initial_fwhm_slope, command = self.update_peaks, entry_width=10, entry_justify=CENTER, labelpos=W, label_text='Slope:', validate={'validator':'real'}) t.pack(side=LEFT) self.widgets.fwhm_cal_flag = t = Pmw.OptionMenu(row, labelpos=W, label_text='Flag:', items=self.optimize_options, menubutton_width=8, initialitem = self.fit.fwhm_flag) t.pack(side=LEFT) width=10 t = Pmw.Group(fcol, tag_text='Peak parameters'); t.pack(fill=X) pcol = t.interior() row = Frame(pcol); row.pack() self.widgets.label = t = Pmw.EntryField(row, value=' ', entry_width=width, entry_justify=CENTER, labelpos=N, label_text='Label', command=self.peak_label) t.pack(side=LEFT) self.widgets.energy = t = Pmw.EntryField(row, value=0., entry_width=width, entry_justify=CENTER, labelpos=N, label_text='Energy', validate={'validator':'real'}, command=self.peak_params) t.pack(side=LEFT) self.widgets.energy_flag = t = Pmw.OptionMenu(row, labelpos=N, label_text='Energy flag', items=self.optimize_options, initialitem = 1, menubutton_width=8, command=self.peak_params) t.pack(side=LEFT) self.widgets.fwhm = t = Pmw.EntryField(row, value=0., entry_width=width, entry_justify=CENTER, labelpos=N, label_text='FWHM', validate={'validator':'real'}, command=self.peak_params) t.pack(side=LEFT) self.global_optimize_options = ('Global', 'Optimize', 'Fix') self.widgets.fwhm_flag = t = Pmw.OptionMenu(row, labelpos=N, label_text='FWHM flag', items=self.global_optimize_options, initialitem = 0, menubutton_width=8, command=self.peak_params) t.pack(side=LEFT) self.widgets.ampl_factor = t = Pmw.EntryField(row, value=0., entry_width=width, entry_justify=CENTER, labelpos=N, label_text='Ampl. ratio', validate={'validator':'real'}, command=self.peak_params) t.pack(side=LEFT) row = Frame(pcol); row.pack(side=TOP, anchor=W) col = Frame(row); col.pack(side=LEFT) width=7 self.widgets.insert = t = Button(col, text='Insert', width=width, command=lambda s=self: s.insert_or_append(insert=1)); t.pack() self.widgets.append = t = Button(col, text='Append', width=width, command=lambda s=self: s.insert_or_append(insert=0)); t.pack() self.widgets.delete = t = Button(col, text='Delete', width=width, command=self.delete_peak); t.pack() self.widgets.clear_peaks = t = Button(col, text='Clear', width=width, command=self.clear_peaks) t.pack() self.widgets.sort = t = Button(col, text='Sort', width=width, command=self.sort_peaks); t.pack() self.widgets.mark_peaks = t = Button(col, text='Mark all', width=width, command=self.mark_peaks) t.pack() self.widgets.peak_list = t = Pmw.ScrolledListBox(row, listbox_font=('Courier','8'), listbox_width=65, listbox_height=10, vscrollmode='static', hscrollmode='none', selectioncommand=self.new_index) t.pack() width=40 row = Frame(fcol); row.pack(anchor=W) t = Label(row, text='Fit results file:'); t.pack(side=LEFT) self.widgets.results_file_name = t = Label(row, text=self.results_file, foreground='blue', background='white') t.pack(side=LEFT) row = Frame(fcol); row.pack(anchor=W) t = Label(row, text='Spreadsheet file:'); t.pack(side=LEFT) self.widgets.spreadsheet_file_name = t = Label(row, text=self.spreadsheet_file, foreground='blue', background='white') t.pack(side=LEFT) self.widgets.append_mode = t = Pmw.OptionMenu(fcol, labelpos=W, label_text='Overwrite or append results and spreadsheet files:', items=('Overwrite', 'Append'), menubutton_width=9, initialitem = 1) t.pack(anchor=W) row = Frame(fcol); row.pack(side=TOP) self.widgets.fit_peaks = t = Button(row, text='Fit peaks', command=self.fit_peaks) t.pack(side=LEFT) self.widgets.plot_fit = t = Button(row, text='Re-plot fit', command=self.plot_fit) t.pack(side=LEFT) self.update_peaks()
def __init__(self, detector='13GE1:med:', element=1): class widgets: pass self.widgets = widgets() self.detector = detector self.element = element self.status = 'Ready' self.path = '.' self.file = 'test.xrf' self.next_file = self.file self.pvs = {} self.pvs['ElapsedReal'] = epicsPV.epicsPV(detector + 'ElapsedReal', wait=0) self.pvs['PresetReal'] = epicsPV.epicsPV(detector + 'PresetReal', wait=0) self.pvs['StartAll'] = epicsPV.epicsPV(detector + 'StartAll', wait=0) self.pvs['StopAll'] = epicsPV.epicsPV(detector + 'StopAll', wait=0) self.pvs['EraseAll'] = epicsPV.epicsPV(detector + 'EraseAll', wait=0) self.pvs['EraseStart'] = epicsPV.epicsPV(detector + 'EraseStart', wait=0) self.pvs['Acquiring'] = epicsPV.epicsPV(detector + 'Acquiring', wait=0) self.pvs['mca1.ERTM'] = epicsPV.epicsPV(detector + 'mca1.ERTM', wait=0) self.pvs['mca1.ERTM'].pend_io() self.preset_real = self.pvs['PresetReal'].getw() self.elapsed_real = self.pvs['ElapsedReal'].getw() self.update_time = .5 # menus top = myTkTop.myTkTop() top.title('medDisplay') self.widgets.top = top frame = Frame(top, borderwidth=1, relief='raised') frame.pack(fill=X) mb = Pmw.MenuBar(frame) mb.pack(fill=X) mb.addmenu('File', '', side='left') self.widgets.file = mb.component('File-menu') mb.addmenuitem('File', 'command', label='Save As ...', command=self.menu_save) mb.addmenuitem('File', 'command', label='Save Next = ' + self.next_file, command=self.menu_save_next) mb.addmenuitem('File', 'command', label='New MCA Display', command=self.menu_new_display) mb.addmenuitem('File', 'command', 'Exit', label='Exit', command=self.menu_exit) mb.addmenu('Help', '', side='right') self.widgets.help = mb.component('Help-menu') mb.addmenuitem('Help', 'command', label='Usage', command=self.menu_help) mb.addmenuitem('Help', 'command', label='About', command=self.menu_about) mb.addmenu('Options', '', side='left') self.widgets.options = mb.component('Options-menu') self.erase_on_start = IntVar() self.erase_on_start.set(1) mb.addmenuitem('Options', 'checkbutton', label='Erase on Start', variable=self.erase_on_start) # main page main_frame = Frame(self.widgets.top); main_frame.pack() left_frame = Frame(main_frame, borderwidth=1, relief='solid') left_frame.pack(side=LEFT, anchor=N) self.widgets.left_frame = left_frame right_frame = Frame(main_frame, borderwidth=1, relief='solid') right_frame.pack(side=LEFT, anchor=N) self.widgets.right_frame = right_frame # Right Hand Side for control buttons row = Frame(right_frame) row.pack(side=TOP, anchor=W) t = Label(row, text = 'Preset Real Time (s):', width=22, anchor=E); t.pack(side=LEFT) self.widgets.preset_real = t = Pmw.EntryField(row, value=0, entry_width=9, entry_justify=CENTER, validate={'validator':'real'}, entry_background='light blue', command=self.menu_preset_real) t.pack(side=LEFT) row = Frame(right_frame); row.pack(side=TOP, anchor=W) t = Label(row, text = 'Elapsed Real Time (s):', width=22, anchor=E); t.pack(side=LEFT) self.widgets.elapsed_real = t = Label(row, text=str(self.elapsed_real), foreground='blue') t.pack(side=LEFT) self.widgets.preset_real.setentry(self.preset_real) row = Frame(right_frame); row.pack(side=TOP) t = Button(row, text='Start', command=self.menu_start); t.pack(side=LEFT) t = Button(row, text='Stop', command=self.menu_stop); t.pack(side=LEFT) t = Button(row, text='Erase', command=self.menu_erase); t.pack(side=LEFT) row = Frame(right_frame); row.pack(side=TOP) t = Button(row, text='Copy ROIS', command=self.menu_copy_rois) t.pack(side=LEFT) row = Frame(right_frame); row.pack(side=TOP, anchor=W) t = Button(row, text='Save As ...', command=self.menu_save); t.pack(side=LEFT) self.widgets.save_next = t = Button(row, text='Save Next = ' + self.next_file, command=self.menu_save_next) t.pack(side=LEFT) # row = Frame(right_frame); row.pack(side=TOP, anchor=W) t = Label(row, text = 'Viewing Element: '); t.pack(side=LEFT) self.widgets.element = t = Label(row, text=str(self.element), width=2, foreground='blue') t.pack(side=LEFT) row = Frame(right_frame); row.pack(side=TOP, anchor=W) t = Label(row, text = 'Status: '); t.pack(side=LEFT) self.widgets.status = t = Label(row, text='Initializing...', foreground='blue'); t.pack(side=LEFT) t.pack(side=RIGHT) # # Left Hand Side shows Detector Element Layout # t = Label(left_frame, text='Detector Elements'); t.pack(side=TOP) width = 230 height = 230 area = Frame(left_frame, width=width, height=height); area.pack(side=TOP) self.widgets.area = area self.detector_positions = localMedLayout.localMedLayout() self.n_detectors = len(self.detector_positions) button_width=1 button_height=1 self.geom_state= 0 self.widgets.det_buttons = [] for d in range(self.n_detectors): t = Button(area, text=str(d+1), width=button_width, height=button_height, command = lambda s=self, d=d: s.menu_element(d+1)) self.widgets.det_buttons.append(t) self.layout_detector() # Finally, load real versions of the mca_display and EPICS_MED objects # This will take some time, so we start with 'Initializing ...' in the # status message self.widgets.elapsed_real.configure(text=' ') self.mcaDisplay = mcaDisplay.mcaDisplay() self.mca = self.detector + 'mca' + str(self.element) self.mcaDisplay.open_detector(self.mca) self.med = epicsMed.epicsMed(self.detector, n_detectors=self.n_detectors) # when objects are really created, report 'Ready'. self.widgets.status.configure(text='Ready') # Start the timer routine self.widgets.top.after(int(self.update_time*1000), self.menu_timer)