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()
    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.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