def __init__(self, parent): from chimera.tkoptions import IntOption, FloatOption Tkinter.Frame.__init__(self, parent) self.nsteps = IntOption(self, 0, "Steps", 100, None) self.stepsize = FloatOption(self, 1, "Step size (A)", 0.02, None, min=0.0001, max=1.0) self.interval = IntOption(self, 2, "Update interval", 10, None) self.freeze = FreezeOption(self, 3, "Fixed atoms", base.FreezeNone, None)
def fillInUI(self, parent): from chimera.tkoptions import IntOption, BooleanOption, \ FloatOption Tkinter.Label(parent, text="Cluster trajectory", relief="ridge", bd=4).grid(row=0, column=0, columnspan=2, sticky="ew") startFrame = self.movie.startFrame endFrame = self.movie.endFrame self.startFrame = IntOption(parent, 1, "Starting frame", startFrame, None, min=startFrame, max=endFrame, width=6) numFrames = endFrame - startFrame + 1 defStride = 1 + int(numFrames / 300) self.stride = IntOption(parent, 2, "Step size", defStride, None, min=1, max=numFrames, width=3) self.endFrame = IntOption(parent, 3, "Ending frame", endFrame, None, min=startFrame, max=endFrame, width=6) self.useSel = BooleanOption( parent, 4, "Cluster based on " "current selection, if any", True, None) self.ignoreBulk = BooleanOption(parent, 5, "Ignore solvent/" "ions", True, None) self.ignoreHyds = BooleanOption(parent, 6, "Ignore hydrogens", True, None)
def fillInUI(self, parent): from chimera.widgets import MoleculeOptionMenu from chimera.tkoptions import IntOption, BooleanOption, \ InputFileOption, StringOption, EnumOption import itertools info = Tk.Label(parent, justify=Tk.LEFT, wraplength=300, text= "Model alternate conformations of loops using " "Modeller from <http://salilab.org/>.\n" "First select the loops you wish to model." " Then choose the number of models " "you wish to generate.") info.pack(ipadx=2, ipady=2) options = Tk.Frame(parent) options.columnconfigure(0, pad=2) options.columnconfigure(1, pad=2) row = itertools.count() molRow = row.next() text = Tk.Label(options, text="Restrict selections to molecule:") text.grid(row=molRow, column=0) self.molecules = MoleculeOptionMenu(options) self.molecules.grid(row=molRow, column=1, sticky=Tk.W) self.turnsOnly = BooleanOption(options, row.next(), "Restrict selections to turns", True, None) self.hetatms = BooleanOption(options, row.next(), "Include HETATM residues", False, None) self.waters = BooleanOption(options, row.next(), "Include waters", False, None) self.waters.disable() self.nucleic = BooleanOption(options, row.next(), "Include nucleic acids", False, None) self.nucleic.disable() self.count = IntOption(options, row.next(), "Number of models", 10, None, min=1, sticky=Tk.W) #self.start = IntOption(options, row.next(), # "Starting model number", 1, None, min=0) class Refinement(EnumOption): values = ('very fast', 'fast', 'slow', 'very slow', 'slow large', 'none') self.refine = Refinement(options, row.next(), "Refinement", 'fast', None) button = Tk.Button(options, text="Prune selection", command=self.prune) button.grid(row=row.next(), column=0, columnspan=2, pady=2) self.start = 1 hr = Tk.Frame(options, relief=Tk.GROOVE, borderwidth=1, height=2) hr.grid(row=row.next(), columnspan=2, sticky='ew') # modeller location self.modeller = InputFileOption(options, row.next(), "Modeller location", "mod9v2", None) # temporary prefix -- TODO: add unique id #self.tempdir = StringOption(options, row.next(), # "Temporary file prefix", "modtmp", None) options.pack()
def fillInUI(self, parent): SaveModal.fillInUI(self, parent) parent = self.clientArea parent.columnconfigure(0, weight=1) parent.columnconfigure(1, weight=1) parent = Tk.Frame(parent) parent.grid() self.quality = IntOption(parent, 0, 'JPEG quality', DEFAULT_JPEG_QUALITY, None, min=5, max=95, width=4, sticky=Tk.E) if self.millerBrowser.getFilter() != 'JPEG': self.quality.gridUnmanage()
def fillInUI(self, parent): OpenModeless.fillInUI(self, parent) group = Pmw.Group(self.clientArea, tag_text='Further info') group.grid(row=0, column=0, sticky='nsew') self.catName = StringOption(group.interior(), 0, "group name", None, None) class PBLineWidthOption(LineWidthOption): default = prefs["line width"] balloon = "Width of pseudobonds (in pixels)" self.lineWidth = PBLineWidthOption(group.interior(), 1, None, None, None) self.clearCat = BooleanOption(group.interior(), 2, "clear group of previous pseudobonds", 1, None) self.leftModel = IntOption(group.interior(), 3, "first column specifiers default to model", 0, None) self.rightModel = IntOption( group.interior(), 4, "second column specifiers default to model", 0, None)
def fillInUI(self, parent): from chimera.widgets import MoleculeScrolledListBox self.molListBox = MoleculeScrolledListBox(parent, listbox_selectmode='extended', labelpos='w', label_text="Molecules to combine/copy:") if self.initModels: self.molListBox.setvalue(self.initModels) self.molListBox.grid(row=0, column=0, columnspan=2, sticky="nsew") parent.rowconfigure(0, weight=1) parent.columnconfigure(1, weight=1) from chimera.tkoptions import StringOption, IntOption self.molNameEntry = StringOption(parent, 1, "New model's" " name", "combination", None) curIDs = set([i1 for i1, i2 in openModels.listIds()]) mid = 0 while mid in curIDs: mid += 1 self.modelID = IntOption(parent, 2, "New model's ID", mid, None) from chimera.widgets import MoleculeOptionMenu self.refMolMenu = MoleculeOptionMenu(parent, labelpos='w', label_text="Coordinate system of:", initialitem=self.initModels[0]) self.refMolMenu.grid(row=3, column=0, columnspan=2, sticky='w') import Pmw chb = self.chainHandlingButtons = Pmw.RadioSelect(parent, buttontype="radiobutton", labelpos='w', label_text="If original molecules have duplicate\n" "single-letter chain IDs, then:", orient="vertical") self.buttonTexts = ["rename them uniquely", "retain them (residues may be renumbered)"] for bt in self.buttonTexts: chb.add(bt) chb.setvalue(self.buttonTexts[0]) chb.grid(row=4, column=0, columnspan=2) import Tkinter self.closeModelsVar = Tkinter.IntVar(parent) self.closeModelsVar.set(False) Tkinter.Checkbutton(parent, text="Close source models", variable=self.closeModelsVar).grid( row=5, column=0, columnspan=2)
def _fillLabelsPage(self, page): page.columnconfigure(0, weight=1) page.columnconfigure(1, weight=1) page.columnconfigure(2, weight=1) row = 0 from CGLtk.Table import SortableTable self.labelTable = SortableTable(page, automultilineHeaders=False) self.labelTable.addColumn("Label [(x, y) text]", self._labelListing, anchor='w') self.labelTable.addColumn("Shown", "shown", format=bool) self.labelTable.setData(self.model.labels) self.labelTable.launch(browseCmd=self._tableCB, selectMode="single") self.labelTable.grid(row=row, column=0, columnspan=3, sticky="nsew") page.rowconfigure(row, weight=1) row += 1 self.labelText = Pmw.ScrolledText(page, labelpos='w', label_text="Text", text_height=3, text_width=20, text_wrap='none', text_state='disabled', text_exportselection=False) text = self.labelText.component('text') text.bind("<<Modified>>", self._textCB) text.bind("<<Selection>>", self._updateTextAttrWidgets) self.labelText.grid(row=row, column=0, sticky='nsew', columnspan=3) page.rowconfigure(row, weight=1) row += 1 self.labelSymbolMenu = Pmw.OptionMenu( page, labelpos='w', label_text="Insert symbol:", command=self._insertSymbol, items=[ u'\N{GREEK SMALL LETTER ALPHA}', u'\N{GREEK SMALL LETTER BETA}', u'\N{GREEK SMALL LETTER GAMMA}', u'\N{GREEK SMALL LETTER DELTA}', u'\N{GREEK SMALL LETTER EPSILON}', u'\N{GREEK SMALL LETTER PI}', u'\N{GREEK SMALL LETTER PHI}', u'\N{GREEK SMALL LETTER CHI}', u'\N{GREEK SMALL LETTER PSI}', u'\N{GREEK SMALL LETTER OMEGA}', u'\N{LEFTWARDS ARROW}', u'\N{RIGHTWARDS ARROW}', u'\N{LEFT RIGHT ARROW}', u'\N{UPWARDS ARROW}', u'\N{DOWNWARDS ARROW}', u'\N{SUPERSCRIPT TWO}', u'\N{SUPERSCRIPT THREE}', u'\N{DEGREE SIGN}', u'\N{LATIN CAPITAL LETTER A WITH RING ABOVE}', "more..." ]) self.labelSymbolMenu.grid(row=row, column=0, columnspan=3) row += 1 colorHouse = Pmw.LabeledWidget(page, labelpos='w', label_text="Color") colorHouse.grid(row=row, column=0, rowspan=3) from CGLtk.color.ColorWell import ColorWell self.colorWell = ColorWell(colorHouse.interior(), color=self._contrastWithBG(), callback=self._colorCB) self.colorWell.grid() from chimera.tkoptions import IntOption self.labelFontSize = IntOption(page, row, "Font size", 24, self._labelChangeCB, startCol=1, min=1, attribute="size", width=3) row += 1 self.labelFontStyle = FontStyle(page, row, "Font style", oglFont.normal, self._labelChangeCB, startCol=1) row += 1 self.labelFontTypeface = FontTypeface(page, row, "Font typeface", FONT_TYPEFACE_VALUES[0], self._labelChangeCB, startCol=1) row += 1 if self.model.curLabel: self.changeToLabel(self.model.curLabel, force=True)
def _fillColorKeyPage(self, page): from chimera.tkoptions import IntOption, EnumOption, \ BooleanOption, RGBAOption f = Tkinter.Frame(page) f.grid(row=0, columnspan=2) self.numComponents = IntOption(f, 0, "Number of colors/labels", 3, self._componentsCB, min=2, width=2) self.componentsFrame = Tkinter.Frame(page) self.componentsFrame.grid(row=1, column=0, sticky="nsew", columnspan=2) page.columnconfigure(0, weight=1) self.componentsFrame.columnconfigure(1, weight=1) class ColorTreatment(EnumOption): values = ("distinct", "blended") self.colorTreatment = ColorTreatment( page, 2, "Color range depiction", "blended", self._keyChangeCB, balloon="Should colors be shown as distinct rectangles" " or as a continuous range") class LabelPosition(EnumOption): values = ("left/top", "right/bottom") self.labelPos = LabelPosition( page, 3, "Label positions", "right/bottom", self._keyChangeCB, balloon="Position of" " labels relative to color key.\nLabels always" " positioned adjacent to long side.") self.labelColor = RGBAOption( page, 4, "Label color", self._contrastWithBG(), self._keyChangeCB, balloob="Label color. If set to 'No color', use corresponding" " key color", noneOkay=True) class LabelJustification(EnumOption): values = ("left", "decimal point", "right") self.justification = LabelJustification( page, 5, "Label justification", "decimal point", self._keyChangeCB, balloon="Justification of label text" " in a vertical key layout.\nHorizontal key labels will" " always be center justified.") self.labelOffset = IntOption(page, 6, "Label offset", 0, self._keyChangeCB, width=3, balloon="Additional offset" " of labels from color bar, in pixels") self.keyFontSize = IntOption(page, 7, "Font size", 24, self._keyChangeCB, width=3) self.keyFontStyle = FontStyle(page, 8, "Font style", oglFont.normal, self._keyChangeCB) self.keyFontTypeface = FontTypeface(page, 9, "Font typeface", FONT_TYPEFACE_VALUES[0], self._keyChangeCB) self.borderColor = RGBAOption( page, 10, "Border color", None, self._keyChangeCB, balloon="Color of border" " around color key (not each individual color).\n" "If 'no color', then no border is drawn.") self.borderWidth = IntOption(page, 11, "Border width", 3, self._keyChangeCB, balloon="in pixels") self.tickMarks = BooleanOption(page, 12, "Show tick marks", False, self._keyChangeCB, balloon="Show tick marks" " pointing from key to labels") self._componentsCB(self.numComponents)
def fillInUI(self, parent): SaveModeless.fillInUI(self, parent) self.clientArea.columnconfigure(1, weight=1) startFrame = self.movie.startFrame endFrame = self.movie.endFrame from chimera.tkoptions import IntOption, BooleanOption, \ FloatOption, StringOption self.startFrame = IntOption(self.clientArea, 0, "Starting frame", startFrame, None, min=startFrame, max=endFrame, width=6) numFrames = endFrame - startFrame + 1 defStride = 1 + int(numFrames / 300) self.stride = IntOption(self.clientArea, 2, "Step size", defStride, None, min=1, max=numFrames, width=3) self.endFrame = IntOption(self.clientArea, 3, "Ending frame", endFrame, None, min=startFrame, max=endFrame, width=6) self.roundtrip = BooleanOption( self.clientArea, 4, "Encode" ' forward then backward ("roundtrip")', prefs[RECORDER_ROUNDTRIP], None, balloon="Encode the frames in forward and then reverse\n" "order so that if the movie is played as a loop\n" "the motion seems continuous") class FrameQuality(BooleanOption): labels = ["screen", "supersampled"] self.supersample = FrameQuality( self.clientArea, 5, "Frame quality", prefs[RECORDER_SUPERSAMPLE], self.supersampleCB, balloon="Whether each frame should be taken as is from\n" "the screen (fast) or redrawn at higher quality\n" "with several samples per pixel.") from chimera.printer import SupersampleOption self.samples = SupersampleOption(self.clientArea, 6, "Samples", prefs[RECORDER_SAMPLES], None) self.supersampleCB() self.raytrace = BooleanOption(self.clientArea, 7, "Raytrace" " with POV-Ray", prefs[RECORDER_RAYTRACE], None) def povOptCB(): from chimera.dialogs import display d = display("preferences") from chimera.printer import POVRAY_SETUP d.setCategoryMenu(POVRAY_SETUP) Tkinter.Button(self.clientArea, text="POV-Ray Options", pady=0, command=povOptCB).grid(row=8, column=0, columnspan=2) self.recordArgs = StringOption( self.clientArea, 9, "Additional recording options", prefs[RECORDER_RECORD_ARGS], None, balloon="Options (other than 'supersample' and 'raytrace')\n" "for recording frames as per Chimera's 'movie record'" " command") self.encodeArgs = StringOption( self.clientArea, 10, "Additional encoding options", prefs[RECORDER_ENCODE_ARGS], None, balloon="Options (other than 'mformat', 'output', and\n" "'roundtrip') for composing the frames into the\n" "final animation as per Chimera's 'movie encode'\n" "command") Tkinter.Label(self.clientArea, text="On some computers it may be necessary to make sure" " that no\nwindows occlude the main Chimera graphics" " window (even\npartially) during non-raytraced movie" " recording").grid(row=11, column=0, columnspan=2)
def fillInUI(self, master): self._ModelTrigger = None #self._SetupTrigger = None self._SizeTrigger = None self.raytrace = None # Image Size imageSetup = Tix.LabelFrame(master, label="Image Size") imageSetup.pack(fill=Tk.X, ipadx=2, ipady=2) subframe = imageSetup.frame #subframe = Tk.Frame(imageSetup.frame) #subframe.pack(fill=Tk.BOTH, expand=1) # add in conversion factor for pixels and graphics screen from chimera import tkgui win = tkgui.app.graphics res = tkgui.getScreenMMWidth() / win.winfo_screenwidth() convert['pixels'] = mm2pt(res) self.matchAspect = Tk.BooleanVar(master) self.matchAspect.set(1) self.usePrint = Tk.BooleanVar(master) self.usePrint.set(preferences.get(IMAGE_SETUP, USE_PRINT_UNITS)) import itertools row = itertools.count() self.showUsePrint = Tk.Checkbutton(subframe, indicatoron=1, variable=self.usePrint, highlightthickness=0, text=USE_PRINT_UNITS, command=self._updateUsePrint) self.showUsePrint.grid(columnspan=2, row=row.next(), sticky=Tk.W) w, h = chimera.viewer.windowSize self.units = ImageUnitsOption(subframe, row.next(), UNITS, 'pixels', self.updateImageUnits) self.iWidth = FloatOption(subframe, row.next(), 'Image width', w, self.updateImageWidth, min=1e-10) self.iHeight = FloatOption(subframe, row.next(), 'Image height', h, self.updateImageHeight, min=1e-10) matchAspect = Tk.Checkbutton(subframe, indicatoron=1, variable=self.matchAspect, highlightthickness=0, text="Maintain current aspect ratio", command=self.updateMatchAspect) matchAspect.grid(columnspan=2, row=row.next(), sticky=Tk.W) self.grow = Tk.Button(imageSetup.frame, text="Grow to Fit", command=self.Resize, state=Tk.DISABLED) fitrow = row.next() self.grow.grid(row=fitrow, column=0, padx=2, pady=2, sticky=Tk.NSEW) self.shrink = Tk.Button(imageSetup.frame, text="Shrink to Fit", command=lambda f=self.Resize: f(False), state=Tk.DISABLED) self.shrink.grid(row=fitrow, column=1, padx=2, pady=2, sticky=Tk.NSEW) #fetch = Tk.Button(imageSetup.frame, text="Get Pixels", # command=self.fetchWindowSize) #fetch.grid(row=row.next(), column=0, padx=2, pady=2, sticky=Tk.NSEW) #calc = Tk.Button(imageSetup.frame, text="Image Setup", # command=self.showImageSetupDialog) #calc.grid(row=row.next(), column=1, padx=2, pady=2, sticky=Tk.NSEW) self.printRes = FloatOption(subframe, row.next(), DPI, preferences.get(IMAGE_SETUP, DPI), self._updatePrint, min=1) # Image Information info = Tix.LabelFrame(master, label="Image Information") info.pack(fill=Tk.X) d = Tk.Label(info.frame, text="Description:") d.grid(columnspan=2, row=0, column=0, sticky=Tk.W, padx=2, pady=1) self.description = Tk.Entry(info.frame) info.frame.grid_columnconfigure(0, weight=1) info.frame.grid_columnconfigure(1, weight=1) self.description.grid(columnspan=2, row=1, column=0, sticky=Tk.EW, padx=2, pady=2) imageCredits = Tk.Button(info.frame, text="Image Credits", command=self.showImageCreditsDialog) imageCredits.grid(row=2, column=0, padx=2, pady=2) credit = Tk.Button(info.frame, text="Citing Chimera", command=lambda: help.display("credits.html")) credit.grid(row=2, column=1, padx=2, pady=2) # Image camera self.raytrace = BooleanOption(master, -1, 'Raytrace with POV-Ray', False, self._updateRaytrace) self.raytraceOptions = Tk.Button(master, text=POVRAY_SETUP, command=self.showPOVRayOptions) self.raytraceOptions.pack() self.raytraceOptions.pack_forget() self.supersample = SupersampleOption(master, -1, SUPERSAMPLE, preferences.get(IMAGE_SETUP, SUPERSAMPLE), self._updateSS) self.adjustFOV = AdjustFOVOption(master, -1, ADJUST_FOV, preferences.get(IMAGE_SETUP, ADJUST_FOV), self._updateAdjustFOV) self.printMode = _PrintModeOption(master, -1, 'Image camera mode', _PrintModeOption.SAME, self._updatePrintMode) self.lenticular = IntOption(master, -1, 'Number of lenticular images', chimera.Camera.lenticularImageCount(), self._updateLenticular, min=2, width=4) self.lenticular.forget() # switch to user's prefered units self.adjust = convert['pixels'] units = preferences.get(IMAGE_SETUP, UNITS) self._updateUsePrint() self.units.set(units) self.updateImageUnits()
def fillInUI(self, parent): from chimera.tkoptions import IntOption, BooleanOption, \ FloatOption Tkinter.Label(parent, text="Create RMSD map of trajectory " "against itself", relief="ridge", bd=4).grid(row=0, column=0, columnspan=2, sticky="ew") startFrame = self.movie.startFrame endFrame = self.movie.endFrame self.startFrame = IntOption(parent, 1, "Starting frame", startFrame, None, min=startFrame, max=endFrame, width=6) numFrames = endFrame - startFrame + 1 defStride = 1 + int(numFrames / 300) self.stride = IntOption(parent, 2, "Step size", defStride, None, min=1, max=numFrames, width=3) self.endFrame = IntOption(parent, 3, "Ending frame", endFrame, None, min=startFrame, max=endFrame, width=6) self.minRmsd = FloatOption(parent, 4, "Lower RMSD threshold" " (white)", prefs[RMSD_MIN], None, width=6) self.maxRmsd = FloatOption(parent, 5, "Upper RMSD threshold" " (black)", prefs[RMSD_MAX], None, width=6) self.useSel = BooleanOption( parent, 6, "Restrict map to " "current selection, if any", True, None) self.ignoreBulk = BooleanOption(parent, 7, "Ignore solvent/" "ions", True, None) self.ignoreHyds = BooleanOption(parent, 8, "Ignore hydrogens", True, None) self.recolor = BooleanOption(parent, 9, "Auto-recolor for" " contrast", prefs[RMSD_AUTOCOLOR], None)
def fillInUI(self, parent): Tkinter.Label(parent, text="Collect positions of selected" " atoms over trajectory", relief="ridge", bd=4).grid(row=0, column=0, columnspan=2, sticky="ew") startFrame = self.movie.startFrame endFrame = self.movie.endFrame from chimera.tkoptions import IntOption, BooleanOption, \ FloatOption, StringOption self.startFrame = IntOption(parent, 1, "Starting frame", startFrame, None, min=startFrame, max=endFrame, width=6) numFrames = endFrame - startFrame + 1 defStride = 1 + int(numFrames / 300) self.stride = IntOption(parent, 2, "Step size", defStride, None, min=1, max=numFrames, width=3) self.endFrame = IntOption(parent, 3, "Ending frame", endFrame, None, min=startFrame, max=endFrame, width=6) self.doCutoff = BooleanOption( parent, 4, 'Limit data collection' ' to within cutoff distance of any "held steady" atoms', True, None) self.cutoff = FloatOption(parent, 5, "Cutoff distance", prefs[VOLUME_CUTOFF], None, width=4) self.resolution = FloatOption(parent, 6, "Volume grid spacing", prefs[VOLUME_RESOLUTION], None, min=0.0001, width=4) self.volumeName = StringOption(parent, 7, "Volume data name", self.movie.ensemble.name, None, width=20) self.byAtomType = BooleanOption( parent, 8, "Collect data" " separately for each atom type in selection", True, None, balloon="Create a volume data set for" " each type of atom type\n(sp2 oxygen, aromatic carbon," " etc.) in current selection")