Exemple #1
0
    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 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 chimera.widgets import MoleculeScrolledListBox
        self.molList = MoleculeScrolledListBox(parent,
                                               labelpos='w',
                                               listbox_selectmode="extended",
                                               label_text="Solvate:    ")
        self.molList.grid(row=0, column=0, sticky="nsew")
        self.solvateMethod = Pmw.RadioSelect(parent,
                                             buttontype='radiobutton',
                                             command=self.changeMethod,
                                             labelpos='w',
                                             label_text="Solvate method:")
        self.solvateMethod.add("Box")
        self.solvateMethod.add("Cap")
        self.solvateMethod.add("Oct")
        self.solvateMethod.add("Shell")
        self.solvateMethod.setvalue("Box")
        self.solvateMethod.grid(row=1, column=0, sticky="nsew")
        self.method = "Box"
        rcf1 = Tkinter.Frame(parent)
        rcf1.grid(row=2, column=0, sticky="nsew")
        self.solvent = prefs[SOLVENT_MODEL]

        from Solvate import ValidSolventModels
        self.solventModel = Pmw.OptionMenu(rcf1,
                                           label_text="Solvent Model:",
                                           labelpos='w',
                                           items=ValidSolventModels,
                                           initialitem=self.solvent,
                                           command=self.changeSolvent)
        self.solventModel.grid(row=0, column=0)

        rcf2 = Tkinter.Frame(rcf1)
        rcf2.grid(row=0, column=1)
        rcf1.columnconfigure(1, weight=1)
        self.extentLabel = Tkinter.Label(rcf2, text="Box size:")
        self.extentLabel.grid(row=0, column=0)

        self.extentValue = Hybrid.StringVariable(rcf2)
        ev = Tkinter.Entry(rcf2,
                           width=5,
                           textvariable=self.extentValue.tk_variable)
        ev.grid(row=0, column=1)

        rcf3 = Tkinter.Frame(parent)
        rcf3.grid(row=3, column=0)
        self.centerLabel = Tkinter.Label(rcf3,
                                         text="Cap center (in ambmask):",
                                         state='disabled')
        self.centerLabel.grid(row=0, column=0)

        self.centerValue = Hybrid.StringVariable(rcf3)
        self.centerEntry = Tkinter.Entry(
            rcf3,
            width=5,
            textvariable=self.centerValue.tk_variable,
            state='disabled')
        self.centerEntry.grid(row=0, column=1)

        self.removeExisting = Hybrid.Checkbutton(
            parent, "Remove existing ions/solvent", True)
        self.removeExisting.button.grid(row=4, column=0)

        parent.rowconfigure(0, weight=1)
        parent.columnconfigure(0, weight=1)