def __init__(self, master, model, height=300, width=800): FramePlot.FramePlot.__init__(self, master, model, xTitle="Glyco Score", yTitle="Counts") glyxtoolms.lib.Histogram.__init__(self, 0.2) self.canvas.config(height=height) self.canvas.config(width=width) self.master = master self.logScore = 0.0 self.NrXScales = 5.0 self.coord = Tkinter.StringVar() l = ttk.Label(self, textvariable=self.coord) l.grid(row=4, column=0, sticky="NS") self.keepZoom = Tkinter.IntVar() c = Appearance.Checkbutton(self, text="keep zoom fixed", variable=self.keepZoom) c.grid(row=5, column=0, sticky="NS") self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=1)
def addFont(self, frame, optionname, text): label = Appearance.Label(frame, text=text) label.grid(row=frame.row, column=0, sticky="NW") var = Tkinter.IntVar() var.set(self.master.options[optionname]["font"].config()["size"]) entry = Tkinter.Entry(frame, textvariable=var) entry.grid(row=frame.row, column=1, sticky="NW") entry.config(bg="white") var.trace("w", lambda a, b, c, d=optionname: self.setFontSize(a, b, c, d)) self.addVariable(optionname, "font", var) var.entry = entry frame.row += 1
def addPlotMargins(self): frame = self.addLabelFrame(text="margins") for name in ["left", "right", "bottom", "top"]: label = Appearance.Label(frame, text=name + " Margin: ") label.grid(row=frame.row, column=0, sticky="NW") var = Tkinter.IntVar() var.set(self.master.options["margins"][name]) var.trace("w", lambda a, b, c, d=name: self.setMargin(a, b, c, d)) entry = Tkinter.Entry(frame, textvariable=var) entry.grid(row=frame.row, column=1, sticky="NW") entry.config(bg="white") self.addVariable("margins", name, var) var.entry = entry frame.row += 1
def addFragmentHighlight(showName=None, text=None, colorName=None): if showName != None and text != None: var = Tkinter.BooleanVar() var.set(self.options["annotations"][showName]) optionsFrame.addVariable("annotations", showName, var) c = Appearance.Checkbutton(frame, text=text, variable=var) c.grid(row=frame.row, column=0, columnspan=2, sticky="NWS") var.trace("w", lambda a,b,c,d=showName,e=var: toggleVisbility(a,b,c,d,e)) if colorName != None: botton = Tkinter.Button(frame, text="Set Color") botton.grid(row=frame.row, column=2, sticky="NW") botton.config(fg=self.options["annotations"][colorName]) botton.config(activeforeground=self.options["annotations"][colorName]) botton.config(command=lambda a=colorName, b=botton: self.setColor(a,b)) frame.row += 1
def createOptions(self, optionsFrame): def togglePictogram(a, b, c, var): self.options["axislabel"]["showpicto"] = var.get() self._paintCanvas(False) super(OxoniumIonPlot, self).createOptions(optionsFrame) frameAxis = optionsFrame.getLabelFrame("Axis") pictogramVar = Tkinter.BooleanVar() pictogramVar.set(self.options["axislabel"]["showpicto"]) optionsFrame.addVariable("axislabel", "showPicto", pictogramVar) c = Appearance.Checkbutton(frameAxis, text="Use Glycan Pictograms", variable=pictogramVar) c.grid(row=frameAxis.row, column=0, columnspan=2, sticky="NWS") frameAxis.row += 1 pictogramVar.trace( "w", lambda a, b, c, d=pictogramVar: togglePictogram(a, b, c, d))
def __init__(self, master, model): AnnotatedPlot.AnnotatedPlot.__init__(self, master, model, xTitle="m/z", yTitle="Intensity [counts]") self.master = master self.consensus = None self.feature = None self.hit = None self.selectedFragments = [] self.NrXScales = 5.0 self.referenceMass = 0 self.annotationItems = {} self.annotations = {} self.currentAnnotation = None self.peaksByItem = {} self.coord = Tkinter.StringVar() l = ttk.Label(self, textvariable=self.coord) l.grid(row=4, column=0, sticky="NS") self.keepZoom = Tkinter.IntVar() c = Appearance.Checkbutton(self, text="keep zoom fixed", variable=self.keepZoom) c.grid(row=5, column=0, sticky="NS") self.grid_rowconfigure(0, weight=0) self.grid_rowconfigure(1, weight=1) self.grid_columnconfigure(0, weight=1) # register additional button bindings self.canvas.bind("<Button-2>", self.button2, "+") self.canvas.bind("<Button-3>", self.button3, "+")
def __init__(self, master, model): Tkinter.Toplevel.__init__(self, master=master) #self.minsize(600, 300) self.master = master self.title("Configure glyXtoolMS, and TOPPAS scripts") self.model = model self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=0) self.rowconfigure(1, weight=0) self.rowconfigure(2, weight=0) self.rowconfigure(3, weight=0) self.rowconfigure(4, weight=1) self.columnconfigure(0, weight=1) frameOpenMS = ttk.Labelframe(self, text="OpenMS/TOPPAS Installation") frameOpenMS.grid(row=0, column=0, sticky="NWES") frameOpenMS.columnconfigure(0, weight=0) frameOpenMS.columnconfigure(3, weight=1) buttonOpenMS = Tkinter.Button(frameOpenMS, text="Set OpenMS Path", command=self.setOpenMSPath) buttonOpenMS.grid(row=0, column=0, sticky="NWES") self.openMSPathVar = Tkinter.StringVar() self.openMSPathVar.set(self.model.openMSDir) self.openMSPathEntry = Tkinter.Entry(frameOpenMS, textvariable=self.openMSPathVar, width=60) self.openMSPathEntry.grid(row=0, column=1, columnspan=3, sticky="NWES") self.openMSPathEntry.config(bg="white") self.openMSPathVar.trace("w", self.setTOPPASButtonState) self.buttonScripts = Tkinter.Button(frameOpenMS, text="Copy SCRIPTS into OpenMS", command=self.copyTOPPASFiles) self.buttonScripts.grid(row=1, column=1) self.buttonWorkflows = Tkinter.Button( frameOpenMS, text="Edit Scriptspath in TOPPAS Workflows", command=self.editWorkflows) self.buttonWorkflows.grid(row=1, column=2) #frameOutput = ttk.Labelframe(self, text="Set TOPPAS output folder") #frameOutput.grid(row=1, column=0, sticky="NWES") #frameOutput.columnconfigure(0, weight=0) #frameOutput.columnconfigure(1, weight=1) #buttonOutput = Tkinter.Button(frameOutput, text="Set TOPPAS output folder", command=self.setTOPPASOutput) #self.outputVar = Tkinter.StringVar() #self.outputVar.set(self.model.toppasOutputDir) #entryOutput = Tkinter.Entry(frameOutput, textvariable=self.outputVar, width=60) #entryOutput.config(bg="white") # #buttonOutput.grid(row=0, column=0, sticky="NWES") #entryOutput.grid(row=0, column=1, sticky="NWES") frameWorkspace = ttk.Labelframe(self, text="Set Workspace") frameWorkspace.grid(row=2, column=0, sticky="NWES") frameWorkspace.columnconfigure(0, weight=0) frameWorkspace.columnconfigure(1, weight=1) buttonWorkspace = Tkinter.Button(frameWorkspace, text="Set workspace", command=self.setWorkspace) self.workspaceVar = Tkinter.StringVar() self.workspaceVar.set(self.model.workingdir) entryWorkspace = Tkinter.Entry(frameWorkspace, textvariable=self.workspaceVar, width=60) entryWorkspace.config(bg="white") buttonWorkspace.grid(row=0, column=0, sticky="NWES") entryWorkspace.grid(row=0, column=1, sticky="NWES") frameTimeAxis = ttk.Labelframe(self, text="Timeaxis") frameTimeAxis.grid(row=3, column=0, sticky="NWES") self.timeAxisVar = Tkinter.StringVar() self.timeAxisVar.set(self.model.timescale) timeAxisChoice1 = Appearance.Radiobutton(frameTimeAxis, text="In seconds", variable=self.timeAxisVar, value="seconds") timeAxisChoice2 = Appearance.Radiobutton(frameTimeAxis, text="In minutes", variable=self.timeAxisVar, value="minutes") timeAxisChoice1.grid(row=0, column=0, sticky="NWS") timeAxisChoice2.grid(row=0, column=1, sticky="NWS") frameError = ttk.Labelframe(self, text="Mass Error") frameError.grid(row=4, column=0, sticky="NWES") self.errorVar = Tkinter.StringVar() self.errorVar.set(self.model.errorType) errorChoice1 = Appearance.Radiobutton(frameError, text="In Dalton", variable=self.errorVar, value="Da") errorChoice2 = Appearance.Radiobutton(frameError, text="In ppm", variable=self.errorVar, value="ppm") errorChoice1.grid(row=0, column=0, sticky="NWS") errorChoice2.grid(row=0, column=1, sticky="NWS") frameClipboard = ttk.Labelframe(self, text="Clipboard") frameClipboard.grid(row=5, column=0, sticky="NWES") self.clipVar = Tkinter.StringVar() self.clipVar.set(self.model.clipboard) boards = ('osx', 'qt', 'xclip', 'xsel', 'klipper', 'windows') # test which boards are available here avlBoards = [] for board in boards: try: pyperclip.set_clipboard(board) avlBoards.append(board) except: pass avlBoards = ['Tkinter'] + avlBoards for i, board in enumerate(avlBoards): clipboardChoice = Appearance.Radiobutton(frameClipboard, text=board, variable=self.clipVar, value=board) clipboardChoice.grid(row=5 + i / 3, column=1 + i % 3, sticky="NWS") frameDifferences = ttk.Labelframe(self, text="Massdifferences") frameDifferences.grid(row=6, column=0, sticky="NWES") scrollbar = Tkinter.Scrollbar(frameDifferences) self.tree = ttk.Treeview(frameDifferences, yscrollcommand=scrollbar.set, selectmode='browse') self.columns = ("Mass", "Charge", "Type") self.tree["columns"] = self.columns self.tree.grid(row=0, column=0, sticky="NWES") self.tree["columns"] = self.columns self.tree.heading("#0", text="Name", command=lambda col="#0": self.sortColumn(col)) for col in self.columns: self.tree.heading(col, text=col, command=lambda col=col: self.sortColumn(col)) scrollbar.grid(row=0, column=1, sticky="NWES") scrollbar.config(command=self.tree.yview) self.tree.bind("<<TreeviewSelect>>", self.clickedTree) frameEntry = ttk.Labelframe(frameDifferences, text="Entry") frameEntry.grid(row=0, column=2, sticky="NWE") l1 = ttk.Label(frameEntry, text="Name:") l2 = ttk.Label(frameEntry, text="Mass:") l3 = ttk.Label(frameEntry, text="Charge:") l4 = ttk.Label(frameEntry, text="Type:") l1.grid(row=0, column=0, sticky="NW") l2.grid(row=1, column=0, sticky="NW") l3.grid(row=2, column=0, sticky="NW") l4.grid(row=3, column=0, sticky="NW") self.v1 = Tkinter.StringVar() self.v2 = Tkinter.StringVar() self.v3 = Tkinter.StringVar() self.v4 = Tkinter.StringVar() self.v1.trace("w", lambda a, b, c: self.valueChanged("v1")) self.v2.trace("w", lambda a, b, c: self.valueChanged("v2")) self.v3.trace("w", lambda a, b, c: self.valueChanged("v3")) self.v4.trace("w", lambda a, b, c: self.valueChanged("v4")) self.e1 = Tkinter.Entry(frameEntry, textvariable=self.v1) self.e2 = Tkinter.Entry(frameEntry, textvariable=self.v2) self.e3 = Tkinter.Entry(frameEntry, textvariable=self.v3) self.e4 = Tkinter.Entry(frameEntry, textvariable=self.v4) self.e1.grid(row=0, column=1, sticky="NW") self.e2.grid(row=1, column=1, sticky="NW") self.e3.grid(row=2, column=1, sticky="NW") self.e4.grid(row=3, column=1, sticky="NW") self.e1.config(bg="white") self.e2.config(bg="white") self.e3.config(bg="white") self.e4.config(bg="white") frameEntry2 = ttk.Frame(frameEntry) frameEntry2.grid(row=4, column=0, columnspan=2, sticky="NWES") self.b1 = Tkinter.Button(frameEntry2, text="Delete Entry", command=self.deleteEntry) self.b2 = Tkinter.Button(frameEntry2, text="New Entry", command=self.newEntry) self.b1.grid(row=0, column=0, sticky="SW") self.b2.grid(row=0, column=1, sticky="SE") # add data for mass, name, charge, typ in self.model.massdifferences: self.tree.insert("", "end", text=name, values=(str(round(mass, 4)), str(charge), typ)) self.sorting = ("#0", False) frameButtons = ttk.Frame(self) frameButtons.grid(row=7, column=0, sticky="NWES") cancelButton = Tkinter.Button(frameButtons, text="Cancel", command=self.cancel) self.saveButton = Tkinter.Button(frameButtons, text="Save options", command=self.save) cancelButton.grid(row=0, column=0, sticky="NWES") self.saveButton.grid(row=0, column=1, sticky="NWES") # run OpenMS Check self.setTOPPASButtonState() self.model.centerWidget(self.master, self)