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.model = None self.position_handler = None self.screen_position = (-.6, -.6) self.last_xyz_position = None self.frozen_model_list = [] self.toplevel_widget = parent.winfo_toplevel() self.toplevel_widget.withdraw() row = 0 import Tkinter from CGLtk import Hybrid sb = Hybrid.Checkbutton(parent, 'Show scale bar', 0) sb.button.grid(row=row, column=0, sticky='w') row = row + 1 self.show_scalebar = sb.variable self.show_scalebar.add_callback(self.settings_changed_cb) bf = Tkinter.Frame(parent) bf.grid(row=row, column=0, sticky='w') row = row + 1 le = Hybrid.Entry(bf, 'Length ', 5, '10') le.frame.grid(row=0, column=0, sticky='w') le.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.bar_length = le.variable te = Hybrid.Entry(bf, ' Thickness', 3, '1') te.frame.grid(row=0, column=1, sticky='w') te.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.bar_thickness = te.variable cl = Tkinter.Label(bf, text=' Color ') cl.grid(row=0, column=2, sticky='w') from CGLtk.color import ColorWell bc = ColorWell.ColorWell(bf, callback=self.settings_changed_cb) self.bar_color = bc bc.showColor((1, 1, 1), doCallback=0) bc.grid(row=0, column=3, sticky='w') lf = Tkinter.Frame(parent) lf.grid(row=row, column=0, sticky='w') row = row + 1 # \u00C5 is the Angstrom symbol lb = Hybrid.Entry(lf, 'Label ', 5, u'# \u00C5') lb.frame.grid(row=0, column=0, sticky='w') lb.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.label_text = lb.variable xo = Hybrid.Entry(lf, ' Offset ', 3, '') xo.frame.grid(row=0, column=1, sticky='w') xo.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.label_x_offset = xo.variable yo = Hybrid.Entry(lf, '', 3, '') yo.frame.grid(row=0, column=2, sticky='w') yo.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.label_y_offset = yo.variable ct = Tkinter.Label(lf, text=' Color ') ct.grid(row=0, column=3, sticky='w') from CGLtk.color import ColorWell lc = ColorWell.ColorWell(lf, callback=self.settings_changed_cb) self.label_color = lc lc.showColor((1, 1, 1), doCallback=0) lc.grid(row=0, column=4, sticky='w') ore = Hybrid.Radiobutton_Row(parent, 'Orientation ', ('horizontal', 'vertical'), self.orientation_cb) ore.frame.grid(row=row, column=0, sticky='w') row = row + 1 self.orientation = ore.variable self.orientation.set('horizontal', invoke_callbacks=0) pf = Tkinter.Frame(parent) pf.grid(row=row, column=0, sticky='w') row = row + 1 pp = Hybrid.Checkbutton(pf, 'Preserve screen position', 1) pp.button.grid(row=0, column=0, sticky='w') self.preserve_position = pp.variable self.preserve_position.add_callback(self.settings_changed_cb) xp = Hybrid.Entry(pf, '', 5, '') xp.frame.grid(row=0, column=1, sticky='w') xp.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.screen_x_position = xp.variable yp = Hybrid.Entry(pf, '', 5, '') yp.frame.grid(row=0, column=2, sticky='w') yp.entry.bind('<KeyPress-Return>', self.settings_changed_cb) self.screen_y_position = yp.variable self.set_screen_position_entries() mb = Hybrid.Checkbutton(parent, 'Move scale bar with data models locked', 0) mb.button.grid(row=row, column=0, sticky='w') row = row + 1 self.move_scalebar = mb.variable self.move_scalebar.add_callback(self.move_scalebar_cb) import SimpleSession chimera.triggers.addHandler(SimpleSession.SAVE_SESSION, self.save_session_cb, None) chimera.triggers.addHandler(chimera.CLOSE_SESSION, self.close_session_cb, None)
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.default_radius = 100 self.surface_model = None self.surface_piece = None self.toplevel_widget = parent.winfo_toplevel() self.toplevel_widget.withdraw() parent.columnconfigure(0, weight=1) row = 0 import Tkinter from CGLtk import Hybrid # Radius rs = Hybrid.Scale(parent, 'Radius ', 1, 1000, 0.01, self.default_radius) 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 # Interpolation factor between icosahedron and sphere sf = Hybrid.Scale(parent, 'Sphere factor ', 0, 1, .01, 0) sf.frame.grid(row=row, column=0, sticky='ew') row = row + 1 sf.callback(self.sphere_factor_changed_cb) sf.entry.bind('<KeyPress-Return>', self.sphere_factor_changed_cb) self.sphere_factor = sf # Orientation menu self.orient_222 = 'xyz 2-fold axes' self.orient_222r = 'xyz 2-fold axes, alt' self.orient_2n3 = 'x 2-fold, z 3-fold' self.orient_2n3r = 'x 2-fold, z 3-fold, alt' self.orient_2n5 = 'x 2-fold, z 5-fold' self.orient_2n5r = 'x 2-fold, z 5-fold, alt' self.orient_n25 = 'y 2-fold, z 5-fold' self.orient_n25r = 'y 2-fold, z 5-fold, alt' io = Hybrid.Option_Menu(parent, 'Orientation ', self.orient_222, self.orient_222r, self.orient_2n3, self.orient_2n3r, self.orient_2n5, self.orient_2n5r, self.orient_n25, self.orient_n25r) io.frame.grid(row=row, column=0, sticky='w') io.add_callback(self.show_cb) row = row + 1 self.orientation = io.variable # Subdivision factor sf = Tkinter.Frame(parent) sf.grid(row=row, column=0, sticky='w') row = row + 1 sb = Hybrid.Entry(sf, 'Subdivision factor ', 5, '1') sb.frame.grid(row=0, column=0, sticky='w') self.subdivision_factor = sb.variable sb.entry.bind('<KeyPress-Return>', self.show_cb) sp = Tkinter.Label(sf, text='') sp.grid(row=0, column=1, sticky='w') self.subdivision_spacing = sp # Surface style: filled, mesh st = Hybrid.Radiobutton_Row(parent, 'Surface style: ', ('solid', 'mesh'), self.style_changed_cb) st.frame.grid(row=row, column=0, sticky='w') st.variable.set('mesh', invoke_callbacks=False) row = row + 1 self.surface_style = st.variable # Color cf = Tkinter.Frame(parent) cf.grid(row=row, column=0, sticky='w') row = row + 1 cl = Tkinter.Label(cf, text='Color') cl.grid(row=0, column=0, sticky='w') initial_color = (.7, .7, .7, 1) from CGLtk.color import ColorWell cw = ColorWell.ColorWell(cf, callback=self.color_changed_cb) cw.showColor(initial_color) cw.grid(row=0, column=1, sticky='w') self.color = cw # # 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 import SimpleSession chimera.triggers.addHandler(SimpleSession.SAVE_SESSION, self.save_session_cb, None)