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.widgets import MoleculeOptionMenu mm = MoleculeOptionMenu(parent, labelpos = 'w', label_text = 'Molecule ') mm.grid(row = row, column = 0, sticky = 'w') self.molecule_menu = mm row = row + 1 cd = Hybrid.Entry(parent, 'Contact distance', 5, '1.0') cd.frame.grid(row = row, column = 0, sticky = 'w') self.contact_distance = cd.variable cd.entry.bind('<KeyPress-Return>', self.show_contacts) row = row + 1 mc = Hybrid.Checkbutton(parent, 'Create copies of contacting molecules.', False) mc.button.grid(row = row, column = 0, sticky = 'w') row += 1 self.copy_molecule = mc.variable msg = Tkinter.Label(parent, anchor = 'w', justify = 'left') msg.grid(row = row, column = 0, sticky = 'ew') row = row + 1 self.message_label = msg
def set_color_count(self, n): if n == self.n: return if n > len(self.colorwells): # Add more color buttons for c in range(len(self.colorwells), n): from CGLtk.color import ColorWell cw = ColorWell.ColorWell(self.frame) cw.grid(row=2 * (c / 5), column=c % 5) self.colorwells.append(cw) from CGLtk import Hybrid e = Hybrid.Entry(self.frame, '', 5, '') e.frame.grid(row=2 * (c / 5) + 1, column=c % 5) e.entry.bind('<KeyPress-Return>', self.colormap_changed_cb) self.entry_fields.append(e) # Map additional colorwells for c in range(self.n, n): self.colorwells[c].grid() self.entry_fields[c].frame.grid() # Unmap extra colorwells for c in range(n, self.n): self.colorwells[c].grid_remove() self.entry_fields[c].frame.grid_remove() self.n = n
def color_source(self): csname = self.color_source_menu.get() from SurfaceColor import coloring_methods csclass = [cm for cm in coloring_methods if cm.menu_name == csname][0] cs = csclass() cmap = self.colormap() if cmap: cs.set_colormap(cmap) if cs.uses_volume_data: cs.set_volume(self.volume_menu.volume()) if cs.uses_origin: o = parse_vector(self.origin_variable.get(), default=(0, 0, 0)) cs.set_origin(o) if cs.uses_axis: a = parse_vector(self.axis_variable.get(), default=(0, 0, 1)) cs.set_axis(a) cs.per_pixel_coloring = self.per_pixel_color.get() from SurfaceColor import Electrostatic_Color if isinstance(cs, Electrostatic_Color): from CGLtk import Hybrid cs.offset = Hybrid.float_variable_value(self.surface_offset, 0) return cs
def __init__(self, parent, title, values_cb): self.values_cb = values_cb self.name_to_value = {} import Tkinter f = Tkinter.Frame(parent) self.frame = f if title: label = Tkinter.Label(f, text=title) label.grid(row=0, column=0, sticky='w') self.label = label from CGLtk import Hybrid v = Hybrid.StringVariable(parent) self.variable = v mb = Tkinter.Menubutton(f, textvariable=v.tk_variable, indicatoron=1, borderwidth=2, relief='raised', highlightthickness=2, anchor='c') mb.grid(row=0, column=1, sticky='w') m = Tkinter.Menu(mb, tearoff=0, postcommand=self.update_menu) self.menu = m mb['menu'] = m self.update_menu()
def color_source(self): csname = self.color_source_menu.get() from SurfaceColor import coloring_methods csclass = [cm for cm in coloring_methods if cm.menu_name == csname][0] cs = csclass() cmap = self.colormap() if cmap: cs.set_colormap(cmap) if cs.uses_volume_data: cs.set_volume(self.volume_menu.volume()) if cs.uses_origin: o = parse_vector(self.origin_variable.get(), default = (0,0,0)) cs.set_origin(o) if cs.uses_axis: a = parse_vector(self.axis_variable.get(), default = (0,0,1)) cs.set_axis(a) cs.per_pixel_coloring = self.per_pixel_color.get() from SurfaceColor import Electrostatic_Color if isinstance(cs, Electrostatic_Color): from CGLtk import Hybrid cs.offset = Hybrid.float_variable_value(self.surface_offset, 0) return cs
def fillInUI(self, parent): self.surface_change_handler = None 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 MeasureVolume 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 = row + 1 ve = Hybrid.Entry(parent, 'Volume = ', 20) ve.entry.configure(relief = Tkinter.FLAT, state = 'readonly', highlightthickness = 0) ve.frame.grid(row = row, column = 0, sticky = 'w') row = row + 1 self.volume = ve.variable ae = Hybrid.Entry(parent, 'Area = ', 20) ae.entry.configure(relief = Tkinter.FLAT, state = 'readonly', highlightthickness = 0) ae.frame.grid(row = row, column = 0, sticky = 'w') row = row + 1 self.area = ae.variable au = Hybrid.Checkbutton(parent, 'Update automatically', True) au.button.grid(row = row, column = 0, sticky = 'w') row = row + 1 self.autoupdate = au.variable au.callback(self.update_switch_cb) # Set menu to a displayed surface. surfs = filter(lambda sm: sm.display, surface_models()) if surfs: self.surface_menu.setvalue(surfs[0])
def fillInUI(self, parent): 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 from chimera.widgets import MoleculeOptionMenu mm = MoleculeOptionMenu(parent, labelpos='w', label_text='Molecule ', command=self.show_cumulative_transform) mm.grid(row=row, column=0, sticky='w') self.molecule_menu = mm row = row + 1 ea = Hybrid.Entry(parent, 'Euler angles ', 25, '0 0 0') ea.frame.grid(row=row, column=0, sticky='e') row = row + 1 self.euler_angles = ea.variable tr = Hybrid.Entry(parent, 'Shift ', 25, '0 0 0') tr.frame.grid(row=row, column=0, sticky='e') row = row + 1 self.translation = tr.variable cas = Tkinter.Label(parent, text='', justify='left') cas.grid(row=row, column=0, sticky='w') self.cumulative = cas row = row + 1 el = Tkinter.Label( parent, text= 'Apply rotation and translation to atom coordinates\n using the molecule coordinate system.', justify='left') el.grid(row=row, column=0, sticky='w') row = row + 1 self.show_cumulative_transform(None)
def mesh_offset_changed_cb(self, event = None): p = self.mesh_surface_piece() if p: varray, tarray = p.geometry from CGLtk import Hybrid mesh_offset = Hybrid.float_variable_value(self.mesh_offset, 0) varray[:,2] = mesh_offset p.geometry = varray, tarray
def fillInUI(self, parent): SaveModeless.fillInUI(self, parent) from CGLtk import Hybrid br = Hybrid.Entry(self.clientArea, 'Bit rate (Kb/sec):', 6, self.default_bit_rate) br.frame.grid(row=0, column=0, sticky='w') self.bit_rate = br.variable
def mesh_offset_changed_cb(self, event=None): p = self.mesh_surface_piece() if p: varray, tarray = p.geometry from CGLtk import Hybrid mesh_offset = Hybrid.float_variable_value(self.mesh_offset, 0) varray[:, 2] = mesh_offset p.geometry = varray, tarray
def fillInUI(self, parent): self.default_color = (0, 0, 0.8, 1) t = parent.winfo_toplevel() self.toplevel_widget = t t.withdraw() parent.columnconfigure(0, weight=1) row = 0 import Tkinter from CGLtk import Hybrid mmf = Tkinter.Frame(parent) mmf.grid(row=row, column=0, sticky='w') row = row + 1 mb = Hybrid.Option_Menu(mmf, 'Use mouse ', 'button 1', 'button 2', 'button 3', 'ctrl button 1', 'ctrl button 2', 'ctrl button 3') mb.variable.set('ctrl button 3') mb.frame.grid(row=0, column=0, sticky='w') mb.add_callback(self.bind_mouse_button_cb) self.mouse_button = mb mbl = Tkinter.Label(mmf, text=' to choose blobs') mbl.grid(row=0, column=1, sticky='w') crf = Tkinter.Frame(parent) crf.grid(row=row, column=0, sticky='ew') crf.columnconfigure(1, weight=1) row = row + 1 cl = Tkinter.Label(crf, text='Color blob ') cl.grid(row=0, column=0, sticky='w') from CGLtk.color import ColorWell sc = ColorWell.ColorWell(crf, color=self.default_color) sc.grid(row=0, column=1, sticky='w') self.blob_color = sc msg = Tkinter.Label(parent, anchor='w', justify='left') msg.grid(row=row, column=0, sticky='ew') row = row + 1 self.message_label = msg callbacks = (self.mouse_down_cb, self.mouse_drag_cb, self.mouse_up_cb) icon = self.mouse_mode_icon('pickblob.gif') from chimera import mousemodes mousemodes.addFunction('pick blobs', callbacks, icon) self.bind_mouse_button_cb()
def settings_changed_cb(self, event=None): cap = self.show_caps.get() from surfcaps import capper c = capper() if cap: if self.use_cap_color.get(): color = self.cap_color.rgba else: color = None c.set_cap_color(color) c.set_style(self.cap_style.get() == 'mesh') from CGLtk import Hybrid sf = Hybrid.float_variable_value(self.subdivision_factor, 1.0) c.set_subdivision_factor(sf) cap_offset = Hybrid.float_variable_value(self.cap_offset, c.default_cap_offset) c.set_cap_offset(cap_offset) c.show_caps() else: c.unshow_caps()
def settings_changed_cb(self, event = None): cap = self.show_caps.get() from surfcaps import capper c = capper() if cap: if self.use_cap_color.get(): color = self.cap_color.rgba else: color = None c.set_cap_color(color) c.set_style(self.cap_style.get() == 'mesh') from CGLtk import Hybrid sf = Hybrid.float_variable_value(self.subdivision_factor, 1.0) c.set_subdivision_factor(sf) cap_offset = Hybrid.float_variable_value(self.cap_offset, c.default_cap_offset) c.set_cap_offset(cap_offset) c.show_caps() else: c.unshow_caps()
def flatten_cb(self, event = None): self.Unflatten() self.message('') import FlattenIcosahedron mlist = FlattenIcosahedron.multiscale_models() from CGLtk import Hybrid r = Hybrid.float_variable_value(self.radius) if r == None: r = FlattenIcosahedron.model_radius(mlist) if r != None: self.radius.set(r) elif r <= 0: self.message('Radius must be greater than 0.') return if r != None: FlattenIcosahedron.flatten_icosahedron(mlist, r) if self.show_mesh.get() and mlist: rgba = self.mesh_color.rgba zoffset = Hybrid.float_variable_value(self.mesh_offset, 0) self.show_triangle_mesh(mlist[0].surface_model(), r, rgba, zoffset)
def flatten_cb(self, event=None): self.Unflatten() self.message('') import FlattenIcosahedron mlist = FlattenIcosahedron.multiscale_models() from CGLtk import Hybrid r = Hybrid.float_variable_value(self.radius) if r == None: r = FlattenIcosahedron.model_radius(mlist) if r != None: self.radius.set(r) elif r <= 0: self.message('Radius must be greater than 0.') return if r != None: FlattenIcosahedron.flatten_icosahedron(mlist, r) if self.show_mesh.get() and mlist: rgba = self.mesh_color.rgba zoffset = Hybrid.float_variable_value(self.mesh_offset, 0) self.show_triangle_mesh(mlist[0].surface_model(), r, rgba, zoffset)
def colormap(self, message_cb): cmap = [] for c in range(self.n): v = self.entry_fields[c].variable if v.get().strip() == '': continue # unused color from CGLtk import Hybrid dv = Hybrid.float_variable_value(v) if dv == None: message_cb('Data value "%s" is not a number' % v.get()) continue cw = self.colorwells[c] cmap.append((dv, cw.rgba)) cmap.sort() return cmap
def fillInUI(self, parent): from chimera.widgets import MoleculeScrolledListBox self.molList = MoleculeScrolledListBox(parent, labelpos='w', listbox_selectmode="extended", label_text="Add ions : ") self.molList.grid(row=0, column=0, sticky="nsew") rcf1 = Tkinter.Frame(parent) rcf1.grid(row=2, column=0, sticky="nsew") from Addions import ValidIontypes self.iontype = "Cl-" self.iontypeOption = Pmw.OptionMenu(rcf1, label_text="Ion types:", labelpos='w', items=ValidIontypes, initialitem=self.iontype, command=self.changeIontype) self.iontypeOption.grid(row=0, column=0) rcf2 = Tkinter.Frame(parent) rcf2.grid(row=3, column=0) rcf2.columnconfigure(2, weight=1) self.numionOption = Pmw.RadioSelect(rcf2, buttontype='radiobutton', command=self.changeNumion, labelpos='w', label_text="# of ions:") self.numionOption.add("neutralize") self.numionOption.add("specific number:") self.numionOption.setvalue("neutralize") self.numionOption.grid(row=0, column=0) self.numion = "neutralize" self.numionValue = Hybrid.StringVariable(rcf2) self.numionEntry = Tkinter.Entry( rcf2, width=5, textvariable=self.numionValue.tk_variable, state='disabled') self.numionEntry.grid(row=0, column=1) parent.rowconfigure(0, weight=1) parent.columnconfigure(0, weight=1)
def fillInUI(self, parent): from CGLtk import Hybrid parent.columnconfigure(0, weight=1) row = 0 vl = Hybrid.Scrollable_List(parent, 'Memory use', 5) vl.listbox['font'] = 'Courier' # fixed width font so columns line up vl.heading['font'] = 'Courier' self.object_listbox = vl.listbox self.object_list_heading = vl.heading vl.frame.grid(row=row, column=0, sticky='news') parent.rowconfigure(row, weight=1) row = row + 1 self.update_use()
def subdivision_levels(self, radius, update_subdivision_spacing = True): from CGLtk import Hybrid subdivision_factor = Hybrid.float_variable_value(self.subdivision_factor, 1) if subdivision_factor <= 0: subdivision_factor = 1 from math import log, pow subdivision_levels = max(0, int(round(log(subdivision_factor)/log(2)))) if update_subdivision_spacing: import Icosahedron edge = radius * Icosahedron.icosahedron_edge_length() subdivision_spacing = edge / pow(2.0, subdivision_levels) self.subdivision_spacing['text'] = ' spacing %.3g' % subdivision_spacing return subdivision_levels
def _componentsCB(self, opt, update=True): cf = self.componentsFrame if hasattr(self, 'wells'): for well in self.wells: well.grid_forget() well.destroy() for label in self.labels: label.frame.grid_forget() self.reverseButton.grid_forget() self.reverseButton.destroy() else: Tkinter.Label(cf, text="Colors").grid(row=0) Tkinter.Label(cf, text="Labels").grid(row=0, column=1) if isinstance(opt, int): numComponents = opt self.numComponents.set(opt) else: numComponents = opt.get() wellSize = min(38, int((7 * 38) / numComponents)) from CGLtk.color.ColorWell import ColorWell self.wells = [] self.labels = [] from CGLtk import Hybrid for i in range(numComponents): well = ColorWell(cf, width=wellSize, height=wellSize, callback=self._keyChangeCB, color='white') well.grid(row=i + 1) self.wells.append(well) label = Hybrid.Entry(cf, "", 10) label.variable.add_callback(self._keyTypingCB) label.frame.grid(row=i + 1, column=1, sticky='ew') self.labels.append(label) self.reverseButton = Tkinter.Button(cf, command=self.reverseKey, text="Reverse ordering of above", pady=0) self.reverseButton.grid(row=numComponents + 1, column=0, columnspan=2) self.notebook.setnaturalsize() if update: self._keyChangeCB()
def subdivision_levels(self, radius, update_subdivision_spacing=True): from CGLtk import Hybrid subdivision_factor = Hybrid.float_variable_value( self.subdivision_factor, 1) if subdivision_factor <= 0: subdivision_factor = 1 from math import log, pow subdivision_levels = max(0, int(round(log(subdivision_factor) / log(2)))) if update_subdivision_spacing: import Icosahedron edge = radius * Icosahedron.icosahedron_edge_length() subdivision_spacing = edge / pow(2.0, subdivision_levels) self.subdivision_spacing[ 'text'] = ' spacing %.3g' % subdivision_spacing return subdivision_levels
def fillInUI(self, parent): subsample_size_text = '(%d,%d,%d)' % self.subsample_size size_text = '(%d,%d,%d)' % self.full_data_size step_ranges = map(lambda r: '%d-%d' % r, self.allowed_step_ranges) allowed_steps = '%s %s %s' % tuple(step_ranges) msg = ('There are multiple possible subsample cell sizes for\n' + '%s %s as subsamples of %s %s.\n' % (self.subsample_name, subsample_size_text, self.full_data_name, size_text) + 'Possibile cell sizes are %s.' % allowed_steps) import Tkinter lbl = Tkinter.Label(parent, text=msg, justify='left') lbl.grid(row=0, column=0, sticky='w') csize = '%d %d %d' % tuple( map(lambda r: r[1], self.allowed_step_ranges)) from CGLtk import Hybrid cs = Hybrid.Entry(parent, 'Cell size ', 15, csize) cs.frame.grid(row=1, column=0, sticky='w') self.cell_size_var = cs.variable
def fillInUI(self, parent): self.toplevel_widget = parent.winfo_toplevel() self.toplevel_widget.withdraw() row = 0 import Tkinter from CGLtk import Hybrid from chimera import widgets from SurfaceZone import zonable_surface_models sm = widgets.ModelOptionMenu(parent, labelpos='w', label_text='Surface ', listFunc=zonable_surface_models, command=self.surface_menu_cb) sm.grid(row=row, column=0, sticky='w') self.surface_menu = sm row = row + 1 rs = Hybrid.Scale(parent, 'Radius ', 0, 30, .1, 2) rs.frame.grid(row=row, column=0, sticky='ew') row = row + 1 rs.callback(self.radius_changed_cb) rs.entry.bind('<KeyPress-Return>', self.radius_changed_cb) self.radius = rs # # 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 state_from_dialog(self, icosahedron_dialog): d = icosahedron_dialog self.is_visible = d.isVisible() t = d.uiMaster().winfo_toplevel() self.geometry = t.wm_geometry() self.radius = d.radius.value(d.default_radius) self.sphere_factor = d.sphere_factor.value(0) self.orientation = d.orientation.get() from CGLtk import Hybrid self.subdivision_factor = Hybrid.float_variable_value( d.subdivision_factor, 1) self.style = d.surface_style.get() self.color = d.color.rgba if d.surface_model is None: self.surface_model = None else: from SessionUtil.stateclasses import Model_State self.surface_model = Model_State() self.surface_model.state_from_model(d.surface_model)
def fillInUI(self, parent): self.toplevel_widget = parent.winfo_toplevel() self.toplevel_widget.withdraw() parent.columnconfigure(0, weight=1) row = 0 from CGLtk import Hybrid self.NORMAL_MOVEMENT = 'Normal' self.MOVE_SELECTION = 'Move selection' self.MOVE_MOLECULE = 'Move molecule' self.MOVE_CHAIN = 'Move chain' self.MOVE_SECONDARY_STRUCTURE = 'Move helix, strand, or turn' modes = (self.NORMAL_MOVEMENT, self.MOVE_SELECTION, self.MOVE_MOLECULE, self.MOVE_CHAIN, self.MOVE_SECONDARY_STRUCTURE) mm = Hybrid.Option_Menu(parent, 'Movement mouse mode ', *modes) mm.frame.grid(row=row, column=0, sticky='w') self.mode = mm.variable mm.add_callback(self.mode_changed_cb)
def state_from_dialog(self, icosahedron_dialog): d = icosahedron_dialog self.is_visible = d.isVisible() t = d.uiMaster().winfo_toplevel() self.geometry = t.wm_geometry() self.radius = d.radius.value(d.default_radius) self.sphere_factor = d.sphere_factor.value(0) self.orientation = d.orientation.get() from CGLtk import Hybrid self.subdivision_factor = Hybrid.float_variable_value(d.subdivision_factor, 1) self.style = d.surface_style.get() self.color = d.color.rgba if d.surface_model is None: self.surface_model = None else: from SessionUtil.stateclasses import Model_State self.surface_model = Model_State() self.surface_model.state_from_model(d.surface_model)
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): 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 # Map selection (only Volumes) fm = Volume_Menu(ff, 'Map: ') fm.frame.grid(row=0, column=0, sticky='w') self.map_menu = fm # Resolution rs = Hybrid.Entry(ff, 'Resolution ', 5) rs.frame.grid(row=0, column=1, sticky='w') self.resolution = rs.variable # Cut-off co = Hybrid.Entry(ff, 'Cut-off level ', 10) co.frame.grid(row=0, column=2, sticky='w') self.cutoff = co.variable self.save_button = Tkinter.Button(ff, text="From Volume Viewer", font=self.arialBondF, height=1, command=self.get_cutoff) self.save_button.grid(row=0, column=3, sticky='w') hf = Tkinter.Frame(parent) hf.grid(row=row, column=0, sticky='w') row += 1 # Space msg = Tkinter.Label(hf, anchor='w', justify='left') msg.grid(row=2, column=0, sticky='ew') row = row + 1 self.message_label = msg # PDB's panel self.pdbs = Tkinter.Frame(parent) self.pdbs.grid(row=3, column=0, sticky='ew') self.pdbs.columnconfigure(1, weight=1) from chimera.widgets import MoleculeScrolledListBox, \ ModelOptionMenu self.modelList = MoleculeScrolledListBox( self.pdbs, labelpos='nw', label_text="Target PDBs to be fitted:", listbox_selectmode='extended', listbox_height=11) self.modelList.grid(row=row, column=0, sticky='nsew') self.pdbs.rowconfigure(row, weight=1) self.pdbs.columnconfigure(0, weight=1) self.modelList1 = MoleculeScrolledListBox( self.pdbs, labelpos='nw', label_text="Target PDBs to be fixed:", listbox_selectmode='extended', listbox_height=11) self.modelList1.grid(row=row, column=1, sticky='nsew') self.pdbs.rowconfigure(row, weight=1) self.pdbs.columnconfigure(0, weight=1) row += 1 # Disable Results panel at first self.results_button = self.buttonWidgets['Results'] self.results_button['state'] = 'disabled'
def fillInUI(self, parent): self.toplevel_widget = parent.winfo_toplevel() self.toplevel_widget.withdraw() row = 0 import Tkinter from CGLtk import Hybrid from surfcaps import capper c = capper() cp = Hybrid.Checkbutton(parent, 'Cap surfaces at clip planes', c.caps_shown()) cp.button.grid(row=row, column=0, sticky='w') row = row + 1 self.show_caps = cp.variable self.show_caps.add_callback(self.settings_changed_cb) ccf = Tkinter.Frame(parent) ccf.grid(row=row, column=0, sticky='w') row = row + 1 ucc = Hybrid.Checkbutton(ccf, 'Use cap color ', not c.cap_color is None) ucc.button.grid(row=0, column=0, sticky='w') self.use_cap_color = ucc.variable self.use_cap_color.add_callback(self.settings_changed_cb) from CGLtk.color import ColorWell cc = ColorWell.ColorWell(ccf, callback=self.settings_changed_cb) self.cap_color = cc rgba = c.cap_color if rgba is None: rgba = (1, 1, 1, 1) cc.showColor(rgba, doCallback=0) cc.grid(row=0, column=1, sticky='w') cs = Hybrid.Radiobutton_Row(parent, 'Cap style: ', ('solid', 'mesh'), self.settings_changed_cb) cs.frame.grid(row=row, column=0, sticky='w') if c.mesh_style: style = 'mesh' else: style = 'solid' cs.variable.set(style, invoke_callbacks=False) row = row + 1 self.cap_style = cs.variable sf = Hybrid.Entry(parent, 'Mesh subdivision factor', 4, '%g' % c.subdivision_factor) sf.frame.grid(row=row, column=0, sticky='w') row = row + 1 self.subdivision_factor = sf.variable sf.entry.bind('<KeyPress-Return>', self.settings_changed_cb) cd = Hybrid.Entry(parent, 'Cap to clip plane distance', 5, '%.3g' % c.cap_offset) cd.frame.grid(row=row, column=0, sticky='w') row = row + 1 self.cap_offset = cd.variable cd.entry.bind('<KeyPress-Return>', self.settings_changed_cb) import SimpleSession chimera.triggers.addHandler(SimpleSession.SAVE_SESSION, self.save_session_cb, None) chimera.replyobj.status("Capping surfaces might reduce responsiveness", color="orange red")
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.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): from sys import getrefcount import Tkinter, Pmw top = parent.winfo_toplevel() menubar = Tkinter.Menu(top, type="menubar", tearoff=False) top.config(menu=menubar) 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 from CGLtk.Table import SortableTable self.cavityTable = SortableTable(parent, menuInfo= (self.columnMenu, prefs, dict.fromkeys( defaults[SHOWN_COLS], True), False)) if not self.tableData: from CASTp import mouthFieldNames, pocketFieldNames # add preferred columns first shownCols = prefs[SHOWN_COLS] for fn in ("ID", "MS volume", "SA volume", "pocket MS area", "pocket SA area", "# openings"): if fn[0] == '#' or fn == "ID": kw = {'format': "%d"} else: kw = {'format': "%6.1f", 'font': "TkFixedFont"} self.cavityTable.addColumn(fn, "lambda c: " "c.pocketInfo['%s']" % fn, **kw) for fn in ("mouth MS area", "mouth SA area", "MS circumference sum", "SA circumference sum"): self.cavityTable.addColumn(fn, "lambda c: " "c.mouthInfo['%s']" % fn, format="%6.1f", font='TkFixedFont') for fieldNames, attrName in [ (pocketFieldNames, "pocketInfo"), (mouthFieldNames, "mouthInfo")]: for fn in fieldNames: if fn[0] == '#' or fn == "ID": kw = {'format': "%d"} else: kw = {'format': "%6.1f", 'font': "TkFixedFont"} c = self.cavityTable.addColumn(fn, "lambda c: " "getattr(c, '%s')['%s']" % (attrName, fn), **kw) if fn == "ID": self.cavityTable.sortBy(c) self.cavityTable.sortBy(c) self.cavityTable.setData(self.cavities) self.cavityTable.launch(browseCmd=self._selCavityCB, restoreInfo=self.tableData) self.cavityTable.grid(row=row, column=0, sticky="nsew") parent.rowconfigure(row, weight=1) parent.columnconfigure(0, weight=1) row += 1 grp = Pmw.Group(parent, tag_text="Treatment of Chosen Pocket Atoms") grp.grid(row=row) checkFrame = grp.interior() from CGLtk import Hybrid def buttonCB(s=self): self._selCavityCB(self.cavityTable.selected()) self.doSelect = Hybrid.Checkbutton(checkFrame, "Select", prefs[DO_SELECT]) self.doSelect.variable.add_callback(buttonCB) self.doSelect.button.grid(row=0, sticky='w') f = Tkinter.Frame(checkFrame) f.grid(row=1, sticky='w') self.doColor = Hybrid.Checkbutton(f, "Color", prefs[DO_COLOR]) self.doColor.variable.add_callback(buttonCB) self.doColor.button.grid(row=0, column=0) from CGLtk.color.ColorWell import ColorWell self.pocketColor = ColorWell(f, color=prefs[POCKET_COLOR], noneOkay=True) self.pocketColor.grid(row=0, column=1) Tkinter.Label(f, text=" (and color all other atoms ").grid( row=0, column=2) self.nonpocketColor = ColorWell(f, color=prefs[NONPOCKET_COLOR], noneOkay=True) self.nonpocketColor.grid(row=0, column=3) Tkinter.Label(f, text=")").grid(row=0, column=4) self.doSurface = Hybrid.Checkbutton(checkFrame, "Surface", prefs[DO_SURFACE]) self.doSurface.variable.add_callback(buttonCB) self.doSurface.button.grid(row=2, sticky='w') self.doZoom = Hybrid.Checkbutton(checkFrame, "Zoom in on", prefs[DO_ZOOM]) self.doZoom.variable.add_callback(buttonCB) self.doZoom.button.grid(row=3, sticky='w') self.excludeMouth = Hybrid.Checkbutton(checkFrame, "Exclude mouth atoms", prefs[EXCLUDE_MOUTH]) self.excludeMouth.variable.add_callback(buttonCB) self.excludeMouth.button.grid(row=4, sticky='w') row += 1
def fillInUI(self, parent): self.key_buffer = '' self.key_callback_registered = None self.time_out_id = None import Accelerators self.preferences = Accelerators.accelerator_preferences_category() self.top = parent.winfo_toplevel() self.top.wm_withdraw() # Do not show automatically when dialog created parent.columnconfigure(0, weight = 1) row = 0 import Tkinter from CGLtk import Hybrid al = Hybrid.Scrollable_List(parent, 'Available shortcuts', 10, self.accelerator_selection_cb) self.accelerator_listbox = al.listbox al.frame.grid(row = row, column = 0, sticky = 'news') parent.rowconfigure(row, weight = 1) row = row + 1 fi = Hybrid.Entry(parent, 'Filter list ', 20) fi.entry.bind('<KeyRelease>', self.filter_cb) fi.frame.grid(row = row, column = 0, sticky = 'ew') self.filter_text = fi.variable row = row + 1 ao = Hybrid.Checkbutton(parent, 'Enable keyboard shortcuts', False) ao.button.grid(row = row, column = 0, sticky = 'w') row = row + 1 ao.callback(self.activate_accelerators_cb) self.active_var = ao.variable from chimera import statusline sl = Hybrid.Checkbutton(parent, 'Show main window status line', statusline.status_line_shown()) sl.button.grid(row = row, column = 0, sticky = 'w') row = row + 1 sl.callback(self.status_line_cb) self.status_line_var = sl.variable from chimera import triggers triggers.addHandler('status line', self.status_line_visibility_cb, None) rf = Tkinter.Frame(parent) rf.grid(row = row, column = 0, sticky = 'w') row = row + 1 rb = Tkinter.Button(rf, text = 'Load', command = self.load_cb) rb.grid(row = 0, column = 0, sticky = 'w') afl = Tkinter.Label(rf, text = ' shortcuts file') afl.grid(row = 0, column = 1, sticky = 'w') path = self.preferences['path'] # Path might be None af = Hybrid.Entry(parent, '', 20, path) af.entry.xview_moveto(1) # show right most part of path af.entry.bind('<KeyPress-Return>', self.load_cb) af.frame.grid(row = row, column = 0, sticky = 'ew') row = row + 1 self.accelerator_file = af.variable tot = self.preferences['time out'] tm = Hybrid.Entry(parent, 'Key press time-out (seconds) ', 3, tot) tm.frame.grid(row = row, column = 0, sticky = 'w') row = row + 1 self.time_out = tm.variable self.time_out.add_callback(self.time_out_changed_cb) # # Specify a label width so dialog is not resized for long messages. # msg = Tkinter.Label(parent, width = 30, anchor = 'w', justify = 'left') msg.grid(row = row, column = 0, sticky = 'ew') row = row + 1 self.message_label = msg self.load_accelerators()
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.averaging_interval = 1 # seconds self.target_fps = 10.0 # frames per second self.standard_window_size = (512, 512) self.initial_size = 32 self.frame_rate_timer = Frame_Rate_Timer(self.report_actual_frame_rate, self.averaging_interval) hb = self.buttonWidgets['Halt'] self.halt_button = hb hb['state'] = 'disabled' rs = self.buttonWidgets['Report Scores'] self.report_button = rs rs['state'] = 'disabled' import Tkinter from CGLtk import Hybrid row = 0 parent.columnconfigure(0, weight=1) rt = Hybrid.Scrollable_Text(parent, None, 15, horizontal_scroll=False) rt.text['width'] = 50 rt.text['wrap'] = 'word' self.results_box = rt.text rt.frame.grid(row=row, column=0, sticky='news') parent.rowconfigure(row, weight=1) row = row + 1 descrip = ( 'Running benchmarks takes 5-10 minutes to complete.\n\n' + 'Measure graphics card and CPU performance ' + 'for volume data rendering. The scores ' + 'give the edge size of a cubic volume data ' + 'array such that rendering or contouring or recoloring ' + 'can be performed %.0f ' % self.target_fps + 'times per second.\n\n' + 'The surface and mesh benchmarks measure the ' + 'rendering rates for triangles and lines respectively. ' + 'The contour benchmark measures ' + 'CPU and memory performance. ' + 'The solid benchmark measures 2 dimensional texture ' + 'mapping performance. The recolor benchmark measures ' + 'bandwidth to the graphics card.\n\n' + 'The frame rate buttons give the redraw ' + 'rate for your currently displayed view ' + 'reported at one second intervals.\n\n' + 'The molecule benchmark measures and reports frames per ' 'second when displaying different representations of molecules, ' 'and operations per second for the Ops call.\n\n' 'For an accurate benchmark, please do not use the CPU for other ' 'tasks while benchmarks are running, and leave the entire Chimera ' 'graphics window visible.\n\n') self.show_result(descrip) self.results_box.see('1.0') frf = Tkinter.Frame(parent) frf.grid(row=row, column=0, sticky='w') row = row + 1 mr = Hybrid.Checkbutton(frf, 'Measure frame rate continuously or ', False) mr.button.grid(row=0, column=0, sticky='w') self.monitor_frame_rate = mr.variable self.monitor_frame_rate.add_callback(self.monitor_cb) frb = Tkinter.Button(frf, text='one time', command=self.actual_frame_rate) frb.grid(row=0, column=1, sticky='w') it = Hybrid.Checkbutton(parent, 'Show individual test controls', False) it.button.grid(row=row, column=0, sticky='w') row = row + 1 itf = Tkinter.Frame(parent) itf.grid(row=row, column=0, sticky='w') row = row + 1 trow = 0 it.popup_frame(itf) it.popup_frame_cb() # Hide panel bmb = Hybrid.Button_Row(itf, 'Run', (('molecule', self.molSphere_benchmark), ('surface', self.surface_benchmark), ('mesh', self.mesh_benchmark), ('contour', self.contour_benchmark), ('solid', self.solid_benchmark), ('recolor', self.recolor_benchmark))) bmb.frame.grid(row=trow, column=0, sticky='w') trow += 1 smf = Tkinter.Frame(itf) smf.grid(row=trow, column=0, sticky='w') trow += 1 sml = Hybrid.Entry(smf, 'Show standard model, size ', 4, repr(self.initial_size)) sml.frame.grid(row=0, column=0, sticky='w') self.standard_model_size_var = sml.variable smb = Hybrid.Button_Row(smf, ', ', ( ('surface', self.standard_surface), ('mesh', self.standard_mesh), ('solid', self.standard_solid), )) smb.frame.grid(row=0, column=1, sticky='w') sv = Hybrid.Button_Row(itf, 'Set standard view', ( ('camera', self.set_standard_camera_parameters), ('window size', self.set_standard_window_size), )) sv.frame.grid(row=trow, column=0, sticky='w') trow += 1 sf = Tkinter.Frame(parent) sf.grid(row=row, column=0, sticky='w') row += 1 sb = Tkinter.Button(sf, text='Show', command=self.show_scores_web_page) sb.grid(row=0, column=0, sticky='w') sl = Tkinter.Label(sf, text=' scores reported by others') sl.grid(row=0, column=1, sticky='w')
def fillInUI(self, parent): self.last_xy = None import Tkinter from CGLtk import Hybrid parent.columnconfigure(0, weight = 1) row = 0 cr = Hybrid.Checkbutton(parent, 'Constrain mouse rotations', 0) cr.button.grid(row = row, column = 0, sticky = 'w') row = row + 1 self.constrain_rotations = cr.variable cr.callback(self.constrain_rotation_cb) raf = Tkinter.Frame(parent) raf.grid(row = row, column = 0, sticky = 'w') row = row + 1 ra = Hybrid.Entry(raf, 'Axis ', 8, '0 0 1') ra.frame.grid(row = 0, column = 0, sticky = 'w') self.rot_axis = ra.variable rotx_cb = lambda v=self.rot_axis: v.set('1 0 0') roty_cb = lambda v=self.rot_axis: v.set('0 1 0') rotz_cb = lambda v=self.rot_axis: v.set('0 0 1') rab = Hybrid.Button_Row(raf, ' ', (('x', rotx_cb), ('y', roty_cb), ('z', rotz_cb))) rab.frame.grid(row = 0, column = 1, sticky = 'w') rof = Tkinter.Frame(parent) rof.grid(row = row, column = 0, sticky = 'w') row = row + 1 ro = Hybrid.Entry(rof, 'Origin ', 8, '0 0 0') ro.frame.grid(row = 0, column = 0, sticky = 'w') self.rot_origin = ro.variable zorigin_cb = lambda v=self.rot_origin: v.set('0 0 0') rob = Hybrid.Button_Row(rof, ' ', (('zero', zorigin_cb), ('center', self.set_rotation_origin_at_center),)) rob.frame.grid(row = 0, column = 1, sticky = 'w') sep = Tkinter.Frame(parent, relief = Tkinter.GROOVE, borderwidth=1, height=2) sep.grid(row = row, column = 0, sticky = 'ew', pady = 10) row = row + 1 tr = Hybrid.Checkbutton(parent, 'Constrain mouse translations', 0) tr.button.grid(row = row, column = 0, sticky = 'w') row = row + 1 self.constrain_translations = tr.variable tr.callback(self.constrain_translation_cb) taf = Tkinter.Frame(parent) taf.grid(row = row, column = 0, sticky = 'w') row = row + 1 ta = Hybrid.Entry(taf, 'Axis ', 8, '0 0 1') ta.frame.grid(row = 0, column = 0, sticky = 'w') self.trans_axis = ta.variable tx_cb = lambda v=self.trans_axis: v.set('1 0 0') ty_cb = lambda v=self.trans_axis: v.set('0 1 0') tz_cb = lambda v=self.trans_axis: v.set('0 0 1') tab = Hybrid.Button_Row(taf, ' ', (('x', tx_cb), ('y', ty_cb), ('z', tz_cb))) tab.frame.grid(row = 0, column = 1, sticky = 'w') ttf = Tkinter.Frame(parent) ttf.grid(row = row, column = 0, sticky = 'w') row = row + 1 tt = Hybrid.Option_Menu(ttf, 'Allow only ', 'parallel', 'perpendicular') tt.variable.set('parallel') tt.frame.grid(row = 0, column = 0, sticky = 'w') self.translation_type = tt.variable tl = Tkinter.Label(ttf, text = ' motion') tl.grid(row = 0, column = 1, sticky = 'w') sep = Tkinter.Frame(parent, relief = Tkinter.GROOVE, borderwidth=1, height=2) sep.grid(row = row, column = 0, sticky = 'ew', pady = 10) row = row + 1 rl = Tkinter.Label(parent, text = 'Axis and origin relative to') rl.grid(row = row, column = 0, sticky = 'w') row = row + 1 mmf = Tkinter.Frame(parent) mmf.grid(row = row, column = 0, sticky = 'w') row = row + 1 mm = Hybrid.Option_Menu(mmf, 'model ') mm.frame.grid(row = 0, column = 0, sticky = 'w') self.model_menu = mm self.model_name = mm.variable from chimera import openModels openModels.addAddHandler(self.model_list_changed_cb, None) openModels.addRemoveHandler(self.model_list_changed_cb, None) ml = Tkinter.Label(mmf, text = ' coordinates.') ml.grid(row = 0, column = 1, sticky = 'w') self.update_model_menu() self.register_mouse_modes()