def Apply(self): if not self.propertyName.valid(): raise chimera.UserError( "Please enter valid attribute name") propName = self.propertyName.getvalue() pageName = self.notebook.getcurselection() if pageName == "Molecules": target = self.molChooser.getvalue() elif pageName == "Chains": target = self.chainChooser.getvalue() if not target: raise chimera.UserError( "Please select molecule or chain") opts = self.outputOptions.getvalue() rba = "rba" in opts save = "save" in opts show = "show" in opts serverName = self.serverChooser.getcurselection() f = self.Servers[serverName][1] parts = self.paramFrames[serverName][1] opts = self.Servers[serverName][3](self, parts) output = f(target, opts, propName, rba) if save: _save(output, show) elif show: # create temporary file and invoke browser from OpenSave import osTemporaryFile filename = osTemporaryFile(suffix=".html") f = open(filename, "w") f.write(output) f.close() import urllib from chimera import help help.display("file:" + urllib.pathname2url(filename))
def _insertSymbol(self, item): if len(item) > 1: from chimera import help help.display("ContributedSoftware/2dlabels/symbols.html") return if not self.model.labels: self.status("No labels have been created yet", color="red") return if not self.labelTable.selected(): self.status("No labels active", color="red") self.labelText.insert("insert", item) self.setLabelFromText()
def _fileChosen(okayed, dialog): if okayed: paths = dialog.getPaths() if paths: filename = paths[0] from OpenSave import osOpen outFile = osOpen(filename, "w") outFile.write(dialog._output) outFile.close() if dialog._show: import urllib from chimera import help help.display(urllib.pathname2url(filename)) delattr(dialog, "_output") delattr(dialog, "_show")
def __init__(self, parent): from Trajectory.prefs import prefs, INPUT_FILES inputPrefs = prefs[INPUT_FILES].setdefault(self.formatName, {}) self.options = [] for i in range(len(self.labels)): label = self.labels[i] self.options.append( InputFileOption(parent, i, label, inputPrefs.get(label, True), None, title="Choose %s File" % label, historyID="%s %s" % (self.formatName, label))) parent.columnconfigure(1, weight=1) f = Tkinter.Frame(parent) f.grid(row=len(self.labels), column=0, columnspan=2) Tkinter.Label(f, text="PSF/DCD support courtesy of").grid(row=0, column=0, sticky='e') from chimera import help Tkinter.Button(f, text="MDTools", padx=0, pady=0, command=lambda: help.display( "http://www.ks.uiuc.edu/~jim/mdtools/")).grid( row=0, column=1, sticky='w')
def __init__(self, parent): from Trajectory.prefs import prefs, INPUT_FILES inputPrefs = prefs[INPUT_FILES].setdefault(self.formatName, {}) self.options = [] for i in range(len(self.labels)): label = self.labels[i] self.options.append(InputFileOption(parent, i, label, inputPrefs.get(label, True), None, title="Choose %s File" % label, historyID="%s %s" % (self.formatName, label))) parent.columnconfigure(1, weight=1) f = Tkinter.Frame(parent) f.grid(row=len(self.labels), column=0, columnspan=2) Tkinter.Label(f, text="PSF/DCD support courtesy of" ).grid(row=0, column=0, sticky='e') from chimera import help Tkinter.Button(f, text="MDTools", padx=0, pady=0, command=lambda: help.display( "http://www.ks.uiuc.edu/~jim/mdtools/") ).grid(row=0, column=1, sticky='w')
def show_scores_web_page(self): url = 'http://www.cgl.ucsf.edu/chimera/benchmarks.html' from chimera.help import display display(url)
def Help(self): # implement our own help, since we want different # URLs depending on the current preferences category nameTag = self.menu.getcurselection() help.display("UsersGuide/preferences.html#%s" % nameTag)
def Tips(self): import help help.display(self.help + "#tips")
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 show_users_guide(): 'Show users guide in web browser' from chimera import help help.display('UsersGuide/index.html')