def fillInUI(self, parent): self.morph_maps = {} # Writable maps for pairs of end-point maps. self.default_f_range = (0.0, 1.0, 0.1) self.play_stop_button = self.buttonWidgets['Play'] import Tkinter from CGLtk import Hybrid frame = parent frame.columnconfigure(0, weight=1) row = 0 h = Tkinter.Label(parent, text='Interpolate between two maps') h.grid(row=row, column=0, sticky='w') row += 1 from VolumeViewer import volume_list, Volume_Menu vlist = volume_list() vm1 = Volume_Menu(parent, 'First map', open_button=True, show_on_open=True) vm1.frame.grid(row=row, column=0, sticky='w') if len(vlist) >= 1: vm1.set_volume(vlist[0]) row += 1 self.map_menu_1 = vm1 vm2 = Volume_Menu(parent, 'Second map', open_button=True, show_on_open=True) vm2.frame.grid(row=row, column=0, sticky='w') if len(vlist) >= 2: vm2.set_volume(vlist[1]) row += 1 self.map_menu_2 = vm2 self.scale = Hybrid.Scale(parent, 'Fraction ', 0.0, 1.0, 0.01, 0) self.scale.frame.grid(row=row, column=0, sticky='ew') self.scale.callback(self.scale_changed_cb) self.scale.entry.bind('<KeyPress-Return>', self.scale_changed_cb) row += 1 op = Hybrid.Popup_Panel(parent) opf = op.frame opf.grid(row=row, column=0, sticky='news') opf.grid_remove() opf.columnconfigure(0, weight=1) self.options_panel = op.panel_shown_variable row += 1 orow = 0 cb = op.make_close_button(opf) cb.grid(row=orow, column=1, sticky='e') fr = Tkinter.Frame(opf) fr.grid(row=orow, column=0, sticky='w') orow += 1 fmin, fmax, fstep = self.default_f_range fn = Hybrid.Entry(fr, 'Movie start ', 5, fmin) fn.frame.grid(row=0, column=0, sticky='w') fx = Hybrid.Entry(fr, ' end ', 5, fmax) fx.frame.grid(row=0, column=1, sticky='w') fs = Hybrid.Entry(fr, ' step ', 5, fstep) fs.frame.grid(row=0, column=2, sticky='w') self.f_range_variables = (fn.variable, fx.variable, fs.variable) um = Hybrid.Checkbutton(opf, 'Undisplay original maps', True) um.button.grid(row=orow, column=0, sticky='w') orow += 1 self.undisplay_maps = um.variable mu = Hybrid.Checkbutton_Entries(opf, False, 'Multiplier for second map', (4, '1.0')) mu.frame.grid(row=orow, column=0, sticky='w') orow += 1 self.use_multiplier, self.map_2_multiplier = mu.variables ta = Hybrid.Checkbutton(opf, 'Adjust threshold for constant volume', False) ta.button.grid(row=orow, column=0, sticky='w') orow += 1 self.adjust_thresholds = ta.variable am = Hybrid.Checkbutton(opf, 'Add to first map instead of interpolating', False) am.button.grid(row=orow, column=0, sticky='w') orow += 1 self.add_maps = am.variable am.callback(self.add_mode_cb) rt = Hybrid.Checkbutton(opf, 'Round trip when recording movie', True) rt.button.grid(row=orow, column=0, sticky='w') orow += 1 self.roundtrip = rt.variable # # Specify a label width so dialog is not resized for long messages. # msg = Tkinter.Label(parent, width=40, anchor='w', justify='left') msg.grid(row=row, column=0, sticky='ew') row = row + 1 self.message_label = msg
def fillInUI(self, parent): self.requested_halt = False self.xform_handler = None self.last_relative_xform = None t = parent.winfo_toplevel() self.toplevel_widget = t t.withdraw() parent.columnconfigure(0, weight=1) row = 0 import Tkinter from CGLtk import Hybrid from VolumeViewer import Volume_Menu ff = Tkinter.Frame(parent) ff.grid(row=row, column=0, sticky='w') row = row + 1 from chimera.widgets import ModelOptionMenu om = ModelOptionMenu(ff, labelpos='w', label_text='Fit ', listFunc=fit_object_models, sortFunc=compare_fit_objects, command=self.object_chosen_cb) om.grid(row=0, column=0, sticky='w') self.object_menu = om fm = Volume_Menu(ff, ' in map ') fm.frame.grid(row=0, column=1, sticky='w') self.map_menu = fm gf = Tkinter.Frame(parent) gf.grid(row=row, column=0, sticky='w') row += 1 cl = Tkinter.Label(gf, text='Correlation') cl.grid(row=0, column=0, sticky='w') cv = Tkinter.Label(gf, width=6, anchor='w', relief=Tkinter.SUNKEN, borderwidth=2) cv.grid(row=0, column=1, padx=5, sticky='w') self.corr_label = cv al = Tkinter.Label(gf, text='Average map value') al.grid(row=0, column=2, sticky='w') av = Tkinter.Label(gf, width=6, anchor='w', relief=Tkinter.SUNKEN, borderwidth=2) av.grid(row=0, column=3, padx=5, sticky='w') self.ave_label = av ub = Tkinter.Button(gf, text='Update', command=self.update_metric_cb) ub.grid(row=0, column=4, sticky='w') op = Hybrid.Popup_Panel(parent) opf = op.frame opf.grid(row=row, column=0, sticky='news') opf.grid_remove() opf.columnconfigure(0, weight=1) self.options_panel = op.panel_shown_variable row += 1 orow = 0 cb = op.make_close_button(opf) cb.grid(row=orow, column=1, sticky='e') ru = Hybrid.Checkbutton(opf, 'Real-time correlation / average update', False) ru.button.grid(row=orow, column=0, sticky='w') orow += 1 self.realtime_update = ru.variable ru.callback(self.realtime_cb) sm = Hybrid.Checkbutton_Entries( opf, False, 'Use map simulated from atoms, resolution ', (4, '')) sm.frame.grid(row=orow, column=0, sticky='nw') orow += 1 self.simulate_map, self.map_resolution = sm.variables self.simulate_map.add_callback(self.simulate_map_cb) sm.entries[0].bind('<KeyPress-Return>', self.simulate_resolution_cb) dt = Hybrid.Checkbutton( opf, 'Use only data above contour level from first map', True) dt.button.grid(row=orow, column=0, sticky='w') orow += 1 dt.button['state'] = 'disabled' self.limit_data = dt self.above_threshold = dt.variable opt = Hybrid.Radiobutton_Row(opf, 'Optimize ', ('overlap', 'correlation')) opt.frame.grid(row=orow, column=0, sticky='w') orow += 1 self.optimize = opt.variable self.opt_widget = opt cam = Hybrid.Checkbutton( opf, 'Correlation calculated about mean data value', False) cam.button.grid(row=orow, column=0, sticky='w') orow += 1 cam.button['state'] = 'disabled' self.cam_widget = cam self.corr_about_mean = cam.variable al = Hybrid.Checkbutton_Row(opf, 'Allow ', ('rotation', 'shift')) al.frame.grid(row=orow, column=0, sticky='w') orow += 1 ar, ash = [c.variable for c in al.checkbuttons] ar.set(True) ash.set(True) self.allow_rotation = ar self.allow_shift = ash mm = Hybrid.Checkbutton(opf, 'Move whole molecules', True) mm.button.grid(row=orow, column=0, sticky='w') orow += 1 self.move_whole_molecules = mm.variable self.mwm_button = mm.button # # Specify a label width so dialog is not resized for long messages. # msg = Tkinter.Label(parent, width=40, anchor='w', justify='left') msg.grid(row=row, column=0, sticky='ew') row = row + 1 self.message_label = msg self.halt_button = self.buttonWidgets['Halt'] self.allow_halt(False) self.update_gray_out() self.activate_undo_redo()
def fillInUI(self, parent): self.phantom_device = None self.cursor_model = None self.phantom_handler = None self.gradient_force = None self.phantom_button_down = 0 self.last_phantom_transform = None self.last_roll = None self.key_callback_registered = None self.mode = 'cursor' # 'cursor', 'move models', 'zoom', # 'contour level', 'move marker' self.command_list_shown = False import Tkinter from CGLtk import Hybrid row = 0 po = Hybrid.Checkbutton_Row(parent, 'Enable', ('cursor', 'forces', 'key commands')) po.frame.grid(row=row, column=0, sticky='w') row = row + 1 self.phantom_on, self.force_field, self.commands = \ [c.variable for c in po.checkbuttons] self.phantom_on.add_callback(self.settings_changed_cb) self.force_field.add_callback(self.settings_changed_cb) self.commands.add_callback(self.toggle_commands_cb) cf = Tkinter.Frame(parent) cf.grid(row=row, column=0, sticky='w') row = row + 1 cs = Hybrid.Option_Menu(cf, 'Cursor shape ', 'cross', 'jack', 'sphere', 'volume crosshair') cs.frame.grid(row=0, column=0, sticky='nw') row = row + 1 cs.variable.set('jack') cs.add_callback(self.settings_changed_cb) self.cursor_shape = cs.variable from VolumeViewer import active_volume v = active_volume() if v: csize = '%.3g' % (10 * max(v.data.step)) else: csize = '1' cs = Hybrid.Entry(cf, ' size ', 5, csize) cs.frame.grid(row=0, column=1, sticky='w') cs.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.cursor_size = cs.variable cl = Tkinter.Label(cf, text=' color ') cl.grid(row=0, column=2, sticky='w') from CGLtk.color import ColorWell cc = ColorWell.ColorWell(cf, callback=self.settings_changed_cb) self.cursor_color = cc cc.showColor((0, 0.5, 1), doCallback=0) cc.grid(row=0, column=3, sticky='w') sp = Hybrid.Popup_Panel(parent) spf = sp.frame spf.grid(row=row, column=0, sticky='news') spf.grid_remove() spf.columnconfigure(0, weight=1) self.settings_panel = sp.panel_shown_variable row += 1 srow = 0 cb = sp.make_close_button(spf) cb.grid(row=srow, column=1, sticky='e') pr = Hybrid.Entry(spf, 'Phantom physical range (mm) ', 5, '200') pr.frame.grid(row=srow, column=0, sticky='w') srow += 1 pr.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.phantom_range = pr.variable mf = Hybrid.Entry(spf, 'Maximum force (lbs) ', 5, '.4') mf.frame.grid(row=srow, column=0, sticky='w') srow += 1 mf.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.maximum_force = mf.variable af = Hybrid.Checkbutton(spf, 'Auto-adjust force constant', 1) af.button.grid(row=srow, column=0, sticky='w') srow += 1 self.auto_adjust_force_constant = af.variable self.force_field.add_callback(self.settings_changed_cb) fc = Hybrid.Logarithmic_Scale(spf, 'Force constant ', .0001, 100, 1, '%.2g') fc.frame.grid(row=srow, column=0, sticky='ew') srow += 1 fc.set_value(1) fc.callback(self.force_constant_changed_cb) fc.entry.bind('<KeyPress-Return>', self.force_constant_changed_cb) self.force_constant = fc vf = Tkinter.Frame(spf) vf.grid(row=srow, column=0, sticky='ew') srow += 1 self.label_row(vf, 0, ('', 'x', 'y', 'z')) pl = self.label_row(vf, 1, ('Phantom position', '', '', '')) self.phantom_position_labels = pl[1:] cpl = self.label_row(vf, 2, ('Chimera position', '', '', '')) self.chimera_position_labels = cpl[1:] vpl = self.label_row(vf, 3, ('Volume position', '', '', '')) self.volume_position_labels = vpl[1:] vil = self.label_row(vf, 4, ('Volume index', '', '', '')) self.volume_index_labels = vil[1:] gl = self.label_row(vf, 5, ('Gradient', '', '', '')) self.gradient_labels = gl[1:] fl = self.label_row(vf, 6, ('Force', '', '', '')) self.force_labels = fl[1:] dvl = self.label_row(vf, 7, ('Data value', '')) self.data_value_label = dvl[1]
def fillInUI(self, parent): self.plot = None t = parent.winfo_toplevel() self.toplevel_widget = t t.withdraw() parent.columnconfigure(0, weight=1) row = 0 from chimera.preferences import addCategory, HiddenCategory prefs = addCategory("SAXS", HiddenCategory, optDict={'saxs executable': ''}) self.preferences = prefs import Tkinter from CGLtk import Hybrid from chimera import widgets as w mm = w.ExtendedMoleculeOptionMenu( parent, label_text='Molecule ', labelpos='w', labels=['selected atoms', 'all molecules']) mm.grid(row=row, column=0, sticky='w') row += 1 self.molecule_menu = mm ep = Hybrid.Entry(parent, 'Experimental profile ', 25, browse=True) ep.frame.grid(row=row, column=0, sticky='ew') row += 1 self.experimental_profile = ep.variable op = Hybrid.Popup_Panel(parent) opf = op.frame opf.grid(row=row, column=0, sticky='news') opf.grid_remove() opf.columnconfigure(0, weight=1) self.options_panel = op.panel_shown_variable row += 1 orow = 0 cb = op.make_close_button(opf) cb.grid(row=orow, column=1, sticky='e') np = Hybrid.Checkbutton(opf, 'Use new plot window', False) np.button.grid(row=orow, column=0, sticky='w') orow += 1 self.new_plot = np.variable ex = Hybrid.Entry(opf, 'Executable ', 25, initial=prefs['saxs executable'], browse=True) ex.frame.grid(row=orow, column=0, sticky='ew') orow += 1 ex.entry.xview('end') self.executable = ex.variable
def fillInUI(self, parent): self.sel_handler = None self.last_selected = set() import Tkinter from CGLtk import Hybrid top = parent.winfo_toplevel() menubar = Tkinter.Menu(top, type="menubar", tearoff=False) top.config(menu=menubar) file_menu_entries = (('Export...', self.export_cb), ) fmenu = Hybrid.cascade_menu(menubar, 'File', file_menu_entries) self.columnMenu = Tkinter.Menu(menubar) menubar.add_cascade(label="Columns", menu=self.columnMenu) from chimera.tkgui import aquaMenuBar aquaMenuBar(menubar, parent, row=0) row = 1 columns = ( ('region', lambda r: r.rid), ('grid points', lambda r: r.point_count()), ('grouped', lambda r: len(r.children())), ('has surface', lambda r: 1 if r.has_surface() else 0), ('contacts', lambda r: len(r.contacting_regions())), ('edge distance', lambda r: r.edge_distance()), ('bounds', lambda r: tuple(r.bounds()[0]) + tuple(r.bounds()[1]), '%d,%d,%d,%d,%d,%d', False), ) self.computed_attributes = dict([c[:2] for c in columns]) self.keys = set([c[0] for c in columns]) defaults = dict([(c[0], True) for c in columns]) prefs = {} mi = (self.columnMenu, prefs, defaults, True) from CGLtk.Table import SortableTable self.attribute_table = t = SortableTable(parent, menuInfo=mi) for cspec in columns: name, func = cspec[:2] format = cspec[2] if len(cspec) >= 3 else format_item display = cspec[3] if len(cspec) >= 4 else True t.addColumn(name, func, format=format, display=display, font='TkFixedFont', refresh=False) self.add_columns() # Additional region attributes. t.setData([]) t.launch(browseCmd=self.table_line_selected) t.grid(row=row, column=0, sticky="nsew") parent.rowconfigure(row, weight=1) parent.columnconfigure(0, weight=1) row += 1 naf = Tkinter.Frame(parent) naf.grid(row=row, column=0, sticky='new') naf.columnconfigure(1, weight=1) row += 1 ke = Hybrid.Entry(naf, 'Set attribute ', 15) ke.frame.grid(row=0, column=0, sticky='w') self.key_name = ke.variable ke.entry.bind('<KeyPress-Return>', self.new_value_cb) ve = Hybrid.Entry(naf, ' to value ', 15) ve.frame.grid(row=0, column=1, sticky='ew') self.value = ve.variable ve.entry.bind('<KeyPress-Return>', self.new_value_cb) ol = Tkinter.Label(naf, text=' or ') ol.grid(row=0, column=2, sticky='e') sb = Tkinter.Button(naf, text='snapshot', command=self.snapshot_cb) sb.grid(row=0, column=3, sticky='e') fl = Hybrid.Checkbutton_Entries(parent, False, 'Filter list ', (50, 'grid_points > 1000')) fl.frame.grid(row=row, column=0, sticky='new') row += 1 self.use_filter, self.filter_text = fl.variables self.use_filter.add_callback(self.filter_cb) e = fl.entries[0] fl.frame.columnconfigure(1, weight=1) e.grid(sticky='ew') e.bind('<KeyPress-Return>', self.filter_cb) op = Hybrid.Popup_Panel(parent, resize_dialog=False) opf = op.frame opf.grid(row=row, column=0, sticky='news') opf.grid_remove() opf.columnconfigure(0, weight=1) self.optionsPanel = op.panel_shown_variable row += 1 orow = 0 cb = op.make_close_button(opf) cb.grid(row=orow, column=0, sticky='e') l = Tkinter.Label(opf, text='Options', font='TkCaptionFont') l.grid(column=0, row=orow, sticky='w', pady=5) orow += 1 ss = Hybrid.Checkbutton(opf, 'Show selected region surface', False) ss.button.grid(row=orow, column=0, sticky='w') orow += 1 self.show_selected = ss.variable msg = Tkinter.Label(parent, width=60, anchor='w', justify='left') msg.grid(column=0, row=row, sticky='ew') self.msg = msg self.Update()
def fillInUI(self, parent): self.toplevel_widget = parent.winfo_toplevel() self.toplevel_widget.withdraw() parent.columnconfigure(0, weight=1) row = 0 import Tkinter from CGLtk import Hybrid from chimera import widgets from Surface import surface_models sm = widgets.ModelOptionMenu(parent, labelpos='w', label_text='Surface ', listFunc=surface_models, command=self.surface_menu_cb) sm.grid(row=row, column=0, sticky='w') self.surface_menu = sm row += 1 ls = Hybrid.Logarithmic_Scale(parent, 'Size ', 1, 1000, 100, entry_width=8) ls.frame.grid(row=row, column=0, sticky='ew') row += 1 ls.callback(self.limit_changed_cb) ls.entry.bind('<KeyPress-Return>', self.limit_changed_cb) self.limit = ls op = Hybrid.Popup_Panel(parent) opf = op.frame opf.grid(row=row, column=0, sticky='news') opf.grid_remove() opf.columnconfigure(0, weight=1) self.options_panel = op.panel_shown_variable row += 1 orow = 0 cb = op.make_close_button(opf) cb.grid(row=orow, column=1, sticky='e') mo = Hybrid.Option_Menu(opf, 'Hide small blobs based on ', 'size', 'rank', 'volume') mo.frame.grid(row=orow, column=0, sticky='w') row += 1 mo.add_callback(self.method_changed_cb) self.method = mo.variable # Specify a label width so dialog is not resized for long messages. msg = Tkinter.Label(parent, width=40, anchor='w', justify='left') msg.grid(row=row, column=0, sticky='ew') row = row + 1 self.message_label = msg self.surface_menu_cb() # Set slider for current surface
def fillInUI(self, parent): self.molecules = [] self.add_model_handler = None self.remove_model_handler = None import Tkinter from CGLtk import Hybrid row = 0 mm = Hybrid.Option_Menu(parent, 'Molecule: ') mm.frame.grid(row=row, column=0, sticky='w') row = row + 1 mm.add_callback(self.molecule_menu_cb) self.molecule_menu = mm labels = [] for text in ( 'Space group: ', 'Cell size: ', 'Cell angles: ', 'Number of SMTRY matrices: ', 'Number of space group symmetries: ', 'Number of MTRIX matrices: ', ): lbl = Tkinter.Label(parent, text=text) lbl.grid(row=row, column=0, sticky='w') row = row + 1 labels.append(lbl) ( self.space_group, self.cell_size, self.cell_angles, self.smtry_count, self.sg_smtry_count, self.mtrix_count, ) = labels op = Hybrid.Popup_Panel(parent) opf = op.frame opf.grid(row=row, column=0, sticky='news') opf.grid_remove() opf.columnconfigure(0, weight=1) self.options_panel = op.panel_shown_variable row += 1 orow = 0 cb = op.make_close_button(opf) cb.grid(row=orow, column=1, sticky='e') usr = Hybrid.Checkbutton(opf, 'Use SMTRY records in PDB header', True) usr.button.grid(row=orow, column=0, sticky='w') orow += 1 self.use_smtry_records = usr.variable ucr = Hybrid.Checkbutton( opf, 'Use CRYST1 record if SMTRY records are missing', True) ucr.button.grid(row=orow, column=0, sticky='w') orow += 1 self.use_cryst1_smtry = ucr.variable umr = Hybrid.Checkbutton( opf, 'Use MTRIX records for non-crystallographic symmetry', True) umr.button.grid(row=orow, column=0, sticky='w') orow += 1 self.use_mtrix_records = umr.variable co = Hybrid.Entry(opf, 'Cell origin ', 12, '0 0 0') co.frame.grid(row=orow, column=0, sticky='w') orow += 1 self.grid_orig = co.variable co.entry.bind('<KeyPress-Return>', self.origin_change_cb) nc = Hybrid.Entry(opf, 'Number of cells ', 12, '1 1 1') nc.frame.grid(row=orow, column=0, sticky='w') orow += 1 self.ncells = nc.variable nc.entry.bind('<KeyPress-Return>', self.make_unit_cell_cb) br = Hybrid.Button_Row(parent, '', ( ('Make copies', self.make_unit_cell_cb), ('Outline', self.show_outline_cb), ('Delete copies', self.close_unit_cell_cb), )) br.frame.grid(row=row, column=0, sticky='e') row = row + 1
def fillInUI(self, parent): self.filter_widgets = fw = [] self.toplevel_widget = parent.winfo_toplevel() self.toplevel_widget.withdraw() parent.columnconfigure(0, weight=1) # Allow scalebar to expand. row = 0 import Tkinter from CGLtk import Hybrid self.gaussian = 'Gaussian' self.median = 'Median 3x3x3' self.bin = 'Bin' self.laplacian = 'Laplacian' self.fourier = 'Fourier Transform' self.scale = 'Scale' ft = Hybrid.Option_Menu(parent, 'Filter type:', self.gaussian, self.median, self.bin, self.laplacian, self.fourier, self.scale) ft.button.configure(indicatoron = False) ft.frame.grid(row = row, column = 0, sticky = 'w') row += 1 self.filter_type = ft.variable ft.add_callback(self.filter_type_changed_cb) ws = Hybrid.Scale(parent, 'Width ', 1.0, 10.0, 0.0, 1.0) ws.frame.grid(row = row, column = 0, sticky = 'ew') row += 1 ws.callback(self.filter_parameter_changed_cb) ws.entry.bind('<KeyPress-Return>', self.filter_cb) self.sdev = ws Hybrid.Balloon_Help(ws.label, 'Width is one standard deviation.', delay = 0.5) fw.append((self.gaussian, ws.frame)) mi = Hybrid.Scale(parent, 'Iterations ', 0, 5, 1, 1, 2) mi.frame.grid(row = row, column = 0, sticky = 'ew') row += 1 mi.callback(self.filter_parameter_changed_cb) mi.entry.bind('<KeyPress-Return>', self.filter_cb) self.median_iterations = mi fw.append((self.median, mi.frame)) bs = Hybrid.Entry(parent, 'Bin size', 5, '2') bs.frame.grid(row = row, column = 0, sticky = 'w') row += 1 self.binsize = bs.variable bs.entry.bind('<KeyPress-Return>', self.filter_cb) fw.append((self.bin, bs.frame)) sf = Tkinter.Frame(parent) sf.grid(row = row, column = 0, sticky = 'w') row += 1 fw.append((self.scale, sf)) sh = Hybrid.Entry(sf, 'Shift', 5, '0') sh.frame.grid(row = 0, column = 0, sticky = 'w') self.shift = sh.variable sh.entry.bind('<KeyPress-Return>', self.filter_cb) sc = Hybrid.Entry(sf, 'Scale', 5, '1') sc.frame.grid(row = 0, column = 1, sticky = 'w') self.scale_factor = sc.variable sc.entry.bind('<KeyPress-Return>', self.filter_cb) vt = Hybrid.Option_Menu(sf, 'Value type', 'same', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'float32', 'float64') vt.frame.grid(row = 0, column = 2, sticky = 'w') self.value_type = vt.variable op = Hybrid.Popup_Panel(parent) opf = op.frame opf.grid(row = row, column = 0, sticky = 'news') opf.grid_remove() opf.columnconfigure(0, weight=1) self.options_panel = op.panel_shown_variable row += 1 orow = 0 cb = op.make_close_button(opf) cb.grid(row = orow, column = 1, sticky = 'e') sr = Hybrid.Checkbutton(opf, 'Displayed subregion only', True) sr.button.grid(row = orow, column = 0, sticky = 'w') orow += 1 self.use_subregion = sr.variable ss = Hybrid.Checkbutton(opf, 'Displayed subsampling only', False) ss.button.grid(row = orow, column = 0, sticky = 'w') orow += 1 self.use_step = ss.variable ta = Hybrid.Checkbutton(opf, 'Adjust threshold for constant volume', True) ta.button.grid(row = orow, column = 0, sticky = 'w') orow += 1 self.adjust_thresholds = ta.variable iu = Hybrid.Checkbutton(opf, 'Immediate update', False) iu.button.grid(row = orow, column = 0, sticky = 'w') orow += 1 self.immediate_update = iu.variable self.filter_type_changed_cb() self.set_scale_range(initial = True)
def fillInUI(self, parent): self.toplevel_widget = parent.winfo_toplevel() self.toplevel_widget.withdraw() parent.columnconfigure(0, weight=1) row = 0 import Tkinter from CGLtk import Hybrid from chimera import widgets from SurfaceColor import colorable_surface_models sm = widgets.ModelOptionMenu(parent, labelpos='w', label_text='Color surface ', listFunc=colorable_surface_models, command=self.surface_menu_cb) sm.grid(row=row, column=0, sticky='w') self.surface_menu = sm row = row + 1 from SurfaceColor import coloring_methods methods = [cm.menu_name for cm in coloring_methods] csm = Hybrid.Option_Menu(parent, 'by ', *methods) csm.frame.grid(row=row, column=0, sticky='w') self.color_source_menu = csm.variable csm.add_callback(self.color_source_changed_cb) row = row + 1 from VolumeViewer import Volume_Menu vm = Volume_Menu(parent, 'file', open_button='browse...') vm.frame.grid(row=row, column=0, sticky='w') self.volume_menu = vm row += 1 oaf = Tkinter.Frame(parent) oaf.grid(row=row, column=0, sticky='w') row = row + 1 self.origin_axis_frame = oaf oe = Hybrid.Entry(oaf, 'origin ', 8, '0 0 0') oe.frame.grid(row=0, column=0, sticky='w') self.origin_variable = oe.variable oe.entry.bind('<KeyPress-Return>', self.settings_changed_cb) cb = Tkinter.Button(oaf, text='center', command=self.set_center_cb) cb.grid(row=0, column=1, sticky='w') ae = Hybrid.Entry(oaf, 'axis ', 8, '0 0 1') ae.frame.grid(row=0, column=2, sticky='w') self.axis_frame = ae.frame self.axis_variable = ae.variable ae.entry.bind('<KeyPress-Return>', self.settings_changed_cb) cg = Colorwell_GUI(parent, 5, self.settings_changed_cb) cg.set_color_palette('rainbow') self.colormap_gui = cg self.colormap_gui.frame.grid(row=row, column=0, sticky='w') row = row + 1 op = Hybrid.Popup_Panel(parent) opf = op.frame opf.grid(row=row, column=0, sticky='news') opf.grid_remove() opf.columnconfigure(0, weight=1) self.options_panel = op.panel_shown_variable row += 1 orow = 0 cb = op.make_close_button(opf) cb.grid(row=orow, column=1, sticky='ne') cf = Tkinter.Frame(opf) cf.grid(row=orow, column=0, sticky='w') orow += 1 color_counts = ('2', '3', '5', '10', '15', '20') cc = Hybrid.Option_Menu(cf, 'Colors ', *color_counts) cc.frame.grid(row=0, column=0, sticky='w') self.color_count = cc.variable self.color_count.set('5') cc.add_callback(self.change_color_count_cb) cpat = ('Rainbow', 'Gray', 'Red-Blue', 'Cyan-Maroon') cp = Hybrid.Option_Menu(cf, 'Palette', *cpat) cp.frame.grid(row=0, column=1, sticky='w') self.palette = cp.variable cp.add_callback(self.change_color_palette_cb) rc = Tkinter.Button(cf, text='Reverse', command=self.reverse_colors_cb) rc.grid(row=0, column=2, sticky='w') ckb = Tkinter.Button(opf, text="Create color key", command=self.colormap_gui.color_key_cb) ckb.grid(row=orow, column=0, sticky='w') orow += 1 dcf = Tkinter.Frame(opf) dcf.grid(row=orow, column=0, sticky='w') orow += 1 db = Tkinter.Button(dcf, text='Set', command=self.show_default_colormap_values) db.grid(row=0, column=0, sticky='w') dt = Tkinter.Label(dcf, text=' full range of surface values') dt.grid(row=0, column=1, sticky='w') so = Hybrid.Entry(opf, 'Surface offset ', 5, '1.4') so.frame.grid(row=orow, column=0, sticky='w') self.surface_offset = so.variable self.surface_offset_frame = so.frame orow += 1 so.entry.bind('<KeyPress-Return>', self.settings_changed_cb) ocf = Tkinter.Frame(opf) ocf.grid(row=orow, column=0, sticky='w') orow += 1 self.outside_color_frame = ocf ocl = Tkinter.Label(ocf, text='Color outside volume') ocl.grid(row=0, column=0, sticky='w') outside_color = (.5, .5, .5, 1) from CGLtk.color import ColorWell cw = ColorWell.ColorWell(ocf) cw.showColor(outside_color) cw.grid(row=0, column=1, sticky='w') self.outside_color = cw co = Hybrid.Checkbutton(opf, 'Only color sliced surface face', 0) co.button.grid(row=orow, column=0, sticky='w') orow += 1 self.color_caps_only = co.variable ppc = Hybrid.Checkbutton(opf, 'Per-pixel coloring', False) ppc.button.grid(row=orow, column=0, sticky='w') orow += 1 self.per_pixel_color = ppc.variable # # Specify a label width so dialog is not resized for long messages. # msg = Tkinter.Label(parent, width=40, anchor='w', justify='left') msg.grid(row=row, column=0, sticky='ew') row = row + 1 self.message_label = msg # Show current coloring if one already exists from session restore. self.surface_menu_cb() # Show axix, origin, volume widgets if appropriate. self.color_source_changed_cb()