def body(self, guiParent): guiParent.grid_columnconfigure(0, weight=1) row = 0 guiParent.grid_rowconfigure(row, weight=1) inputFrame = LabelFrame(guiParent, text='Inputs:') inputFrame.grid(row=row, column=0, sticky=Tkinter.NSEW) label = Label(inputFrame, text='NOESY:') label.grid(row=0, column=0, sticky=Tkinter.NW) self.hNoesyPulldown = PulldownMenu(inputFrame,callback=self.setHNoesy) self.hNoesyPulldown.grid(row=0, column=1, sticky=Tkinter.NW) label = Label(inputFrame, text='15N NOESY:') label.grid(row=1, column=0, sticky=Tkinter.NW) self.nNoesyPulldown = PulldownMenu(inputFrame,callback=self.setNNoesy) self.nNoesyPulldown.grid(row=1, column=1, sticky=Tkinter.NW) label = Label(inputFrame, text='13C NOESY:') label.grid(row=2, column=0, sticky=Tkinter.NW) self.cNoesyPulldown = PulldownMenu(inputFrame,callback=self.setCNoesy) self.cNoesyPulldown.grid(row=2, column=1, sticky=Tkinter.NW) label = Label(inputFrame, text='Shift List:') label.grid(row=3, column=0, sticky=Tkinter.NW) self.shiftListPulldown = PulldownMenu(inputFrame,callback=self.setShiftList) self.shiftListPulldown.grid(row=3, column=1, sticky=Tkinter.NW) label = Label(inputFrame, text='2d BACUS executable:') label.grid(row=4, column=0, sticky=Tkinter.NW) self.executableEntry = Entry(inputFrame, text='/home/tjs23/clouds/justin/SpiBacusMidge/bacus/bacus_tjs.exe') self.executableEntry.grid(row=4, column=1, sticky=Tkinter.NW) self.executableButton = Button(inputFrame, text='Choose file', command=self.chooseExecutable) self.executableButton.grid(row=5, column=1, sticky=Tkinter.EW) row += 1 outputFrame = LabelFrame(guiParent, text='Output:') outputFrame.grid(row=row, column=0, sticky=Tkinter.NSEW) row += 1 texts = ['Run BACUS 2d','Run BACUS 3d'] commands = [self.runBacus,self.runBacus3d] self.bottomButtons = createDismissHelpButtonList(guiParent,texts=texts,commands=commands,expands=0,help_url=None) self.bottomButtons.grid(row=row, column=0, sticky=Tkinter.EW) self.update()
def body(self, guiFrame): guiFrame.grid_columnconfigure(0, weight=1) guiFrame.grid_rowconfigure(1, weight=1) frame = LabelFrame(guiFrame, text='Options') frame.grid(row=0,column=0,sticky='ew') frame.grid_columnconfigure(5, weight=1) # Choose type of symmetry set to define or change (if allready present in the model) self.molLabel = Label(frame, text='Symmetry Operator:') self.molLabel.grid(row=0,column=2,sticky='w') self.symmCodePulldown = PulldownMenu(frame, callback=self.setSymmCode, entries=['NCS','C2','C3','C5'], do_initial_callback=False) self.symmCodePulldown.grid(row=0,column=3,sticky='w') frame = LabelFrame(guiFrame, text='Symmetry Operations') frame.grid(row=1,column=0,sticky='nsew') frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) self.molSysPulldown = PulldownMenu(self, callback=self.setMolSystem, do_initial_callback=False) self.chainSelect = MultiWidget(self, CheckButton, callback=self.setChains, minRows=0, useImages=False) self.segStartEntry = IntEntry(self, returnCallback=self.setSegStart, width=6) self.segLengthEntry = IntEntry(self, returnCallback=self.setSegLength, width=6) headings = ['#','Symmetry\noperator','Mol System','Chains','Start\nresidue','Segment\nlength'] editWidgets = [None, None, self.molSysPulldown, self.chainSelect, self.segStartEntry, self.segLengthEntry] editGetCallbacks = [None, None, self.getMolSystem, self.getChains, self.getSegStart, self.getSegLength] editSetCallbacks = [None, self.setSymmCode, self.setMolSystem, self.setChains, self.setSegStart, self.setSegLength] self.symmetryMatrix = ScrolledMatrix(frame,headingList=headings, callback=self.selectSymmetry, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks) self.symmetryMatrix.grid(row=0,column=0,sticky='nsew') texts = ['Add Symmetry Set','Remove Symmetry Set'] commands = [self.addSymmetrySet,self.removeSymmetrySet] self.buttonList = createDismissHelpButtonList(guiFrame, texts=texts, commands=commands, expands=True) self.buttonList.grid(row=2,column=0,sticky='ew') self.updateMolPartners() self.notify(self.registerNotify) #Temporary report of parameters print self.molSystem print self.molecules print self.symmetrySet print self.symmetryOp print self.symmetryCode
def body(self, guiFrame): self.geometry('500x500') guiFrame.grid_columnconfigure(0, weight=1) guiFrame.grid_rowconfigure(1, weight=1) frame = LabelFrame(guiFrame, text='RDC protocol settings') frame.grid(row=1, column=0, sticky='nsew') frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) self.floatEntry = FloatEntry(self, returnCallback=self.setValue) headingList = ['Parameter', 'Value', 'Description'] justifyList = ['center', 'center', 'left'] editWidgets = [None, self.floatEntry, None] editGetCallbacks = [None, self.getValue, None] editSetCallbacks = [None, self.setValue, None] self.rdcMatrix = ScrolledMatrix(frame, headingList=headingList, justifyList=justifyList, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, multiSelect=False, initialRows=10, passSelfToCallback=True, callback=self.selectRdc) self.rdcMatrix.grid(row=0, column=0, sticky='nsew') self.rdcMatrix.refreshFunc = self.updateRdcSet self.updateRdcSet()
def body(self, guiFrame): ProgressBar.body(self, guiFrame) guiFrame.expandGrid(2,3) self.stepLabel = Label(guiFrame, text='Best step: ', grid=(0,3)) frame = LabelFrame(guiFrame, text='Best mappings', grid=(1,0), gridSpan=(1,4)) row = 0 for i in range(self.ensembleSize): label = Label(frame, text='', pady=0, font='Courier 10', borderwidth=0, grid=(row,0), sticky='ew') self.labels.append(label) row +=1 guiFrame.grid_rowconfigure(2, weight=1) self.graph = ScrolledGraph(guiFrame, width=450, height=300, graphType='scatter', title='Typing Scores', xLabel='Spin System', yLabel='Score', grid=(2,0), gridSpan=(1,4)) self.buttonList = ButtonList(guiFrame, texts=['Close',], commands=[self.done], grid=(3,0), gridSpan=(1,4)) self.buttonList.buttons[0].disable()
def body(self, guiFrame): guiFrame.grid_columnconfigure(0, weight=1) subFrame0 = LabelFrame(guiFrame, text=self.text, grid=(0, 0)) label = Label(subFrame0, text=self.message, anchor='w', grid=(0, 0)) subFrame1 = LabelDivider(guiFrame, text='View Peaks', grid=(1, 0)) texts = [] commands = [] for i in range(len(self.groups)): texts.append(self.groupNames[i]) commands.append(lambda n=i: self.viewGroup(n)) buttonList = UtilityButtonList(guiFrame, commands=commands, texts=texts, grid=(2, 0), tipTexts=self.tipTexts, doClone=False)
def body(self, guiFrame): guiFrame.grid_rowconfigure(0, weight=1) guiFrame.grid_columnconfigure(0, weight=1) row = 0 frame = LabelFrame(guiFrame, text='Matched Peak Groups') frame.grid_rowconfigure(0, weight=1) frame.grid_columnconfigure(0, weight=1) frame.grid(row=row, sticky='nsew') headingList, tipTexts = self.getHeadingList() self.scrolledMatrix = ScrolledMatrix(frame, initialRows=15, multiSelect=True, headingList=headingList, tipTexts=tipTexts, grid=(0,0), gridSpan=(1,3)) tipTexts = ['Remove the selected peak groups from the table', 'Show 1D positional ruler lines for the selected groups', 'Remove any ruler lines previously added for peak group', 'Display selected peak groups within strips of selected window'] texts = ['Remove\nGroups','Show\nRulers', 'Delete\nRulers','Display Groups\nIn Strips'] commands = [self.removeGroups,self.addRulers, self.removeRulers,self.stripGroups] self.buttons = ButtonList(frame, texts=texts, commands=commands, tipTexts=tipTexts) self.buttons.grid(row=1, column=0, sticky='ew') tipText = 'Selects the spectrum window in which to display strips & ruler lines' label = Label(frame, text='Target window:', grid=(1,1)) self.windowPulldown = PulldownList(frame, callback=None, grid=(1,2), tipText=tipText) row+= 1 bottomButtons = UtilityButtonList(guiFrame, helpUrl=self.help_url, expands=True, doClone=False) bottomButtons.grid(row = row, sticky = 'ew') self.update() for func in ('__init__', 'delete', 'setName'): self.registerNotify(self.updateWindowsAfter, 'ccpnmr.Analysis.SpectrumWindow', func)
if __name__ == '__main__': import Tkinter from memops.gui.Entry import Entry from memops.gui.LabelFrame import LabelFrame from memops.gui.ScrolledFrame import ScrolledFrame root = Tkinter.Tk() root.grid_columnconfigure(0, weight=1) root.grid_rowconfigure(1, weight=1) root.geometry('900x600') frame = LabelFrame(root, text='Prototypes', grid=(0, 0)) frame.expandGrid(0, 0) linkChartA = LinkChart(frame, background='#8080B0', height=160) linkChartA.grid(row=0, column=0, sticky='nsew') linkChartB = LinkChart(root) linkChartB.grid(row=1, column=0, sticky='nsew') tkWidget = Entry(root, text='', width=8) def setupFunc(obj): # This function creates widget contents # from the underlying node object return obj[0]
def body(self, guiFrame): fixedSpectrum = self.fixedPeak.peakList.dataSource moveSpectrum = self.movePeak.peakList.dataSource guiFrame.grid_columnconfigure(0, weight=1) row = 0 frame = LabelFrame(guiFrame, text='Working Spectra', grid=(row, 0), sticky='ew') frame.grid_columnconfigure(1, weight=1) s = '%s:%-20s' % (fixedSpectrum.experiment.name, fixedSpectrum.name) Label(frame, text='Fixed:', grid=(0, 0), sticky='e') tipText = 'The experiment:spectrum name of the reference spectrum, which will not be moved' Label(frame, text=s, grid=(0, 1), tipText=tipText) s = '%s:%-20s' % (moveSpectrum.experiment.name, moveSpectrum.name) Label(frame, text='Moving:', grid=(0, 2), sticky='e') tipText = 'The experiment:spectrum name of the spectrum which will be re-referenced using peak positions' Label(frame, text=s, grid=(0, 3), tipText=tipText) row += 1 guiFrame.grid_rowconfigure(row, weight=1) frame = LabelFrame(guiFrame, text='Peak Position Mapping', grid=(row, 0)) frame.expandGrid(0, 0) tipText = 'Whether the more than one moving spectrum dimension may be mapped to the same fixed spectrum dimension; typically not used but can be useful for re-referencing with a diagonal peak' self.fixedDimsButton = CheckButton( frame, text='Allow repeated fixed dim', selected=False, grid=(0, 0), callback=self.changedFixedDimsButton, tipText=tipText) self.dimPulldown = PulldownList(self, callback=self.setDimMapping) editWidgets = [None, None, self.dimPulldown, None, None, None] editGetCallbacks = [None, None, self.getDimMapping, None, None, None] editSetCallbacks = [None, None, self.setDimMapping, None, None, None] tipTexts = [ 'The dimension number of the spectrum being re-referenced', 'The isotope type that corresponds to both the fixed and re-reference spectrum dimensions', 'The dimension number of the fixed spectrum, used as a reference', 'The position of the moving peak in the relevant dimension, before any changes (for the spectrum being re-referenced)', 'The position of the fixed peak in the relevant dimension; potential new position of the moving peak after re-referencing changes', 'The chemical shift difference between the two peak positions on one dimension' ] headingList = [ 'Moving\nDim', 'Isotope', 'Fixed\nDim', 'Original\nPosition', 'New\nPosition', u'\u0394' ] self.scrolledMatrix = ScrolledMatrix(frame, headingList=headingList, callback=self.selectPeakDim, editWidgets=editWidgets, maxRows=5, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, grid=(1, 0), tipTexts=tipTexts) row += 1 tipTexts = [ 'Use the stated mapping of dimensions to re-reference the moving spectrum so that the selected peaks lie at the same position', ] texts = ['Commit'] commands = [self.ok] buttons = UtilityButtonList(guiFrame, texts=texts, commands=commands, closeText='Cancel', helpUrl=self.help_url, grid=(row, 0), tipTexts=tipTexts) self.update()
def body(self, guiFrame): self.refresh = False self.hilightColor = 'lightBlue' self.matrixCellGrey = 'grey82' self.chain = None self.ccpCode = None row = 0 label = Label(guiFrame, text='Molecule Chain:', grid=(row, 0)) tipText = 'Selects which molecular chain to select and show residues from' self.chainPulldown = PulldownList(guiFrame, callback=self.changeChain, grid=(row, 1), tipText=tipText) label = Label(guiFrame, text='Ccp Residue Code:', grid=(row, 2)) tipText = 'Selects which kind of residue to display sequence and assignment information for' self.ccpCodePulldown = PulldownList(guiFrame, callback=self.changeCcpCode, grid=(row, 3), tipText=tipText) label = Label(guiFrame, text='Shift List:', grid=(row, 4)) tipText = 'Selects which shiftlist to get chemical shift values from' self.shiftListPulldown = PulldownList(guiFrame, callback=self.changeShiftList, grid=(row, 5), tipText=tipText) row += 1 guiFrame.expandGrid(row, 6) self.residueFrame = LabelFrame(guiFrame, text='%s Information' % (self.ccpCode), grid=(row, 0), gridSpan=(1, 3)) self.residueFrame.expandGrid(1, 0) self.atomsFrame = LabelFrame( guiFrame, text='Atom Information & Idealised Structure', grid=(row, 3), gridSpan=(1, 5)) self.atomsFrame.expandGrid(0, 0) self.assignedText = 'Assigned:' tipText = 'How many residues of the selected kind are assigned out of the total number available' self.assignedLabel = Label(self.residueFrame, text=self.assignedText, grid=(0, 0), sticky='ew', tipText=tipText) tipTexts = [ 'Identity of the previous residue in the sequence', 'Locations of the selected kind of residue, considering the selected molecular chain', 'Identity of the next residue in the sequence' ] headingList = ['i-1', 'i', 'i+1'] self.neighbourMatrix = ScrolledMatrix(self.residueFrame, initialRows=8, headingList=headingList, minCellWidth=6, sorting=0, highlightType=1, callback=self.selectResidue, grid=(1, 0), gridSpan=(1, 3), tipTexts=tipTexts) self.viewResidueFrame = ViewResidueFrame(self.atomsFrame, residue=self.residue, project=self.project, grid=(0, 0), tipText=tipText) tipTexts = [ 'Print the three-dimensional coordinate display to a PostScript, EPS or PDF file', ] texts = ['Print'] commands = [self.viewResidueFrame.printStructure] self.utilButtons = UtilityButtonList(guiFrame, helpUrl=self.help_url, commands=commands, texts=texts, grid=(0, 7), tipTexts=tipTexts) self.updateChains() self.updateShiftLists() self.updateAfter() self.administerNotifiers(self.registerNotify)
def body(self, guiFrame): guiFrame.grid_columnconfigure(0, weight=1) guiFrame.grid_rowconfigure(1, weight=1) frame = LabelFrame(guiFrame, text='Options') frame.grid(row=0, column=0, sticky='ew') frame.grid_columnconfigure(5, weight=1) label = Label(frame, text='MolSystem:') label.grid(row=0, column=0, sticky='w') self.molSystemPulldown = PulldownMenu(frame, callback=self.selectMolSystem) self.molSystemPulldown.grid(row=0, column=1, sticky='w') self.molLabel = Label(frame, text='Molecule:') self.molLabel.grid(row=0, column=2, sticky='w') self.moleculePulldown = PulldownMenu(frame, callback=self.selectMolecule) self.moleculePulldown.grid(row=0, column=3, sticky='w') label = Label(frame, text='Same Molecule Symmetry:') label.grid(row=0, column=4, sticky='w') self.molSelect = CheckButton(frame, callback=self.toggleSingleMolecule) self.molSelect.grid(row=0, column=5, sticky='w') self.molSelect.set(self.singleMolecule) frame = LabelFrame(guiFrame, text='Symmetry Operations') frame.grid(row=1, column=0, sticky='nsew') frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) self.symmCodePulldown = PulldownMenu(self, callback=self.setSymmCode, do_initial_callback=False) self.segLengthEntry = IntEntry(self, returnCallback=self.setSegLength, width=6) self.setChainMulti = MultiWidget(self, CheckButton, callback=self.setChains, minRows=0, useImages=False) self.setSegmentMulti = MultiWidget(self, IntEntry, callback=self.setSegments, minRows=0, useImages=False) editWidgets = [ None, self.symmCodePulldown, self.segLengthEntry, self.setChainMulti, self.setSegmentMulti ] editGetCallbacks = [ None, self.getSymmCode, self.getSegLength, self.getChains, self.getSegments ] editSetCallbacks = [ None, self.setSymmCode, self.setSegLength, self.setChains, self.setSegments ] headings = [ '#', 'Symmetry\nType', 'Segment\nLength', 'Chains', 'Segment\nPositions' ] self.symmetryMatrix = ScrolledMatrix(frame, headingList=headings, callback=self.selectSymmetry, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks) self.symmetryMatrix.grid(row=0, column=0, sticky='nsew') texts = ['Add Symmetry Op', 'Remove Symmetrey Op'] commands = [self.addSymmOp, self.removeSymmOp] buttonList = createDismissHelpButtonList(guiFrame, texts=texts, commands=commands, expands=True) buttonList.grid(row=2, column=0, sticky='ew') self.updateMolSystems() self.updateMolecules() self.updateSymmetriesAfter() self.notify(self.registerNotify)
def body(self, guiFrame): self.specFreqEntry = IntEntry(self, text=self.specFreq, width=8, returnCallback=self.setSpecFreq) self.maxIterEntry = IntEntry(self, text=self.maxIter, width=8, returnCallback=self.setMaxIter) self.mixTimeEntry = FloatEntry(self, text=self.mixTime, width=8, returnCallback=self.setMixTime) self.corrTimeEntry = FloatEntry(self, text=self.corrTime, width=8, returnCallback=self.setCorrTime) self.leakRateEntry = FloatEntry(self, text=self.leakRate, width=8, returnCallback=self.setLeakRate) self.maxIntensEntry = IntEntry(self, text=self.maxIntens, width=8, returnCallback=self.setMaxIntens) self.mdInitTempEntry = FloatEntry(self, text='', returnCallback=self.setMdInitTemp) self.mdFinTempEntry = FloatEntry(self, text='', returnCallback=self.setMdFinTemp) self.mdCoolStepsEntry = IntEntry(self, text='', returnCallback=self.setMdCoolSteps) self.mdSimStepsEntry = IntEntry(self, text='', returnCallback=self.setMdSimSteps) self.mdTauEntry = FloatEntry(self, text='', returnCallback=self.setMdTau) self.mdRepScaleEntry = FloatEntry(self, text='', returnCallback=self.setMdRepScale) guiFrame.grid_columnconfigure(0, weight=1) row = 0 frame0 = LabelFrame(guiFrame, text='Setup peak lists') frame0.grid(row=row, column=0, sticky=Tkinter.NSEW) frame0.grid(row=row, column=0, sticky=Tkinter.NSEW) frame0.grid_columnconfigure(1, weight=1) f0row = 0 label00 = Label(frame0, text='1H-1H NOESY spectrum') label00.grid(row=f0row, column=0, sticky=Tkinter.NW) self.noesyPulldown = PulldownMenu(frame0, entries=self.getNoesys(), callback=self.setNoesy, selected_index=0, do_initial_callback=0) self.noesyPulldown.grid(row=f0row, column=1, sticky=Tkinter.NW) f0row += 1 label01 = Label(frame0, text='15N HSQC spectrum') label01.grid(row=f0row, column=0, sticky=Tkinter.NW) self.hsqcPulldown = PulldownMenu(frame0, entries=self.getHsqcs(), callback=self.setHsqc, selected_index=0, do_initial_callback=0) self.hsqcPulldown.grid(row=f0row, column=1, sticky=Tkinter.NW) f0row += 1 label02 = Label(frame0, text='15N HSQC TOCSY spectrum') label02.grid(row=f0row, column=0, sticky=Tkinter.NW) self.tocsyPulldown = PulldownMenu(frame0, entries=self.getTocsys(), callback=self.setTocsy, selected_index=0, do_initial_callback=0) self.tocsyPulldown.grid(row=f0row, column=1, sticky=Tkinter.NW) f0row += 1 label02 = Label(frame0, text='15N HSQC NOESY spectrum') label02.grid(row=f0row, column=0, sticky=Tkinter.NW) self.noesy3dPulldown = PulldownMenu(frame0, entries=self.getNoesy3ds(), callback=self.setNoesy3d, selected_index=0, do_initial_callback=0) self.noesy3dPulldown.grid(row=f0row, column=1, sticky=Tkinter.NW) f0row += 1 texts = ['Setup resonances & peaks', 'Show Peaks', 'Show resonances'] commands = [self.setupResonances, self.showPeaks, self.showResonances] self.setupButtons = ButtonList(frame0, expands=1, texts=texts, commands=commands) self.setupButtons.grid(row=f0row, column=0, columnspan=2, sticky=Tkinter.NSEW) f0row += 1 self.label03a = Label(frame0, text='Resonances found: 0') self.label03a.grid(row=f0row, column=0, sticky=Tkinter.NW) self.label03b = Label(frame0, text='NOESY peaks found: 0') self.label03b.grid(row=f0row, column=1, sticky=Tkinter.NW) row += 1 frame1 = LabelFrame(guiFrame, text='Calculate distance constraints') frame1.grid(row=row, column=0, sticky=Tkinter.NSEW) frame1.grid_columnconfigure(3, weight=1) f1row = 0 frame1.grid_rowconfigure(f1row, weight=1) data = [ self.specFreq, self.maxIter, self.mixTime, self.corrTime, self.leakRate, self.maxIntens ] colHeadings = [ 'Spectrometer\nfrequency', 'Max\niterations', 'Mixing\ntime (ms)', 'Correl.\ntime (ns)', 'Leak\nrate', 'Max\nintensity' ] editWidgets = [ self.specFreqEntry, self.maxIterEntry, self.mixTimeEntry, self.corrTimeEntry, self.leakRateEntry, self.maxIntensEntry, ] editGetCallbacks = [ self.getSpecFreq, self.getMaxIter, self.getMixTime, self.getCorrTime, self.getLeakRate, self.getMaxIntens, ] editSetCallbacks = [ self.setSpecFreq, self.setMaxIter, self.setMixTime, self.setCorrTime, self.setLeakRate, self.setMaxIntens, ] self.midgeParamsMatrix = ScrolledMatrix( frame1, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, maxRows=1, initialCols=5, headingList=colHeadings, callback=None, objectList=[ 'None', ], textMatrix=[ data, ]) self.midgeParamsMatrix.grid(row=f1row, column=0, columnspan=4, sticky=Tkinter.NSEW) f1row += 1 label10 = Label(frame1, text='Benchmark structure') label10.grid(row=f1row, column=0, sticky=Tkinter.NW) self.structurePulldown = PulldownMenu(frame1, entries=self.getStructures(), callback=self.setStructure, selected_index=0, do_initial_callback=0) self.structurePulldown.grid(row=f1row, column=1, sticky=Tkinter.NW) label11 = Label(frame1, text='ADC atom types:') label11.grid(row=f1row, column=2, sticky=Tkinter.NW) self.adcAtomsPulldown = PulldownMenu(frame1, entries=self.getAdcAtomTypes(), callback=self.setAdcAtomTypes, selected_index=0, do_initial_callback=0) self.adcAtomsPulldown.grid(row=f1row, column=3, sticky=Tkinter.NW) f1row += 1 texts = [ 'Calculate distances', 'Show distance\nconstraints', 'Show anti-distance\nconstraints' ] commands = [ self.calculateDistances, self.showConstraints, self.showAntiConstraints ] self.midgeButtons = ButtonList(frame1, expands=1, texts=texts, commands=commands) self.midgeButtons.grid(row=f1row, column=0, columnspan=4, sticky=Tkinter.NSEW) f1row += 1 self.distConstrLabel = Label(frame1, text='Distance constraints:') self.distConstrLabel.grid(row=f1row, column=0, columnspan=2, sticky=Tkinter.NW) self.antiConstrLabel = Label(frame1, text='Anti-distance constraints:') self.antiConstrLabel.grid(row=f1row, column=2, columnspan=2, sticky=Tkinter.NW) row += 1 guiFrame.grid_rowconfigure(row, weight=1) frame2 = LabelFrame(guiFrame, text='Proton cloud molecular dynamics') frame2.grid(row=row, column=0, sticky=Tkinter.NSEW) frame2.grid_columnconfigure(1, weight=1) f2row = 0 frame2.grid_rowconfigure(f2row, weight=1) data = [ self.specFreq, self.maxIter, self.mixTime, self.corrTime, self.leakRate ] colHeadings = [ 'Step', 'Initial temp.', 'Final temp.', 'Cooling steps', 'MD steps', 'MD tau', 'Rep. scale' ] editWidgets = [ None, self.mdInitTempEntry, self.mdFinTempEntry, self.mdCoolStepsEntry, self.mdSimStepsEntry, self.mdTauEntry, self.mdRepScaleEntry ] editGetCallbacks = [ None, self.getMdInitTemp, self.getMdFinTemp, self.getMdCoolSteps, self.getMdSimSteps, self.getMdTau, self.getMdRepScale ] editSetCallbacks = [ None, self.setMdInitTemp, self.setMdFinTemp, self.setMdCoolSteps, self.setMdSimSteps, self.setMdTau, self.setMdRepScale ] self.coolingSchemeMatrix = ScrolledMatrix( frame2, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, maxRows=9, initialRows=12, headingList=colHeadings, callback=self.selectCoolingStep, objectList=self.coolingScheme, textMatrix=self.coolingScheme) self.coolingSchemeMatrix.grid(row=f2row, column=0, columnspan=4, sticky=Tkinter.NSEW) f2row += 1 texts = ['Move earlier', 'Move later', 'Add step', 'Remove step'] commands = [ self.moveStepEarlier, self.moveStepLater, self.addCoolingStep, self.removeCoolingStep ] self.coolingSchemeButtons = ButtonList(frame2, expands=1, commands=commands, texts=texts) self.coolingSchemeButtons.grid(row=f2row, column=0, columnspan=4, sticky=Tkinter.EW) f2row += 1 label20 = Label(frame2, text='Number of clouds:') label20.grid(row=f2row, column=0, sticky=Tkinter.NW) self.numCloudsEntry = FloatEntry(frame2, text=100, returnCallback=self.setNumClouds, width=10) self.numCloudsEntry.grid(row=f2row, column=1, sticky=Tkinter.NW) label21 = Label(frame2, text='Cloud file prefix:') label21.grid(row=f2row, column=2, sticky=Tkinter.NW) self.filePrefixEntry = Entry(frame2, text='cloud_', returnCallback=self.setFilePrefix, width=10) self.filePrefixEntry.grid(row=f2row, column=3, sticky=Tkinter.NW) f2row += 1 texts = ['Start molecular dynamics', 'Show dynamics progress'] commands = [self.startMd, self.showMdProgress] self.mdButtons = ButtonList(frame2, expands=1, commands=commands, texts=texts) self.mdButtons.grid(row=f2row, column=0, columnspan=4, sticky=Tkinter.NSEW) row += 1 self.bottomButtons = createDismissHelpButtonList(guiFrame, expands=0, help_url=None) self.bottomButtons.grid(row=row, column=0, sticky=Tkinter.EW) self.setButtonStates()
def body(self): frame = self.frame self.resultsResidueNumber = 1 frame.expandGrid(5, 0) resultTopFrame = LabelFrame(frame, text='Which results to show') resultTopFrame.grid(row=0, column=0, sticky='ew') self.resultsResidueNumber = 3 texts = [' < '] commands = [self.resultsPrevResidue] self.resultsPreviousButton = ButtonList(resultTopFrame, commands=commands, texts=texts) self.resultsPreviousButton.grid(row=0, column=1, sticky='nsew') tipText = 'The Number of the residue in the sequence to display results for' self.resultsResidueNumberEntry = IntEntry( resultTopFrame, grid=(0, 2), width=7, text=3, returnCallback=self.resultsUpdateAfterEntry, tipText=tipText) #self.resultsResidueNumberEntry.bind('<Leave>', self.resultsUpdateAfterEntry, '+') texts = [' > '] commands = [self.resultsNextResidue] self.resultsNextButton = ButtonList(resultTopFrame, commands=commands, texts=texts) self.resultsNextButton.grid(row=0, column=3, sticky='nsew') selectCcpCodes = ['residue'] + AMINO_ACIDS self.resultsSelectedCcpCode = 'residue' tipText = 'Instead of going through the sequence residue by residue, jump directly to next amino acid of a specific type.' resultsSelectCcpCodeLabel = Label( resultTopFrame, text='Directly jump to previous/next:', grid=(0, 4)) self.resultsSelectCcpCodePulldown = PulldownList( resultTopFrame, callback=self.resultsChangeSelectedCcpCode, texts=selectCcpCodes, index=selectCcpCodes.index(self.resultsSelectedCcpCode), grid=(0, 5), tipText=tipText) self.selectedSolution = 1 runLabel = Label(resultTopFrame, text='run:') runLabel.grid(row=0, column=6) texts = [' < '] commands = [self.resultsPrevSolution] self.resultsPreviousSolutionButton = ButtonList(resultTopFrame, commands=commands, texts=texts) self.resultsPreviousSolutionButton.grid(row=0, column=7, sticky='nsew') tipText = 'If you ran the algorithm more than once, you can select the solution given by the different runs.' self.resultsSolutionNumberEntry = IntEntry( resultTopFrame, grid=(0, 8), width=7, text=1, returnCallback=self.solutionUpdateAfterEntry, tipText=tipText) #self.resultsSolutionNumberEntry.bind('<Leave>', self.solutionUpdateAfterEntry, '+') texts = [' > '] commands = [self.resultsNextSolution] self.resultsNextSolutionButton = ButtonList(resultTopFrame, commands=commands, texts=texts) self.resultsNextSolutionButton.grid(row=0, column=9, sticky='nsew') self.energyLabel = Label(resultTopFrame, text='energy:') self.energyLabel.grid(row=0, column=10) texts = ['template for puzzling'] commands = [self.adoptSolution] self.adoptButton = ButtonList(resultTopFrame, commands=commands, texts=texts) self.adoptButton.grid(row=0, column=11, sticky='nsew') # LabelFrame(frame, text='Spin Systems') resultsSecondFrame = Frame(frame) resultsSecondFrame.grid(row=2, column=0, sticky='nsew') resultsSecondFrame.grid_columnconfigure(0, weight=1) resultsSecondFrame.grid_columnconfigure(1, weight=1) resultsSecondFrame.grid_columnconfigure(2, weight=1) resultsSecondFrame.grid_columnconfigure(3, weight=1) resultsSecondFrame.grid_columnconfigure(4, weight=1) headingList = ['#', '%'] tipTexts = [ 'Spinsystem number {} indicates serial of the spinsystem. If the spinsystem was already assigned to a residue, the residue number is shown aswell', 'percentage of the solutions that connected this spinsystem to this residue' ] editWidgets = [None, None, None] self.displayResultsTables = [] self.residueLabels = [] for i in range(5): label = Label(resultsSecondFrame, text='residue') label.grid(row=0, column=i) #editGetCallbacks = [createCallbackFunction(i)]*3 displayResultsTable = ScrolledMatrix( resultsSecondFrame, headingList=headingList, multiSelect=False, tipTexts=tipTexts, callback=self.selectSpinSystemForTable, passSelfToCallback=True) displayResultsTable.grid(row=2, column=i, sticky='nsew') displayResultsTable.sortDown = False self.residueLabels.append(label) self.displayResultsTables.append(displayResultsTable) # LabelFrame(frame, text='Sequence Fragment') resultsFirstFrame = Frame(resultsSecondFrame) resultsFirstFrame.grid(row=1, column=0, sticky='ew', columnspan=5) resultsFirstFrame.grid_rowconfigure(0, weight=1) resultsFirstFrame.grid_rowconfigure(1, weight=1) resultsFirstFrame.grid_columnconfigure(0, weight=1) texts = [ ' res 1 ', ' links ', ' res 2 ', ' links ', ' res 3 ', ' links ', ' res 4 ', ' links ', ' res 5 ' ] commands = [ lambda: self.selectRelativeResidue(1, True), lambda: self.selectLink(1, True), lambda: self.selectRelativeResidue(2, True), lambda: self.selectLink(2, True), lambda: self.selectRelativeResidue(3, True), lambda: self.selectLink(3, True), lambda: self.selectRelativeResidue(4, True), lambda: self.selectLink(4, True), lambda: self.selectRelativeResidue(5, True) ] self.sequenceButtons = ButtonList(resultsFirstFrame, commands=commands, texts=texts) self.sequenceButtons.grid(row=0, column=0, sticky='nsew') for n, button in enumerate(self.sequenceButtons.buttons): if n % 2: button.grid(column=n, sticky='ns') self.sequenceButtons.grid_columnconfigure(n, weight=0) else: self.sequenceButtons.grid_columnconfigure(n, uniform=2) spacer = Spacer(resultsFirstFrame) spacer.grid(row=1, column=0, sticky='nsew') texts = [ ' res 1 ', ' links ', ' res 2 ', ' links ', ' res 3 ', ' links ', ' res 4 ', ' links ', ' res 5 ' ] commands = commands = [ lambda: self.selectRelativeResidue(1, False), lambda: self.selectLink(1, False), lambda: self.selectRelativeResidue(2, False), lambda: self.selectLink(2, False), lambda: self.selectRelativeResidue(3, False), lambda: self.selectLink(3, False), lambda: self.selectRelativeResidue(4, False), lambda: self.selectLink(4, False), lambda: self.selectRelativeResidue(5, False) ] self.sequenceButtonsB = ButtonList(resultsFirstFrame, commands=commands, texts=texts) self.sequenceButtonsB.grid(row=2, column=0, sticky='nsew') for n, button in enumerate(self.sequenceButtonsB.buttons): if n % 2: button.grid(column=n, sticky='ns') self.sequenceButtonsB.grid_columnconfigure(n, weight=0) else: self.sequenceButtonsB.grid_columnconfigure(n, uniform=2) frame.grid_rowconfigure(3, weight=2) resultsThirdFrame = Frame(frame) resultsThirdFrame.grid(row=3, column=0, sticky='nsew') resultsThirdFrame.grid_rowconfigure(0, weight=1) resultsThirdFrame.grid_columnconfigure(0, weight=1) tabbedFrameB = TabbedFrame(resultsThirdFrame, options=['Peaks', 'Spin System'], callback=self.toggleTab, grid=(0, 0)) #self.tabbedFrameB = tabbedFrame PeakFrame, SpinSystemFrame = tabbedFrameB.frames SpinSystemFrame.grid_rowconfigure(0, weight=1) PeakFrame.grid_rowconfigure(1, weight=1) SpinSystemFrame.grid_columnconfigure(0, weight=1) PeakFrame.grid_columnconfigure(0, weight=1) headingList = [ 'residue', 'assigned to in project', 'user defined sequence', 'selected annealing result', '%' ] tipTexts = [None, None, None, None, None] editWidgets = [None, None, None, None, None] editGetCallbacks = [None, None, None, None, None] editSetCallbacks = [None, None, None, None, None] self.spinSysTable = ScrolledMatrix(SpinSystemFrame, headingList=headingList, editWidgets=editWidgets, multiSelect=False, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, tipTexts=tipTexts) self.spinSysTable.grid(row=0, column=0, sticky='nsew') buttonFrameinPeakFrame = Frame(PeakFrame) buttonFrameinPeakFrame.grid(sticky='ew') self.findButton = Button( buttonFrameinPeakFrame, text=' Go to Peak ', borderwidth=1, padx=2, pady=1, command=self.findPeak, tipText='Locate the currently selected peak in the specified window' ) self.findButton.grid(row=0, column=0, sticky='e') label = Label(buttonFrameinPeakFrame, text='in window:') label.grid(row=0, column=1, sticky='w') self.windowPulldown = PulldownList( buttonFrameinPeakFrame, callback=self.selectWindowPane, tipText='Choose the spectrum window for locating peaks or strips') self.windowPulldown.grid(row=0, column=2, sticky='w') self.assignSelectedPeaksButton = Button( buttonFrameinPeakFrame, text='Assign Resonances to Peak(s)', borderwidth=1, padx=2, pady=1, command=self.assignSelectedPeaks, tipText= 'Assign resonances to peak dimensions, this of course only works when the peak is found in the spectrum.' ) self.assignSelectedPeaksButton.grid(row=0, column=3, sticky='ew') self.assignSelectedSpinSystemsToResiduesButton = Button( buttonFrameinPeakFrame, text='Assign Spinsystems to Residues', borderwidth=1, padx=2, pady=1, command=self.assignSelectedSpinSystemsToResidues, tipText='Assign spinsystems to residues') self.assignSelectedSpinSystemsToResiduesButton.grid(row=0, column=4, sticky='ew') headingList = [ '#', 'spectrum', 'Dim1', 'Dim2', 'Dim3', 'c.s. dim1', 'c.s. dim2', 'c.s. dim3', 'colabelling' ] tipTexts = [ 'Peak number, only present when the peak was actually found in the spectrum.', 'Name of the spectrum', 'Name of atomSet measured in this dimension. Dimension number corresponds to Ref Exp Dim as indicated by going in the main menu to Experiment-->Experiments-->Experiment Type', 'Name of atomSet measured in this dimension. Dimension number corresponds to Ref Exp Dim as indicated by going in the main menu to Experiment-->Experiments-->Experiment Type', 'Name of atomSet measured in this dimension. Dimension number corresponds to Ref Exp Dim as indicated by going in the main menu to Experiment-->Experiments-->Experiment Type', 'Chemical Shift', 'Chemical Shift', 'Chemical Shift', 'Colabbeling fraction over all nuclei that are on the magnetization transfer pathway during the experiment that gave rise to the peak, including visited nuclei that were not measured in any of the peak dimensions' ] #editWidgets = [None, None, None, None, None, None, None, None, None] editGetCallbacks = [ None, None, None, None, None, None, None, None, None ] #editGetCallbacks = [self.selectPeak, self.selectPeak, self.selectPeak, self.selectPeak, self.selectPeak, self.selectPeak, self.selectPeak, self.selectPeak, self.selectPeak] editSetCallbacks = [ None, None, None, None, None, None, None, None, None ] self.displayPeakTable = ScrolledMatrix(PeakFrame, headingList=headingList, multiSelect=True, tipTexts=tipTexts) #editWidgets=editWidgets, multiSelect=True, # editGetCallbacks=editGetCallbacks, # editSetCallbacks=editSetCallbacks, # tipTexts=tipTexts) self.displayPeakTable.grid(row=1, column=0, sticky='nsew') self.windowPane = None self.updateWindows()
def __init__(self, parent, dangleGui, project=None, *args, **kw): self.guiParent = parent self.dangleGui = dangleGui self.dangleDir = None self.dangleChain = None self.dangleResidue = None #self.outDir = OUTDIR self.row = None self.col = None self.project = project self.nmrProject = None self.colorScheme = 'red' self.chain = None self.shiftList = None self.dangleStore = False # Not None self.constraintSet = None self.ensemble = None Frame.__init__(self, parent=parent) self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(1, weight=1) row = 0 # TOP LEFT FRAME frame = LabelFrame(self, text='Options') frame.grid(row=row, column=0, sticky='nsew') frame.columnconfigure(5, weight=1) label = Label(frame, text='Chain') label.grid(row=0, column=0, sticky='w') self.chainPulldown = PulldownList( frame, callback=self.changeChain, tipText='Choose the molecular system chain to make predictions for' ) self.chainPulldown.grid(row=0, column=1, sticky='w') label = Label(frame, text='Shift List') label.grid(row=0, column=2, sticky='w') self.shiftListPulldown = PulldownList( frame, callback=self.changeShiftList, tipText='Select the shift list to take input chemical shifts from') self.shiftListPulldown.grid(row=0, column=3, sticky='w') label = Label(frame, text='Max No. of Islands:') label.grid(row=0, column=4, sticky='w') sizes = range(10) texts = [str(s) for s in sizes] + [ 'Do not reject', ] self.rejectPulldown = PulldownList( frame, texts=texts, objects=sizes + [ None, ], tipText= 'Select the maximum allowed number of disontinuous prediction islands' ) self.rejectPulldown.set(DEFAULT_MAX_ISLANDS) # Actual value not index self.rejectPulldown.grid(row=0, column=5, sticky='w') label = Label(frame, text='Dangle Run:') label.grid(row=1, column=0, sticky='w') self.dangleStorePulldown = PulldownList( frame, callback=self.changeDangleStore, tipText='Select a run number to store DANGLE results within') self.dangleStorePulldown.grid(row=1, column=1, sticky='w') label = Label(frame, text='Ensemble:') label.grid(row=1, column=2, sticky='w') self.ensemblePulldown = PulldownList( frame, callback=self.changeEnsemble, tipText= 'Select the structure ensemble for superimposition of angle values on the GLE plots' ) self.ensemblePulldown.grid(row=1, column=3, sticky='w') label = Label(frame, text='Restraint Set:') label.grid(row=1, column=4, sticky='w') self.constrSetPulldown = PulldownList( frame, callback=self.changeConstraintSet, tipText= 'Select the CCPN restraint set to store DANGLE dihedral angle restraints in' ) self.constrSetPulldown.grid(row=1, column=5, sticky='w') # TOP RIGHT FRAME outerFrame = Frame(self) outerFrame.grid(row=row, column=1, rowspan=2, sticky='nsew') outerFrame.rowconfigure(0, weight=1) outerFrame.columnconfigure(0, weight=1) frame = LabelFrame(outerFrame, text='Global Likelihood Estimates') frame.grid(row=0, column=0, sticky='nsew') frame.rowconfigure(1, weight=1) frame.columnconfigure(2, weight=1) self.prevPlot = ViewRamachandranFrame(frame, relief='sunken', defaultPlot=False, width=180, height=180, bgColor=self.cget('bg'), nullColor='#000000', titleText='Previous', xTicks=False, yTicks=False, xLabel='', yLabel='', showCoords=False) self.prevPlot.grid(row=0, column=0, sticky='nsew') self.prevPlot.getPlotColor = self.getPlotColor self.nextPlot = ViewRamachandranFrame(frame, relief='sunken', defaultPlot=False, width=180, height=180, bgColor=self.cget('bg'), nullColor='#000000', titleText='Next', xTicks=False, yTicks=False, xLabel='', yLabel='', showCoords=False) self.nextPlot.grid(row=0, column=1, sticky='nsew') self.nextPlot.getPlotColor = self.getPlotColor self.plot = ViewRamachandranFrame(frame, relief='sunken', defaultPlot=False, width=360, height=360, bgColor=self.cget('bg'), nullColor='#000000') self.plot.grid(row=1, column=0, columnspan=2, sticky='nsew') self.plot.selectColor = '#FFB0B0' self.plot.getPlotColor = self.getPlotColor # BOTTOM RIGHT FRAME frame = Frame(outerFrame) frame.grid(row=1, column=0, sticky='nsew') frame.rowconfigure(0, weight=1) frame.columnconfigure(0, weight=1) texts = ('Previous', ' Next ') commands = (self.showPrevious, self.showNext) tipTexts = [ 'Show GLE plot of angle predictions for previous residue in chain', 'Show GLE plot of angle predictions for next residue in chain' ] buttonList = ButtonList(frame, texts, commands, tipTexts=tipTexts) buttonList.grid(row=0, column=0, sticky='nsew') row += 1 # BOTTOM LEFT FRAME frame = LabelFrame(self, text='Dihedral Angle Predictions') frame.grid(row=row, column=0, sticky='nsew') frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) self.floatEntry = FloatEntry(self, text='', returnCallback=self.setFloatEntry, width=10, formatPlaces=9) tipTexts = [ 'Residue number in chain', 'Residue type code', 'Number of high scoring discontinuous angle predictions', 'Predicted secondary structure code', 'Predicted phi dihedral angle (CO-N-CA-CO)', 'Predicted psi dihedral angle (N-CA-CO-N)', 'Upper bound of phi angle prediction', 'Lower bound of phi angle prediction', 'Upper bound of psi angle prediction', 'Lower bound of phi angle prediction', 'Chemical shifts used in prediction' ] headingList = [ 'Res\nNum', 'Res\nType', 'No. of\nIslands', 'SS', 'Phi', 'Psi', 'Phi\nUpper', 'Phi\nLower', 'Psi\nUpper', 'Psi\nLower', 'Chemical Shifts' ] editWidgets = [ None, None, None, None, self.floatEntry, self.floatEntry, self.floatEntry, self.floatEntry, self.floatEntry, self.floatEntry ] editGetCallbacks = [ None, None, None, None, self.getFloatEntry, self.getFloatEntry, self.getFloatEntry, self.getFloatEntry, self.getFloatEntry, self.getFloatEntry ] editSetCallbacks = [ None, None, None, None, self.setFloatEntry, self.setFloatEntry, self.setFloatEntry, self.setFloatEntry, self.setFloatEntry, self.setFloatEntry ] self.predictionMatrix = ScrolledMatrix( frame, headingList=headingList, multiSelect=True, callback=self.selectCell, tipTexts=tipTexts, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks) # doubleCallback=self.loadGLEs) self.predictionMatrix.grid(row=0, column=0, sticky='nsew') row += 1 tipTexts = [ 'Remove the predictions for the selected residues', 'Run the DANGLE method to predict dihedral angles and secondary structure', 'Delete the DANGLE results stored under the current run number', 'Store the angle predictions and bounds in a new CCPN dihedral angle restraint list', 'Store the secondary structure predictions in the CCPN project' ] texts = [ 'Clear\nSelected', 'Run Prediction!', 'Delete\nCurrent Run', 'Commit\nRestraints', 'Commit\nSecondary Structure' ] commands = [ self.clearSelected, self.runDangle, self.deleteRun, self.storeDihedralConstraints, self.storeSecondaryStructure ] self.buttonList = createDismissHelpButtonList( self, texts=texts, commands=commands, # dismiss_text='Quit', dismiss_cmd=self.dangleGui.quit, help_url=self.dangleGui.help_url, expands=True, tipTexts=tipTexts) self.buttonList.grid(row=row, column=0, columnspan=2, sticky='ew') self.buttonList.buttons[1].config(bg='#C0FFFF') self.updateProject(project) self.notify(dangleGui.registerNotify)
def body(self, guiFrame): self.specFreqEntry = IntEntry(self, text=self.specFreq, width=8, returnCallback=self.setSpecFreq) self.maxIterEntry = IntEntry(self, text=self.maxIter, width=8, returnCallback=self.setMaxIter) self.mixTimeEntry = FloatEntry(self, text=self.mixTime, width=8, returnCallback=self.setMixTime) self.corrTimeEntry = FloatEntry(self, text=self.corrTime, width=8, returnCallback=self.setCorrTime) self.leakRateEntry = FloatEntry(self, text=self.leakRate, width=8, returnCallback=self.setLeakRate) guiFrame.grid_columnconfigure(0, weight=1) guiFrame.grid_rowconfigure(1, weight=1) row = 0 labelFrame0 = LabelFrame(guiFrame, text='Input data') labelFrame0.grid(row=row, column=0, sticky=Tkinter.NSEW) labelFrame0.grid_columnconfigure(3, weight=1) label = Label(labelFrame0, text='Assigned NOESY spectrum') label.grid(row=0, column=0, sticky=Tkinter.NW) self.noesyPulldown = PulldownMenu(labelFrame0, entries=self.getNoesys(), callback=self.setNoesy, selected_index=0, do_initial_callback=0) self.noesyPulldown.grid(row=0, column=1, sticky=Tkinter.NW) label = Label(labelFrame0, text='H/D ratio: ') label.grid(row=0, column=2, sticky=Tkinter.NW) self.ratioHDEntry = FloatEntry(labelFrame0, text=self.ratioHD, width=6) self.ratioHDEntry.grid(row=0, column=3, sticky=Tkinter.NW) label = Label(labelFrame0, text='NOESY spectrum 1:') label.grid(row=1, column=0, sticky=Tkinter.NW) self.tmix1Pulldown = PulldownMenu(labelFrame0, entries=self.getNoesys(), callback=self.setNoesy1, selected_index=-0, do_initial_callback=0) self.tmix1Pulldown.grid(row=1, column=1, sticky=Tkinter.NW) label = Label(labelFrame0, text='Tmix (ms): ') label.grid(row=1, column=2, sticky=Tkinter.NW) self.tmix1Entry = FloatEntry(labelFrame0, text=60, width=6) self.tmix1Entry.grid(row=1, column=3, sticky=Tkinter.NW) label = Label(labelFrame0, text='NOESY spectrum 2:') label.grid(row=2, column=0, sticky=Tkinter.NW) self.tmix2Pulldown = PulldownMenu(labelFrame0, entries=self.getNoesys(), callback=self.setNoesy2, selected_index=0, do_initial_callback=0) self.tmix2Pulldown.grid(row=2, column=1, sticky=Tkinter.NW) label = Label(labelFrame0, text='Tmix (ms): ') label.grid(row=2, column=2, sticky=Tkinter.NW) self.tmix2Entry = FloatEntry(labelFrame0, text=120, width=6) self.tmix2Entry.grid(row=2, column=3, sticky=Tkinter.NW) label = Label(labelFrame0, text='NOESY spectrum 3:') label.grid(row=3, column=0, sticky=Tkinter.NW) self.tmix3Pulldown = PulldownMenu(labelFrame0, entries=self.getNoesys(), callback=self.setNoesy3, selected_index=0, do_initial_callback=0) self.tmix3Pulldown.grid(row=3, column=1, sticky=Tkinter.NW) label = Label(labelFrame0, text='Tmix (ms): ') label.grid(row=3, column=2, sticky=Tkinter.NW) self.tmix3Entry = FloatEntry(labelFrame0, text=200, width=6) self.tmix3Entry.grid(row=3, column=3, sticky=Tkinter.NW) label = Label(labelFrame0, text='3D NOESY:') label.grid(row=4, column=0, sticky=Tkinter.NW) self.noesy3dPulldown = PulldownMenu(labelFrame0, entries=self.getNoesys3d(), callback=self.setNoesy3d, selected_index=0, do_initial_callback=0) self.noesy3dPulldown.grid(row=4, column=1, sticky=Tkinter.NW) label10 = Label(labelFrame0, text='Num peaks:') label10.grid(row=5, column=0, sticky=Tkinter.NW) self.numPeaksLabel = Label(labelFrame0, text='0') self.numPeaksLabel.grid(row=5, column=1, sticky=Tkinter.NW) label11 = Label(labelFrame0, text='Num resonances:') label11.grid(row=5, column=2, sticky=Tkinter.NW) self.numResonancesLabel = Label(labelFrame0, text='0') self.numResonancesLabel.grid(row=5, column=3, sticky=Tkinter.NW) row += 1 labelFrame1 = LabelFrame(guiFrame, text='Parameters') labelFrame1.grid(row=row, column=0, sticky=Tkinter.NSEW) labelFrame1.grid_columnconfigure(3, weight=1) label = Label(labelFrame1, text='15N labelled sample:') label.grid(row=0, column=0, sticky=Tkinter.NW) self.nitrogenSelect = CheckButton(labelFrame1, callback=self.setNitrogenLabel) self.nitrogenSelect.grid(row=0, column=1, sticky=Tkinter.W) self.nitrogenSelect.set(1) label = Label(labelFrame1, text='13C labelled sample:') label.grid(row=0, column=2, sticky=Tkinter.NW) self.carbonSelect = CheckButton(labelFrame1, callback=self.setCarbonLabel) self.carbonSelect.grid(row=0, column=3, sticky=Tkinter.W) self.carbonSelect.set(0) labelFrame1.grid_rowconfigure(1, weight=1) data = [ self.specFreq, self.maxIter, self.mixTime, self.corrTime, self.leakRate ] colHeadings = [ 'Spectrometer\nfrequency', 'Max\niterations', 'Mixing\ntime (ms)', 'Correl.\ntime (ns)', 'Leak\nrate' ] editWidgets = [ self.specFreqEntry, self.maxIterEntry, self.mixTimeEntry, self.corrTimeEntry, self.leakRateEntry, ] editGetCallbacks = [ self.getSpecFreq, self.getMaxIter, self.getMixTime, self.getCorrTime, self.getLeakRate, ] editSetCallbacks = [ self.setSpecFreq, self.setMaxIter, self.setMixTime, self.setCorrTime, self.setLeakRate, ] self.midgeParamsMatrix = ScrolledMatrix( labelFrame1, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, maxRows=1, initialCols=5, headingList=colHeadings, callback=None, objectList=[ 'None', ], textMatrix=[ data, ]) self.midgeParamsMatrix.grid(row=1, column=0, columnspan=4, sticky=Tkinter.NSEW) label10 = Label(labelFrame1, text='Benchmark structure') label10.grid(row=2, column=0, sticky=Tkinter.NW) self.structurePulldown = PulldownMenu(labelFrame1, entries=self.getStructures(), callback=self.setStructure, selected_index=0, do_initial_callback=0) self.structurePulldown.grid(row=2, column=1, sticky=Tkinter.NW) label11 = Label(labelFrame1, text='ADC atom types:') label11.grid(row=2, column=2, sticky=Tkinter.NW) self.adcAtomsPulldown = PulldownMenu(labelFrame1, entries=self.getAdcAtomTypes(), callback=self.setAdcAtomTypes, selected_index=0, do_initial_callback=0) self.adcAtomsPulldown.grid(row=2, column=3, sticky=Tkinter.NW) row += 1 labelFrame2 = LabelFrame(guiFrame, text='Output') labelFrame2.grid(row=row, column=0, sticky=Tkinter.NSEW) labelFrame2.grid_columnconfigure(3, weight=1) label20 = Label(labelFrame2, text='Distance constraints:') label20.grid(row=0, column=0, sticky=Tkinter.NW) self.distConstrLabel = Label(labelFrame2, text='0') self.distConstrLabel.grid(row=0, column=1, sticky=Tkinter.NW) label21 = Label(labelFrame2, text='Anti-distance constraints:') label21.grid(row=0, column=2, sticky=Tkinter.NW) self.antiConstrLabel = Label(labelFrame2, text='0') self.antiConstrLabel.grid(row=0, column=3, sticky=Tkinter.NW) texts = [ 'Calculate distances', 'Show distance\nconstraints', 'Show anti-distance\nconstraints' ] commands = [ self.calculateDistances, self.showConstraints, self.showAntiConstraints ] self.midgeButtons = ButtonList(labelFrame2, expands=1, texts=texts, commands=commands) self.midgeButtons.grid(row=1, column=0, columnspan=4, sticky=Tkinter.NSEW) row += 1 self.bottomButtons = createDismissHelpButtonList(guiFrame, expands=0, help_url=None) self.bottomButtons.grid(row=row, column=0, columnspan=4, sticky=Tkinter.EW) self.getPeaks() self.getResonances() self.update() self.geometry('600x400')
def body(self, guiFrame): guiFrame.grid_columnconfigure(0, weight=1) row = 0 frame = Frame(guiFrame) frame.grid(row=row, column=0, sticky='nsew') frame.grid_columnconfigure(3, weight=1) label = Label(frame, text='Shift List:') label.grid(row=0, column=0, sticky='w') self.shiftListPulldown = PulldownMenu(frame, callback=self.setShiftList) self.shiftListPulldown.grid(row=0, column=1, sticky='w') label = Label(frame, text='Sequential Link Type:') label.grid(row=0, column=2, sticky='w') entries = ['-1', '-1,+1', '+1'] self.linkPulldown = PulldownMenu(frame, callback=self.setLink, entries=entries, do_initial_callback=False, selected_index=entries.index( self.link)) self.linkPulldown.grid(row=0, column=3, sticky='w') row += 1 frame = LabelFrame(guiFrame, text='Link Atoms:') frame.grid(row=row, column=0, sticky='nsew') frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) labels = ['C', 'CA', 'CB', 'CG', 'CD', 'H', 'HA', 'HB', 'HG', 'HD'] selected = ['CA', 'CB'] self.atomSelector = PartitionedSelector(frame, objects=labels, labels=labels, selected=selected, toggledBg='#808080', callback=self.changeAtoms, maxRowObjects=10) self.atomSelector.grid(row=0, column=0, sticky='ew') row += 1 guiFrame.grid_rowconfigure(row, weight=1) frame = LabelFrame(guiFrame, text='Predicted Residue Assignments') frame.grid(row=row, column=0, sticky='nsew') frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) headingList = [ '#', 'Predicted\nResidue', 'Prob.', 'Links', 'CA', 'CA -1', 'CB', 'CB -1' ] self.spinSystemMatrix = ScrolledMatrix(frame, headingList=headingList, callback=self.selectSpinSystem, multiSelect=1) self.spinSystemMatrix.grid(row=0, column=0, sticky='nsew') row += 1 texts = ['Link Selected', 'Link All', 'Commit Assignment'] commands = [ self.linkSelectedSpinSystems, self.linkAllSpinSystems, self.commitAssignments ] buttonList = UtilityButtonList(guiFrame, texts=texts, commands=commands, helpUrl=self.help_url) buttonList.grid(row=row, column=0, sticky='ew') self.buttons = buttonList.buttons for func in ('__init__', 'delete'): for clazz in ('ccp.nmr.Nmr.ShiftList', ): self.registerNotify(self.updateShiftLists, clazz, func) for func in ('__init__', 'delete', 'setNmrChains', 'setResidue', 'setResonances', 'addResonance', 'removeResonance'): self.registerNotify(self.updateSpinSystemsAfter, 'ccp.nmr.Nmr.ResonanceGroup', func) self.updateShiftLists()
def body(self, guiFrame): guiFrame.grid_columnconfigure(0, weight=1) row = 0 strucGenFrame = LabelFrame(guiFrame, text='Generation Runs') strucGenFrame.grid(row=row, column=0, columnspan=1, sticky='nsew') strucGenFrame.grid_columnconfigure(0, weight=1) strucGenFrame.grid_rowconfigure(0, weight=1) guiFrame.grid_rowconfigure(row, weight=0) #self.editDetailsEntry = Entry(self,text='',returnCallback = self.setDetails, width=12) #editWidgets = [None, None, None, None, None, self.editDetailsEntry] #editGetCallbacks = [None, None, None, None, None, self.getDetails] #editSetCallbacks = [None, None, None, None, None, self.setDetails] colHeadings = [ '#', 'Constraint\nLists', 'Violation\nLists', 'Structures', 'Fixed\nAtom Sets', 'Fixes\nResonance Sets', 'Chain\nStates', 'Database\nEntries', 'Resonance\nClouds' ] editWidgets = [None, None, None, None, None, None, None, None, None] editGetCallbacks = [ None, None, None, None, None, None, None, None, None ] editSetCallbacks = [ None, None, None, None, None, None, None, None, None ] self.structGenMatrix = ScrolledMatrix( strucGenFrame, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, initialRows=3, initialCols=6, headingList=colHeadings, callback=self.selectStructGenCell, objectList=[], textMatrix=[ [], ]) self.structGenMatrix.grid(row=0, column=0, sticky='nsew') texts = ['View Structures', 'Delete'] commands = [self.viewStructures, self.deleteStrucGen] self.structGenButtons = ButtonList(strucGenFrame, texts=texts, expands=True, commands=commands) self.structGenButtons.grid(row=1, column=0, sticky='ew') row += 1 constrFrame = LabelFrame(guiFrame, text='Constraint Lists') constrFrame.grid(row=row, column=0, columnspan=1, sticky='nsew') constrFrame.grid_columnconfigure(0, weight=1) constrFrame.grid_rowconfigure(0, weight=1) guiFrame.grid_rowconfigure(row, weight=1) colHeadings = [ '#', 'Type', 'Name', 'Constraints', 'Experiments', 'Details', 'Unit' ] editWidgets = [None, None, None, None, None, None, None] editGetCallbacks = [None, None, None, None, None, None, None] editSetCallbacks = [None, None, None, None, None, None, None] self.constrListMatrix = ScrolledMatrix( constrFrame, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, initialRows=10, headingList=colHeadings, callback=self.selectConstrListCell, objectList=[], textMatrix=[ [], ]) self.constrListMatrix.grid(row=0, column=0, sticky='nsew') texts = ['View Constraints', 'Create List', 'Delete List'] commands = [ self.viewConstraints, self.createConstraints, self.deleteConstraints ] self.constrListButtons = ButtonList(constrFrame, texts=texts, expands=True, commands=commands) self.constrListButtons.grid(row=1, column=0, sticky='ew') self.constrListButtons.buttons[1].disable() row += 1 violFrame = LabelFrame(guiFrame, text='Violation Lists') violFrame.grid(row=row, column=0, columnspan=1, sticky='nsew') violFrame.grid_columnconfigure(0, weight=1) violFrame.grid_rowconfigure(0, weight=1) guiFrame.grid_rowconfigure(row, weight=1) colHeadings = [ '#', 'Violations', 'Structures', 'Details', ] editWidgets = [None, None, None, None] editGetCallbacks = [None, None, None, None] editSetCallbacks = [None, None, None, None] self.violListMatrix = ScrolledMatrix(violFrame, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, initialRows=10, headingList=colHeadings, callback=self.selectViolListCell, objectList=[], textMatrix=[ [], ]) self.violListMatrix.grid(row=0, column=0, sticky='nsew') texts = ['View Violations', 'Delete List'] commands = [self.viewViolations, self.deleteViolations] self.violListButtons = ButtonList(violFrame, texts=texts, expands=True, commands=commands) self.violListButtons.grid(row=1, column=0, sticky='ew') row += 1 self.bottomButtons = UtilityButtonList(guiFrame, helpUrl=self.help_url) self.bottomButtons.grid(row=row, column=0, columnspan=1, sticky='ew') self.update() for func in ('__init__', 'delete', 'setName', 'setDetails', 'setUnit', 'setExperiments', 'addExperiment', 'removeExperiment'): for clazz in ('ccp.nmr.Nmr.ChemShiftConstraintList', 'ccp.nmr.Nmr.DihedralConstraintList', 'ccp.nmr.Nmr.DistanceConstraintList', 'ccp.nmr.Nmr.HBondConstraintList', 'ccp.nmr.Nmr.JCouplingConstraintList', 'ccp.nmr.Nmr.RdcConstraintList'): self.registerNotify(self.updateAfter, clazz, func) for func in ( '__init__', 'delete', ): for clazz in ('ccp.nmr.Nmr.ChemShiftConstraint', 'ccp.nmr.Nmr.DihedralConstraint', 'ccp.nmr.Nmr.DistanceConstraint', 'ccp.nmr.Nmr.HBondConstraint', 'ccp.nmr.Nmr.JCouplingConstraint', 'ccp.nmr.Nmr.RdcConstraint'): self.registerNotify(self.updateAfter, clazz, func) for func in ('__init__', 'delete', 'setChainStates', 'addChainState', 'removeChainState', 'addEntry', 'removeEntry', 'setResStructures', 'addResStructure', 'setEntries', 'removeResStructure', 'setStructures', 'addStructure', 'removeStructure'): self.registerNotify(self.updateAfter, 'ccp.nmr.Nmr.StructureGeneration', func) for func in ('__init__', 'delete', 'setDetails'): for clazz in ('ccp.nmr.Nmr.ViolationList', ): self.registerNotify(self.updateAfter, clazz, func) for func in ( '__init__', 'delete', ): for clazz in ('ccp.nmr.Nmr.Violation', ): self.registerNotify(self.updateAfter, clazz, func)
def __init__(self, guiParent, project, callback=None, help_msg='', help_url='', dismiss_text='', modal=False, *args, **kw): self.project = project self.callback = callback self.help_msg = help_msg self.help_url = help_url self.dismiss_text = dismiss_text self.modal = modal self.did_save = False Frame.__init__(self, guiParent, *args, **kw) projDir = Io.getUserDataPath(self.project) guiParent.grid_columnconfigure(1, weight=1) row = 0 label = Label(guiParent, text='Project Name:') label.grid(row=row, column=0, sticky=Tkinter.E) self.proj_name_entry = Entry( guiParent, text=self.project.name, returnCallback=self.updateInfo, leaveCallback=self.updateInfo, tipText='The name used for the project save directory') self.proj_name_entry.grid(row=row, column=1, sticky=Tkinter.EW) row = row + 1 label = Label(guiParent, text='Project Directory:') label.grid(row=row, column=0, sticky=Tkinter.E) label = self.proj_dir_label = Label(guiParent, text=projDir) label.grid(row=row, column=1, sticky=Tkinter.W) row = row + 1 label = Label( guiParent, text='Note: Project Directory = Save Location + Project Name') label.grid(row=row, column=1, sticky=Tkinter.W) text = 'Save binary data with project' tipText = 'Copy data files (e.g. for spectra) into new project directory if not already in current project directory: careful, this can take some time' row = row + 1 self.dataCheckButton = CheckButton(guiParent, text=text, tipText=tipText) self.dataCheckButton.grid(row=row, column=0, columnspan=2, sticky=Tkinter.W) row = row + 1 guiParent.grid_rowconfigure(row, weight=1) labelFrame = LabelFrame(guiParent, text='Save Location') labelFrame.grid(row=row, column=0, columnspan=2, sticky=Tkinter.NSEW) labelFrame.grid_rowconfigure(0, weight=1) labelFrame.grid_columnconfigure(0, weight=1) directory = os.path.dirname(projDir) self.proj_dir_select = FileSelect( labelFrame, directory=directory, select_dir_callback=self.selectDir, change_dir_callback=self.updateInfo, should_change_dir_callback=self.shouldChangeDir, getRowColor=self.getEntryColor, show_file=False) self.proj_dir_select.grid(row=0, column=0, sticky=Tkinter.NSEW) row = row + 1 texts = ['Save'] tipTexts = ['Save project with specified name in specified directory'] commands = [self.save] buttons = createDismissHelpButtonList(guiParent, texts=texts, tipTexts=tipTexts, commands=commands, help_msg=self.help_msg, help_url=self.help_url, dismiss_text=self.dismiss_text, expands=True) buttons.grid(row=row, column=0, columnspan=2, sticky=Tkinter.EW)
def __init__(self, parent, project, closeButton=False, tempFiles=False, *args, **kw): ########################################################################### # INIT VARIABLES self.parent = parent self.project = project try: self.nmrProject = (project.currentNmrProject or project.newNmrProject(name='BLACKLEDGE_MODULE')) except: print '&&& Running MODULE popup from outside CCPN Analysis - debug only - no NmrCalc' self.nmrProject = None if self.nmrProject: self.calcStore = project.findFirstNmrCalcStore(name=MODULE, nmrProject=self.nmrProject) or \ project.newNmrCalcStore(name=MODULE, nmrProject=self.nmrProject) else: self.calcStore = None self.run = None self.inputStructure = None self.inputRdcConstraintList = None self.inputDistanceConstraintList = [None] self.inputUserDescriptionText = None # path to the module executable modPath = subprocess.Popen( ['which', 'module'], stdout=subprocess.PIPE).communicate()[0].strip() self.moduleExePath = modPath or ' NB. MODULE executable not found ' self.waiting = False # for debug this could be False if tempFiles: self.useTempFiles = True else: self.useTempFiles = False # create temp files for MODULE if self.useTempFiles: self.moduleTempDir = tempfile.mkdtemp(prefix='MODULE-') else: self.moduleTempDir = os.getcwd() #djo35# self.calcStore = self.resetCalcStore(name='BLACKLEDGE_MODULE') # END INIT OF VARIABLES ########################################################################### ########################################################################### # START GUI CODE Frame.__init__(self, parent, *args, **kw) self.expandGrid(0, 0) ## Single Frame # frame = Frame(self, grid=(0,0)) # or with Tabs? options = ['Launch', 'Output', 'Runs'] tabbedFrame = TabbedFrame(self, options=options, grid=(0, 0)) frameA, frameB, frameC = tabbedFrame.frames self.tabbedFrame = tabbedFrame frameA.expandGrid(14, 2) row = 0 div = LabelDivider(frameA, text='MODULE Setup', grid=(row, 0), gridSpan=(1, 4)) row += 1 # allow the user to choose MODULE if either the one in PATH is incorrect or not found button = Button(frameA, text='Select MODULE executable:',bd=1, \ command=self.selectExecutable, grid=(row,0), sticky="ew") self.moduleExeEntry = Entry(frameA, text=self.moduleExePath, grid=(row,1), gridSpan=(1,3), \ width=32, sticky="ew", bd=1) self.moduleExePath = self.moduleExeEntry.get() # separator "MODULE input" row += 1 div = LabelDivider(frameA, text='MODULE input', grid=(row, 0), gridSpan=(1, 5)) row += 1 label = Label(frameA, text='Structure:', grid=(row, 1)) self.inputStructurePulldown = PulldownList(frameA, self.changeInputStructure, \ grid=(row,2)) # self.constraintsFileEntry.bind('<Leave>', self.updateEntryParams) row += 1 label = Label(frameA, text='RDC constraints:', grid=(row, 1)) self.inputRdcConstraintsPulldown = PulldownList(frameA, self.changeInputRdcConstraintList, \ grid=(row,2)) #self.constraintsFileEntry.bind('<Leave>', self.updateEntryParams) row += 1 label = Label(frameA, text='(Optional input)', grid=(row, 0)) label = Label(frameA, text='Distance constraints:', \ grid=(row,1)) self.inputDistanceConstraintsPulldown = PulldownList(frameA, self.changeInputDistanceConstraintList, \ grid=(row,2)) #self.constraintsFileEntry.bind('<Leave>', self.updateEntryParams) row += 1 subFrameDepth = 4 subframe = LabelFrame(frameA, text='MODULE User Notes (store notes about how MODULE was run here)', \ grid=(row,0), gridSpan=(1,4)) subframe.expandGrid(subFrameDepth, 0) self.moduleUserText = ScrolledText(subframe) self.moduleUserText.grid(row=subFrameDepth, column=0, columnspan=4, sticky='nsew') # View Results row += subFrameDepth # row += 1 # div = LabelDivider(frameA, text='MODULE launch', grid=(row,0), gridSpan=(1,4)) row += 1 button = Button(frameA, text='Run MODULE', bd=1, command=self.executeModule, \ grid=(row,0), gridSpan=(1,4), sticky="ew", bg=MODULE_GREEN) # grid=(row,0), gridSpan=(1,2), sticky="ew", bg=MODULE_GREEN) ########################################################################### # Frame B (tab 2) Ouput frameB.expandGrid(4, 1) row = 0 subFrameDepth = 6 subframe = LabelFrame(frameB, text='MODULE Output', \ grid=(row,0), gridSpan=(1,5)) #subframe.grid_columnconfigure(2, weight=1) subframe.expandGrid(subFrameDepth, 0) self.moduleOutputText = ScrolledText(subframe) self.moduleOutputText.setState(state=Tkinter.DISABLED) self.moduleOutputText.grid(row=subFrameDepth, column=0, columnspan=4, sticky='nsew') # separator "MODULE input" row += 1 div = LabelDivider(frameB, text='MODULE RDC Back Values', grid=(row, 0), gridSpan=(1, 5)) row += 1 button = Button(frameB, text='Import MODULE Back Values file', bd=1, command=self.importModuleBackValues, \ grid=(row,0), gridSpan=(1,4), sticky="ew", bg=MODULE_BLUE) # grid=(row,0), gridSpan=(2,4), sticky="ew", bg=MODULE_BLUE) row += 1 self.rdcOutputTable = None frameB.grid_rowconfigure(row, weight=1) headings = ('#', 'Resonances', 'Value', 'Back Value', 'Diff.', 'Error') editWidgets = [None, None, None, None, None, None] editGetCallbacks = [None, None, None, None, None, None] editSetCallbacks = [None, None, None, None, None, None] self.rdcOutputTable = ScrolledMatrix(frameB, headingList=headings, multiSelect=False, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, initialRows=4) self.rdcOutputTable.grid(row=row, column=0, columnspan=4, sticky='nsew') row += 1 button = Button(frameB, text='Import MODULE Structure', bd=1, command=self.importModuleStructure, \ grid=(row,0), gridSpan=(1,4), sticky="ew", bg=MODULE_BLUE) # grid=(row,0), gridSpan=(2,4), sticky="ew", bg=MODULE_BLUE) ########################################################################### # Frame C (tab 3) NMR Calc display bits frameC.expandGrid(4, 1) row = 0 div = LabelDivider(frameC, text='Stored MODULE Runs', grid=(row, 0), gridSpan=(1, 5)) # NmrCalc Run scrolled matrix row += 1 self.runTable = None frameC.grid_rowconfigure(row, weight=1) headings = ('Run ID', 'notes', 'Status') # self.editRunNotes = DataEntry.askString('Run Notes', 'Edit notes about Run', tipText='Notes about Run', parent=self) # editWidgets = [None, self.editRunNotes, None] editWidgets = [None, None, None] editGetCallbacks = [None, None, None] editSetCallbacks = [None, None, None] self.runTable = ScrolledMatrix(frameC, headingList=headings, multiSelect=False, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, initialRows=4) self.runTable.grid(row=row, column=0, columnspan=4, sticky='nsew') row += 4 tipTexts = ['Load Selected Run', 'Delete Selected Run'] texts = ['Load Selected Run', 'Delete Selected'] commands = [self.loadRun, self.deleteRun] colours = [MODULE_GREEN, MODULE_RED] self.runButtons = ButtonList(frameC, texts=texts, tipTexts=tipTexts, commands=commands, grid=(row, 0), gridSpan=(1, 4)) self.runButtons.buttons[0].config(bg=MODULE_GREEN) self.runButtons.buttons[1].config(bg=MODULE_RED) ########################################################################### # Keep GUI up to date self.updateAfter() self.administerNotifiers(self.parent.registerNotify)
def body(self, guiParent): now = datetime.date.today().strftime('%y%m%d') filePrefix = '%s_%s' % (self.project.name, now) projDir = getUserDataPath(self.project) directory = os.path.dirname(projDir) guiParent.grid_rowconfigure(0, weight=1) guiParent.grid_columnconfigure(1, weight=1) row = 0 label = Label(guiParent, text='Archive File:') label.grid(row=row, column=0, sticky=Tkinter.E) tipText = 'File name (excluding .tgz ending) for archive' self.fileEntry = Entry(guiParent, text=filePrefix, tipText=tipText) self.fileEntry.grid(row=row, column=1, sticky=Tkinter.EW) label = Label(guiParent, text='.tgz (automatically appended)') label.grid(row=row, column=2, sticky=Tkinter.W) row = row + 1 self.backupCheck = CheckButton( guiParent, text='Include *.xml.bak files', tipText='If checked include *.xml.bak files') self.backupCheck.grid(row=row, column=1, columnspan=2, sticky=Tkinter.W) row = row + 1 self.dataCheck = CheckButton( guiParent, text='Include data files which are in project directory', tipText= 'If checked include data files if they are located in project directory' ) self.dataCheck.grid(row=row, column=1, columnspan=2, sticky=Tkinter.W) row = row + 1 labelFrame = LabelFrame(guiParent, text='Archive Location') labelFrame.grid(row=row, column=0, columnspan=3, sticky=Tkinter.NSEW) labelFrame.grid_rowconfigure(0, weight=1) labelFrame.grid_columnconfigure(0, weight=1) self.dirSelect = FileSelect(labelFrame, directory=directory, show_file=False) self.dirSelect.grid(row=0, column=0, sticky=Tkinter.NSEW) guiParent.grid_rowconfigure(row, weight=1) row = row + 1 texts = ['Save'] tipTexts = ['Create archive file'] commands = [self.save] buttons = createDismissHelpButtonList(guiParent, texts=texts, tipTexts=tipTexts, commands=commands, help_msg=self.help_msg, help_url=self.help_url, dismiss_text=self.dismiss_text, expands=True) buttons.grid(row=row, column=0, columnspan=3, sticky=Tkinter.EW)
def body(self, guiFrame): spectraFrame = LabelFrame(guiFrame, text='Spectra', grid=(0, 0)) Label(spectraFrame, text='Diamagnetic Spectrum:', grid=(0, 0)) self.diaSpecPulldown = PulldownList(spectraFrame, callback=self.changeDiaSpec, grid=(0, 1)) Label(spectraFrame, text='Paramagnetic Spectrum:', grid=(1, 0)) self.paraSpecPulldown = PulldownList(spectraFrame, callback=self.changeParaSpec, grid=(1, 1)) pcsIOFrame = LabelFrame(guiFrame, text='PCS', grid=(1, 0)) Label(pcsIOFrame, text='Write Experimental PCS:', grid=(0, 0)) self.expPCSEntry = Entry(pcsIOFrame, text='pcsexp.npc', width=32, grid=(0, 1)) Button(pcsIOFrame, command=self.writePCSFileChange, grid=(0, 2), text='Choose File') Label(pcsIOFrame, text='Read Calculated PCS:', grid=(1, 0)) self.calPCSEntry = Entry(pcsIOFrame, text='pcscal.npc', width=32, grid=(1, 1)) Button(pcsIOFrame, command=self.readPCSFileChange, grid=(1, 2), text='Choose File') scriptFrame = LabelFrame(guiFrame, text='Paramagpy Script', grid=(2, 0)) Label(scriptFrame, text='PCS fitting script:', grid=(0, 0)) self.scriptEntry = Entry(scriptFrame, text='paramagpy_fit_pcs.py', width=32, grid=(0, 1)) Button(scriptFrame, command=self.writeScriptFileChange, grid=(0, 2), text='Choose File') commandFrame = LabelFrame(guiFrame, text='Commands', grid=(3, 0)) Button(commandFrame, command=self.writePCS, grid=(0, 0), text='Write PCS') Button(commandFrame, command=self.fitTensor, grid=(0, 1), text='Fit Tensor') Button(commandFrame, command=self.readPCS, grid=(0, 2), text='Read PCS') self.updateSpecPulldown()
def body(self, guiFrame): self.geometry('700x500') guiFrame.expandGrid(1, 0) row = 0 # TOP LEFT FRAME frame = LabelFrame(guiFrame, text='Options') frame.grid(row=row, column=0, sticky='nsew') frame.columnconfigure(7, weight=1) label = Label(frame, text='Chain') label.grid(row=0, column=0, sticky='w') self.chainPulldown = PulldownList( frame, callback=self.changeChain, tipText='Choose the molecular system chain to make predictions for' ) self.chainPulldown.grid(row=0, column=1, sticky='w') label = Label(frame, text='Shift List') label.grid(row=0, column=2, sticky='w') self.shiftListPulldown = PulldownList( frame, callback=self.changeShiftList, tipText='Select the shift list to take input chemical shifts from') self.shiftListPulldown.grid(row=0, column=3, sticky='w') label = Label(frame, text='Type') label.grid(row=0, column=4, sticky='w') self.scriptPulldown = PulldownList( frame, texts=SCRIPT_TEXTS, callback=self.changeScript, tipText='Select the algorithm script for this chain') self.scriptPulldown.grid(row=0, column=5, sticky='w') self.pHLabel = Label(frame, text='pH') self.pHLabel.grid(row=0, column=6, sticky='w') self.pHPulldown = PulldownList( frame, texts=SCRIPT_PHS, tipText='Select the pH to make the prediction for') self.pHPulldown.grid(row=0, column=7, sticky='w') row += 1 # BOTTOM LEFT FRAME frame = LabelFrame(guiFrame, text='Chemical Shift Predictions') frame.grid(row=row, column=0, sticky='nsew') frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) tipTexts = [ 'Residue number in chain', 'Residue type code', 'Atom name', 'Actual shift (first one it finds for atom in chosen shiftList)', 'CamCoil predicted shift', 'Predicted - Actual' ] headingList = [ 'Res\nNum', 'Res\nType', 'Atom\nName', 'Actual\nShift', 'Predicted\nShift', 'Difference' ] n = len(headingList) editWidgets = n * [None] editGetCallbacks = n * [None] editSetCallbacks = n * [None] self.predictionMatrix = ScrolledMatrix( frame, headingList=headingList, tipTexts=tipTexts, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks) self.predictionMatrix.grid(row=0, column=0, sticky='nsew') row += 1 tipTexts = [ 'Run the CamCoil method to predict chemical shifts from sequence' ] texts = ['Run CamCoil Prediction!'] commands = [self.runCamCoil] self.buttonList = createDismissHelpButtonList(guiFrame, texts=texts, commands=commands, help_url=self.help_url, expands=True, tipTexts=tipTexts) self.buttonList.grid(row=row, column=0) self.update() self.notify(self.registerNotify)
def body(self): '''Describes the body of this tab. It consists out of a number of radio buttons, check buttons and number entries that allow the user to indicate which assignments should be transferred. ''' # self.frame.expandColumn(0) self.frame.expandGrid(8, 0) self.frame.expandGrid(8, 1) typeOfAssignmentFrame = LabelFrame(self.frame, text='type of assignment') typeOfAssignmentFrame.grid(row=0, column=0, sticky='nesw') # typeOfAssignmentFrame.expandGrid(0,5) peakSelectionFrame = LabelFrame(self.frame, text='which peaks to assign') peakSelectionFrame.grid(row=0, column=1, sticky='nesw', rowspan=2) spinSystemSelectionFrame = LabelFrame(self.frame, text='Which spin-systems to use') spinSystemSelectionFrame.grid(row=2, column=0, sticky='nesw') tipText = 'What to do when a residue has already a spin system assigned to it.' assignedResidueFrame = LabelFrame( self.frame, text='if residue already has spin-system', tipText=tipText) assignedResidueFrame.grid(row=2, column=1, sticky='nesw') spectrumSelectionFrame = LabelFrame(self.frame, text='spectra') spectrumSelectionFrame.grid(row=1, column=0, sticky='nesw') row = 0 Label(typeOfAssignmentFrame, text='Resonances to Peak Dimensions', grid=(row, 0)) self.peaksCheckButton = CheckButton(typeOfAssignmentFrame, selected=True, grid=(row, 1)) row += 1 Label(typeOfAssignmentFrame, text='SpinSystems to Residues', grid=(row, 0)) self.residuesCheckButton = CheckButton(typeOfAssignmentFrame, selected=True, grid=(row, 1)) row = 0 Label(peakSelectionFrame, text='Intra-Residual', grid=(row, 0)) self.intraCheckButton = CheckButton(peakSelectionFrame, selected=True, grid=(row, 1)) row += 1 Label(peakSelectionFrame, text='Sequential', grid=(row, 0)) self.sequentialCheckButton = CheckButton(peakSelectionFrame, selected=True, grid=(row, 1)) row += 1 Label(peakSelectionFrame, text='Do not assign diagonal peaks', grid=(row, 0)) self.noDiagonalCheckButton = CheckButton(peakSelectionFrame, selected=True, grid=(row, 1)) entries = [ 'Only assigned spin systems', 'All that have a score of at least: ', 'User Defined', 'Solution number:' ] tipTexts = [ 'Only assign resonances of spin systems that already have a sequential assignment for the assignment of peak dimensions. Spin system to residue assignment is not relevant in this case.', 'Assign all spin systems that have a score of at least a given percentage. 50% or lower is not possible, because than spin systems might have to be assigned to more than 1 residue, which is impossible.', "As defined in the lower row of buttons in the 'results' tab.", 'One of the single solutions of the annealing.' ] self.spinSystemTypeSelect = RadioButtons(spinSystemSelectionFrame, entries=entries, grid=(0, 0), select_callback=None, direction=VERTICAL, gridSpan=(4, 1), tipTexts=tipTexts) tipText = 'The minimal amount of colabelling the different nuclei should have in order to still give rise to a peak.' self.minScoreEntry = FloatEntry(spinSystemSelectionFrame, grid=(1, 1), width=7, text=str(self.minScore), returnCallback=self.changeMinScore, tipText=tipText) self.minScoreEntry.bind('<Leave>', self.changeMinScore, '+') self.solutionNumberEntry = IntEntry(spinSystemSelectionFrame, grid=(3, 1), width=7, text=1, returnCallback=self.solutionUpdate, tipText=tipText) self.solutionNumberEntry.bind('<Leave>', self.solutionUpdate, '+') #self.solutionPullDown = PulldownList(spinSystemSelectionFrame, None, grid=(3,1), sticky='w') entries = ['all spectra', 'only:'] tipTexts = [ 'Assign peaks in all the spectra that where selected before the annealing ran.', 'Only assign peaks in one particular spectrum. You can of course repeat this multiple times for different spectra.' ] self.spectrumSelect = RadioButtons(spectrumSelectionFrame, entries=entries, grid=(0, 0), select_callback=None, direction=VERTICAL, gridSpan=(2, 1), tipTexts=tipTexts) self.spectraPullDown = PulldownList(spectrumSelectionFrame, self.changeSpectrum, grid=(1, 1), sticky='w') entries = [ 'skip this residue', 'de-assign old spin system from residue', 'assign, but never merge', 'warn to merge' ] tipTexts = [ "Don't assign the new spin system to the residue. The residue is not skipped when the old spin system does not contain any resonances", "De-assign old spin system from residue, unless the old spin system is a spin system without any resonances.", "Don't merge any spin systems, merging can be performed later if nescesary in the Resonance --> SpinSystems window.", "Ask to merge individually for each spin system, this might result in clicking on a lot of popups." ] self.assignedResidueStrategySelect = RadioButtons(assignedResidueFrame, entries=entries, grid=(0, 0), select_callback=None, direction=VERTICAL, gridSpan=(2, 1), tipTexts=tipTexts) texts = ['Transfer Assignments'] commands = [self.transferAssignments] self.transferButton = ButtonList(self.frame, commands=commands, texts=texts) self.transferButton.grid(row=5, column=0, sticky='nsew', columnspan=2)
def body(self, mainFrame): mainFrame.grid_columnconfigure(1, weight=1, minsize=100) mainFrame.config(borderwidth=5, relief='solid') row = 0 label = Label(mainFrame, text="Frame (with sub-widgets):") label.grid(row=row, column=0, sticky=Tkinter.E) frame = Frame(mainFrame, relief='raised', border=2, background='#8080D0') # Frame expands East-West frame.grid(row=row, column=1, sticky=Tkinter.EW) # Last column expands => Widgets pusted to the West frame.grid_columnconfigure(3, weight=1) # Label is within the sub frame label = Label(frame, text='label ') label.grid(row=0, column=0, sticky=Tkinter.W) entry = Entry(frame, text='Entry', returnCallback=self.showWarning) entry.grid(row=0, column=1, sticky=Tkinter.W) self.check = CheckButton(frame, text='Checkbutton', selected=True, callback=self.updateObjects) self.check.grid(row=0, column=2, sticky=Tkinter.W) # stick a button to the East wall button = Button(frame, text='Button', command=self.pressButton) button.grid(row=0, column=3, sticky=Tkinter.E) row += 1 label = Label(mainFrame, text="Text:") label.grid(row=row, column=0, sticky=Tkinter.E) self.textWindow = Text(mainFrame, text='Initial Text\n', width=60, height=5) self.textWindow.grid(row=row, column=1, sticky=Tkinter.NSEW) row += 1 label = Label(mainFrame, text="CheckButtons:") label.grid(row=row, column=0, sticky=Tkinter.E) entries = ['Alpha','Beta','Gamma','Delta'] selected = entries[2:] self.checkButtons = CheckButtons(mainFrame, entries, selected=selected,select_callback=self.changedCheckButtons) self.checkButtons.grid(row=row, column=1, sticky=Tkinter.W) row += 1 label = Label(mainFrame, text="PartitionedSelector:") label.grid(row=row, column=0, sticky=Tkinter.E) labels = ['Bool','Int','Float','String'] objects = [type(0),type(1),type(1.0),type('a')] selected = [type('a')] self.partitionedSelector= PartitionedSelector(mainFrame, labels=labels, objects=objects, colors = ['red','yellow','green','#000080'], callback=self.toggleSelector,selected=selected) self.partitionedSelector.grid(row=row, column=1, sticky=Tkinter.EW) row += 1 label = Label(mainFrame, text="PulldownMenu") label.grid(row=row, column=0, sticky=Tkinter.E) entries = ['Frodo','Pipin','Merry','Sam','Bill','Gandalf','Strider','Gimli','Legolas'] self.pulldownMenu = PulldownMenu(mainFrame, callback=self.selectPulldown, entries=entries, selected_index=2, do_initial_callback=False) self.pulldownMenu.grid(row=row, column=1, sticky=Tkinter.W) row += 1 label = Label(mainFrame, text="RadioButtons in a\nScrolledFrame.frame:") label.grid(row=row, column=0, sticky=Tkinter.EW) frame = ScrolledFrame(mainFrame, yscroll = False, doExtraConfig = True, width=100) frame.grid(row=row, column=1, sticky=Tkinter.EW) frame.grid_columnconfigure(0, weight=1) self.radioButtons = RadioButtons(frame.frame, entries=entries, select_callback=self.checkRadioButtons, selected_index=1, relief='groove') self.radioButtons.grid(row=0, column=0, sticky=Tkinter.W) row += 1 label = Label(mainFrame, text="LabelFrame with\nToggleLabels inside:") label.grid(row=row, column=0, sticky=Tkinter.E) labelFrame = LabelFrame(mainFrame, text='Frame Title') labelFrame.grid(row=row, column=1, sticky=Tkinter.NSEW) labelFrame.grid_rowconfigure(0, weight=1) labelFrame.grid_columnconfigure(3, weight=1) self.toggleLabel1 = ToggleLabel(labelFrame, text='ScrolledMatrix', callback=self.toggleFrame1) self.toggleLabel1.grid(row=0, column=0, sticky=Tkinter.W) self.toggleLabel1.arrowOn() self.toggleLabel2 = ToggleLabel(labelFrame, text='ScrolledGraph', callback=self.toggleFrame2) self.toggleLabel2.grid(row=0, column=1, sticky=Tkinter.W) self.toggleLabel3 = ToggleLabel(labelFrame, text='ScrolledCanvas', callback=self.toggleFrame3) self.toggleLabel3.grid(row=0, column=2, sticky=Tkinter.W) row += 1 mainFrame.grid_rowconfigure(row, weight=1) label = Label(mainFrame, text="changing/shrinking frames:") label.grid(row=row, column=0, sticky=Tkinter.E) self.toggleRow = row self.toggleFrame = Frame(mainFrame) self.toggleFrame.grid(row=row, column=1, sticky=Tkinter.NSEW) self.toggleFrame.grid_rowconfigure(0, weight=1) self.toggleFrame.grid_columnconfigure(0, weight=1) # option 1 self.intEntry = IntEntry(self, returnCallback = self.setNumber, width=8) self.multiWidget = MultiWidget(self, Entry, options=None, values=None, callback=self.setKeywords, minRows=3, maxRows=5) editWidgets = [None, None, self.intEntry, self.multiWidget] editGetCallbacks = [None, None, self.getNumber, self.getKeywords] editSetCallbacks = [None, None, self.setNumber, self.setKeywords] headingList = ['Name','Color','Number','Keywords'] self.scrolledMatrix = ScrolledMatrix(self.toggleFrame, headingList=headingList, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, callback=self.selectObject, multiSelect=False) self.scrolledMatrix.grid(row=0, column=0, sticky=Tkinter.NSEW) # option 2 self.scrolledGraph = ScrolledGraph(self.toggleFrame, width=400, height=300, symbolSize=5, symbols=['square','circle'], dataColors=['#000080','#800000'], lineWidths=[0,1] ) self.scrolledGraph.setZoom(1.3) dataSet1 = [[0,0],[1,1],[2,4],[3,9],[4,16],[5,25]] dataSet2 = [[0,0],[1,3],[2,6],[3,9],[4,12],[5,15]] self.scrolledGraph.update(dataSets=[dataSet1,dataSet2], xLabel = 'X axis label', yLabel = 'Y axis label', title = 'Main Title') self.scrolledGraph.draw() # option 3 self.scrolledCanvas = ScrolledCanvas(self.toggleFrame,relief = 'groove', borderwidth = 2, resizeCallback=None) canvas = self.scrolledCanvas.canvas font = 'Helvetica 10' box = canvas.create_rectangle(10,10,150,200, outline='grey', fill='grey90') line = canvas.create_line(0,0,200,200,fill='#800000', width=2) text = canvas.create_text(120,50, text='Text', font=font, fill='black') circle = canvas.create_oval(30,30,50,50,outline='#008000',fill='#404040',width=3) row += 1 label = Label(mainFrame, text="FloatEntry:") label.grid(row=row, column=0, sticky=Tkinter.E) self.floatEntry = FloatEntry(mainFrame, text=3.14159265, returnCallback=self.floatEntryReturn) self.floatEntry.grid(row=row, column=1, sticky=Tkinter.W) row += 1 label = Label(mainFrame, text="Scale:") label.grid(row=row, column=0, sticky=Tkinter.E) self.scale = Scale(mainFrame, from_=10, to=90, value=50, orient=Tkinter.HORIZONTAL) self.scale.grid(row=row, column=1, sticky=Tkinter.W) row += 1 label = Label(mainFrame, text="Value Ramp:") label.grid(row=row, column=0, sticky=Tkinter.E) self.valueRamp = ValueRamp(mainFrame, self.valueRampCallback, speed = 1.5, delay = 50) self.valueRamp.grid(row=row, column=1, sticky=Tkinter.W) row += 1 label = Label(mainFrame, text="ButtonList:") label.grid(row=row, column=0, sticky=Tkinter.E) texts = ['Select File','Close','Quit'] commands = [self.selectFile, self.close, self.quit] bottomButtons = ButtonList(mainFrame, texts=texts, commands=commands, expands=True) bottomButtons.grid(row=row, column=1, sticky=Tkinter.EW) self.protocol('WM_DELETE_WINDOW', self.quit)
def body(self, guiFrame): '''This method describes the outline of the body of the application. args: guiFrame: frame the body should live in. ''' self.geometry('800x530') guiFrame.grid_columnconfigure(0, weight=1) guiFrame.grid_rowconfigure(0, weight=0) guiFrame.grid_rowconfigure(1, weight=2) guiFrame.grid_rowconfigure(2, weight=1) isotopeFrame = LabelFrame(guiFrame, text='Isotope Shift Correction CA and CB') isotopeFrame.grid(row=0, column=0, sticky='nsew') frameA = LabelFrame(guiFrame, text='Spin Systems') frameA.grid(row=1, column=0, sticky='nsew') frameA.grid_rowconfigure(0, weight=1) frameA.grid_columnconfigure(0, weight=1) frameA.grid_columnconfigure(1, weight=1) frameA1 = LabelFrame(frameA, text='Spin System 1') frameA1.grid(row=0, column=0, sticky='nsew') frameA1.grid_columnconfigure(0, weight=1) frameA1.grid_rowconfigure(0, weight=1) frameA2 = LabelFrame(frameA, text='Spin System 2') frameA2.grid(row=0, column=1, sticky='nsew') frameA2.grid_columnconfigure(0, weight=1) frameA2.grid_rowconfigure(0, weight=1) frameB = LabelFrame(guiFrame, text='Comparison') frameB.grid(row=2, column=0, sticky='nsew') frameB.grid_rowconfigure(0, weight=1) frameB.grid_columnconfigure(0, weight=1) frameB.grid_columnconfigure(1, weight=2) frameB.grid_columnconfigure(2, weight=1) frameB1 = LabelFrame(frameB, text='Unique to Spin System 1') frameB1.grid(row=0, column=0, sticky='nsew') frameB1.expandGrid(0, 0) frameB2 = LabelFrame(frameB, text='Intersection') frameB2.grid(row=0, column=1, sticky='nsew') frameB2.expandGrid(0, 0) frameB3 = LabelFrame(frameB, text='Unique to Spin System 2') frameB3.grid(row=0, column=2, sticky='nsew') frameB3.expandGrid(0, 0) # Settings for isotope shift correction shiftLists = getShiftLists(self.nmrProject) self.protonatedShiftList = shiftLists[0] self.deuteratedShiftList = shiftLists[1] shiftListNames = [ '{}: {}'.format(shiftList.serial, shiftList.name) for shiftList in shiftLists ] Label(isotopeFrame, text='Correct for isotope shift:', grid=(0, 0)) self.correctCheck = CheckButton(isotopeFrame, selected=True, callback=self.setCorrection, grid=(0, 1)) Label(isotopeFrame, text='Protonated shift list:', grid=(1, 0)) self.protonatedPulldown = PulldownList( isotopeFrame, callback=self.setProtonatedShiftList, texts=shiftListNames, objects=shiftLists, grid=(1, 1), index=0) Label(isotopeFrame, text='Deuterated shift list:', grid=(2, 0)) self.deuteratedPulldown = PulldownList( isotopeFrame, callback=self.setDeuteratedShiftList, texts=shiftListNames, objects=shiftLists, grid=(2, 1), index=1) # Table A1 headingList = ['#', 'shift lists', 'Assignment'] tipTexts = [ 'Spin System Serial', 'shift lists', 'The residue (tentatively) assigned to this spin system', 'The amount of spin systems that overlap with this spin system and have no violations' ] editGetCallbacks = [self.setSpinSystem1] * 3 editSetCallbacks = [None] * 3 self.tableA1 = ScrolledMatrix(frameA1, headingList=headingList, multiSelect=False, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, tipTexts=tipTexts) self.tableA1.grid(row=0, column=0, sticky='nsew') # Table A2 headingList = ['#', 'shift lists', 'Assignment', 'offset'] tipTexts = [ 'Spin System Serial', 'The residue (tentatively) assigned to this spin system', 'Root mean squared deviation of this spin system to the spin system selected in the table on the left.' ] editGetCallbacks = [self.setSpinSystem2] * 4 editSetCallbacks = [None] * 4 self.tableA2 = ScrolledMatrix( frameA2, headingList=headingList, #editWidgets=editWidgets, multiSelect=False, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, tipTexts=tipTexts) self.tableA2.grid(row=0, column=0, sticky='nsew') # Table B1 headingList = ['atom', 'c.s.'] tipTexts = ['atom', 'chemical shift'] self.tableB1 = ScrolledMatrix(frameB1, headingList=headingList, multiSelect=False, tipTexts=tipTexts) self.tableB1.grid(row=0, column=0, sticky='nsew') # Table B 2 headingList = ['atom', 'c.s. 1', 'c.s. 2', 'delta c.s.'] tipTexts = [ 'name of the atom', 'chemical shift of atom with this name in spin system 1', 'chemical shift of atom with this name in spin system 2', 'difference between the chemical shift of spin systems 1 and 2' ] self.tableB2 = ScrolledMatrix(frameB2, headingList=headingList, tipTexts=tipTexts) self.tableB2.grid(row=0, column=0, sticky='nsew') # Table B 3 headingList = ['atom', 'c.s.'] tipTexts = ['atom', 'chemical shift.'] self.tableB3 = ScrolledMatrix(frameB3, headingList=headingList, multiSelect=False, tipTexts=tipTexts) self.tableB3.grid(row=0, column=0, sticky='nsew') self.matchMatrix = {} self.amountOfMatchesPerSpinSystem = {} self.updateTableA1()
def body(self, guiFrame): self.geometry('600x350') guiFrame.expandGrid(0, 0) tipTexts = ['', '', '', ''] options = [ 'Find Parameters', 'Spectrum Widths', 'Diagonal Exclusions', 'Region Peak Find' ] tabbedFrame = TabbedFrame(guiFrame, options=options, grid=(0, 0)) frameA, frameB, frameC, frameD = tabbedFrame.frames self.tabbedFrame = tabbedFrame # Find Params frameA.expandGrid(2, 0) row = 0 label = LabelFrame(frameA, text='Extrema to search for:', grid=(row, 0), gridSpan=(1, 2)) label.expandGrid(0, 1) entries = ['positive and negative', 'positive only', 'negative only'] tipTexts = [ 'Sets whether peak picking within spectra find intensity maxima, minima or both maxima and minima', ] self.extrema_buttons = RadioButtons(label, entries=entries, select_callback=self.apply, direction='horizontal', grid=(0, 0), tipTexts=tipTexts) row += 1 label = LabelFrame(frameA, text='Nearby points to check:', grid=(row, 0), gridSpan=(1, 2)) label.expandGrid(None, 1) entries = ['+-1 in at most one dim', '+-1 allowed in any dim'] tipTexts = [ 'Sets how permissive the peak picking in when searching for intensity extrema; by adding extra points to the selected search region', ] self.adjacent_buttons = RadioButtons(label, entries=entries, select_callback=self.apply, direction='horizontal', grid=(0, 0), tipTexts=tipTexts) row += 1 labelFrame = LabelFrame(frameA, text='Other parameters:', grid=(row, 0), gridSpan=(1, 2)) labelFrame.expandGrid(5, 2) frow = 0 label = Label(labelFrame, text='Scale relative to contour levels:', grid=(frow, 0), sticky='e') tipText = 'Threshold above which peaks are picked, relative to the lowest displayed contour; 1.0 means picking exactly what is visible' self.scale_entry = FloatEntry(labelFrame, grid=(frow, 1), tipText=tipText, returnCallback=self.apply, width=10) self.scale_entry.bind('<Leave>', self.apply, '+') frow += 1 label = Label(labelFrame, text='Exclusion buffer around peaks (in points):', grid=(frow, 0), sticky='e') tipText = 'The size of the no-pick region, in data points, around existing picked peaks; eliminates duplicate picking' self.buffer_entry = IntEntry(labelFrame, returnCallback=self.apply, grid=(frow, 1), width=10, tipText=tipText) self.buffer_entry.bind('<Leave>', self.apply, '+') frow += 1 label = Label(labelFrame, text='Extra thickness in orthogonal dims (in points):', grid=(frow, 0), sticky='e') tipText = 'Sets whether to consider any additional planes (Z dimension) when calculating peak volume integrals' self.thickness_entry = IntEntry(labelFrame, returnCallback=self.apply, width=10, grid=(frow, 1), tipText=tipText) self.thickness_entry.bind('<Leave>', self.apply, '+') frow += 1 label = Label(labelFrame, text='Minimum drop factor (0.0-1.0):', grid=(frow, 0), sticky='e') tipText = '' self.drop_entry = FloatEntry(labelFrame, returnCallback=self.apply, width=10, grid=(frow, 1), tipText=tipText) self.drop_entry.bind('<Leave>', self.apply, '+') frow += 1 label = Label(labelFrame, text='Volume method:', grid=(frow, 0), sticky='e') tipText = 'Selects which method to use to calculate peak volume integrals when peaks are picked; box sizes are specified in "Spectrum Widths"' self.method_menu = PulldownList(labelFrame, texts=PeakBasic.PEAK_VOLUME_METHODS, grid=(frow, 1), callback=self.apply, tipText=tipText) # Spectrum widths frameB.expandGrid(1, 1) label = Label(frameB, text='Spectrum: ') label.grid(row=0, column=0, sticky='e') tipText = 'The spectrum which determines the widths being shown' self.expt_spectrum = PulldownList(frameB, tipText=tipText, callback=self.setSpectrumProperties) self.expt_spectrum.grid(row=0, column=1, sticky='w') self.editLinewidthEntry = FloatEntry(self, text='', returnCallback=self.setLinewidth, width=10) self.editBoxwidthEntry = FloatEntry(self, text='', returnCallback=self.setBoxwidth, width=10) tipTexts = [ 'The number of the spectrum dimension to which the settings apply', 'The nuclear isotope measures in the spectrum dimension', 'The smallest value for the linewidth of a peak for it to be picked', 'The size of the spectrum region to perform the volume integral over' ] headingList = [ 'Dimension', 'Isotope', 'Minimum Linewidth (Hz)', 'Boxwidth' ] editSetCallbacks = [None, None, self.setLinewidth, self.setBoxwidth] editGetCallbacks = [None, None, self.getLinewidth, self.getBoxwidth] editWidgets = [ None, None, self.editLinewidthEntry, self.editBoxwidthEntry ] self.spectrumMatrix = ScrolledMatrix(frameB, initialRows=6, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, headingList=headingList, callback=self.selectCell, tipTexts=tipTexts) self.spectrumMatrix.grid(row=1, column=0, columnspan=2, sticky='nsew') # Diagonal Exclusions frameC.expandGrid(0, 0) tipTexts = [ 'The isotope as measures on the axis of a spectrum window', 'The distance from the homonuclear diagonal line within which no peak picking can occur' ] self.exclusionEntry = FloatEntry(self, text='', returnCallback=self.setExclusion, width=10) headingList = ['Isotope', 'Diagonal Exclusion (ppm)'] editSetCallbacks = [None, self.setExclusion] editGetCallbacks = [None, self.getExclusion] editWidgets = [None, self.exclusionEntry] self.isotopeMatrix = ScrolledMatrix(frameC, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, headingList=headingList, grid=(0, 0), tipTexts=tipTexts) # Region peak find self.regionFindPeakList = None self.regionCondition = None self.regionConditions = [] self.regionCol = 1 row = 0 label = Label(frameD, text='Peak List: ', grid=(0, 0)) tipText = 'Selects which peak list to perform region-wide peak picking for' self.regionPeakListPulldown = PulldownList( frameD, callback=self.changeRegionPeakList, grid=(0, 1), tipText=tipText) row += 1 frameD.expandGrid(row, 1) self.regionEntry = FloatEntry(self, text='', returnCallback=self.setRegion, width=10) self.conditionMenu = PulldownList(self, texts=('include', 'exclude'), callback=self.setCondition) tipTexts = [ 'Whether to include or exclude the states region from region-wide peak picking', ] headingList = ['Condition'] editSetCallbacks = [None] editGetCallbacks = [None] editWidgets = [self.conditionMenu] self.regionFindMatrix = ScrolledMatrix( frameD, headingList=headingList, callback=self.selectRegionCell, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, grid=(row, 0), gridSpan=(1, 2)) row += 1 tipTexts = [ 'Sets the currently selected region row to cover the whole spectrum', 'Add a new region row, which may them be set for exclusion or inclusion when peak picking large areas', 'Remove the selected region specification', 'Go to the panel for setting the parameters that control how peaks extrema are picked', 'Using the stated regions and parameters, perform region-wide peak picking' ] texts = [ 'Whole Region', 'Add Region', 'Delete Region', 'Adjust Params', 'Find Peaks!' ] commands = [ self.wholeRegion, self.addCondition, self.deleteCondition, self.adjustParams, self.regionFindPeaks ] buttons = ButtonList(frameD, texts=texts, commands=commands, grid=(row, 0), gridSpan=(1, 2), tipTexts=tipTexts) buttons.buttons[4].config(bg='#B0FFB0') utilButtons = UtilityButtonList(tabbedFrame.sideFrame, grid=(0, 0), helpUrl=self.help_url, sticky='e') self.dataDim = None self.setParamsEntries() self.updateSpectrum() self.setIsotopeProperties() self.updateRegionPeakLists() self.administerNotifiers(self.registerNotify)
def body(self, guiFrame): guiFrame.grid_columnconfigure(3, weight=1) row = 0 label = Label(guiFrame, text='Spin System: ', grid=(row,0)) tipText = 'Indicates which spin system the residue type prediction is done for' self.spinSystemLabel = Label(guiFrame, text='Serial: Assignment:', grid=(row,1), gridSpan=(1,3), tipText=tipText) row += 1 label = Label(guiFrame, text='Shift List: ', grid=(row,0)) tipText = 'Selects which shift list is the source of chemical shift information to make the residue type prediction' self.shiftListPulldown = PulldownList(guiFrame, tipText=tipText, callback=self.setShiftList, grid=(row,1)) label = Label(guiFrame, text='Chain: ', grid=(row,2)) tipText = 'Selects which molecular chain the prediction is for; sets prior probabilities for the various residue types' self.chainPulldown = PulldownList(guiFrame, self.changeChain, grid=(row,3), tipText=tipText) row += 1 labelFrame = LabelFrame(guiFrame, text='Resonances', grid=(row,0), gridSpan=(1,4)) labelFrame.expandGrid(0,0) self.atomTypePulldown = PulldownList(self, callback=self.setAtomType) editWidgets = [ None, None, None, None, self.atomTypePulldown ] editGetCallbacks = [ None, None, None, None, self.getAtomType] editSetCallbacks = [ None, None, None, None, self.setAtomType] tipTexts = ['The nuclear isotope type of the resonance within the current spin system', 'The assignment annotation for the spin system resonance within the current spin system', 'The chemical shift of the resonance in the stated shift list', 'The weighted standard deviation of the resonance chemical shift', 'The current atom type of the resonance; when set this helps refine residue type prediction'] headingList = ['Isotope','Name','Shift\nValue','Shift\nError','Atom\nType'] self.resonanceMatrix = ScrolledMatrix(labelFrame, editWidgets=editWidgets, multiSelect=False, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, headingList=headingList, callback=self.selectResonance, grid=(0,0), tipTexts=tipTexts) tipTexts = ['Remove the selected resonance from the current spin system', 'Remove residue type information from the current spin system', 'Show a table of information for the selected resonance, including a list of all peak dimension positions', 'Show a table of the peaks to which the selected resonance is assigned'] texts = ['Remove From\nSpin System', 'Deassign\nResidue Type', 'Resonance\nInfo', 'Show\nPeaks'] commands = [self.removeResonance, self.deassignType, self.showResonanceInfo, self.showPeaks] buttonList = ButtonList(labelFrame, texts=texts, commands=commands, grid=(1,0), tipTexts=tipTexts) self.resButtons = buttonList.buttons row += 1 guiFrame.grid_rowconfigure(row, weight=1) labelFrame = LabelFrame(guiFrame, text='Type Scores', grid=(row,0), gridSpan=(1,4)) labelFrame.expandGrid(0,0) tipTexts = ['The ranking of the residue type possibility for the current spin system', 'The CCPN residue code for the type', 'The estimated percentage probability of the spin system being the residue type'] headingList = ['Rank','Ccp Code','% Probability'] self.scoresMatrix = ScrolledMatrix(labelFrame, headingList=headingList, callback=self.selectCcpCode, grid=(0,0), tipTexts=tipTexts) row += 1 tipTexts = ['Assign the residue type of the current spin system to the kind selected in the lower table',] texts = ['Assign Spin System Type'] commands = [self.assign] bottomButtons = UtilityButtonList(guiFrame, texts=texts, commands=commands, helpUrl=self.help_url, grid=(row,0), gridSpan=(1,4), tipTexts=tipTexts) self.assignButton = bottomButtons.buttons[0] self.updateShiftLists() self.updateChains() self.getChainAtomTypes() self.update() self.curateNotifiers(self.registerNotify)
def body(self, guiFrame): guiFrame.grid_columnconfigure(2, weight=1) row = 0 label = Label(guiFrame, text='Template window: ', grid=(row, 0)) tipText = 'Selects which window to use as the basis for making a new spectrum window; sets the axis types accordingly' self.window_list = PulldownList(guiFrame, grid=(row, 1), callback=self.setAxisTypes, tipText=tipText) frame = LabelFrame(guiFrame, text='Strips', grid=(row, 2), gridSpan=(2, 1)) buttons = UtilityButtonList(guiFrame, doClone=False, helpUrl=self.help_url, grid=(row, 3)) row += 1 label = Label(guiFrame, text='New window name: ', grid=(row, 0)) tipText = 'A short name to identify the spectrum window, which will appear in the graphical interface' self.nameEntry = Entry(guiFrame, width=16, grid=(row, 1), tipText=tipText) row += 1 label = Label(frame, text='Columns: ', grid=(0, 0)) tipText = 'The number of vertical strips/dividers to initially make in the spectrum window' self.cols_menu = PulldownList(frame, objects=STRIP_NUMS, grid=(0, 1), texts=[str(x) for x in STRIP_NUMS], tipText=tipText) label = Label(frame, text='Rows: ', grid=(0, 2)) tipText = 'The number of horizontal strips/dividers to initially make in the spectrum window' self.rows_menu = PulldownList(frame, objects=STRIP_NUMS, grid=(0, 3), texts=[str(x) for x in STRIP_NUMS], tipText=tipText) row += 1 div = LabelDivider(guiFrame, text='Axes', grid=(row, 0), gridSpan=(1, 4)) row += 1 self.axis_lists = {} frame = Frame(guiFrame, grid=(row, 0), gridSpan=(1, 4)) col = 0 self.axisTypes = {} self.axisTypesIncludeNone = {} for label in AXIS_LABELS: self.axisTypes[label] = None w = Label(frame, text=' ' + label) w.grid(row=0, column=col, sticky='w') col += 1 if label in ('x', 'y'): includeNone = False tipText = 'Sets the kind of measurement (typically ppm for a given isotope) that will be used along the window %s axis' % label else: includeNone = True tipText = 'Where required, sets the kind of measurement (typically ppm for a given isotope) that will be used along the window %s axis' % label self.axisTypesIncludeNone[label] = includeNone getAxisTypes = lambda label=label: self.getAxisTypes(label) callback = lambda axisType, label=label: self.changedAxisType( label, axisType) self.axis_lists[label] = PulldownList(frame, callback=callback, tipText=tipText) self.axis_lists[label].grid(row=0, column=col, sticky='w') col += 1 frame.grid_columnconfigure(col, weight=1) row += 1 div = LabelDivider(guiFrame, text='Viewed Spectra', grid=(row, 0), gridSpan=(1, 4)) row += 1 guiFrame.grid_rowconfigure(row, weight=1) editWidgets = [None, None, None, None] editGetCallbacks = [None, self.toggleVisible, self.toggleToolbar, None] editSetCallbacks = [None, None, None, None] tipTexts = [ 'The "experiment:spectrum" name for the spectrum that may be viewed in the new window, given the axis selections', 'Sets whether the spectrum contours will be visible in the new window', 'Sets whether the spectrum appears at all in the window; if not in the toolbar it cannot be displayed', 'The number of peak lists the spectrum contains' ] headingList = ['Spectrum', 'Visible?', 'In Toolbar?', 'Peak Lists'] self.scrolledMatrix = ScrolledMatrix(guiFrame, headingList=headingList, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, multiSelect=True, grid=(row, 0), gridSpan=(1, 4), tipTexts=tipTexts) row += 1 tipTexts = [ 'Creates a new spectrum window with the specified parameters', 'Sets the contours of the selected spectra to be visible when the new window is made', 'Sets the contours of the selected spectra to not be displayed when the new window is made', 'Sets the selected spectra as absent from the window toolbar, and thus not displayable at all' ] texts = [ 'Create Window!', 'Selected\nVisible', 'Selected\nNot Visible', 'Selected\nNot In Toolbar' ] commands = [ self.ok, self.setSelectedDisplay, self.setSelectedHide, self.setSelectedAbsent ] buttonList = ButtonList(guiFrame, texts=texts, grid=(row, 0), commands=commands, gridSpan=(1, 4), tipTexts=tipTexts) buttonList.buttons[0].config(bg='#B0FFB0') self.updateAxisTypes() self.updateWindow() self.updateWindowName() self.administerNotifiers(self.registerNotify) self.updateAfter()
def body(self, guiFrame): guiFrame.grid_columnconfigure(3, weight=1) self.progressBar = TypingEnsemblePopup(self,total=100) self.progressBar.close() row = 0 label = Label(guiFrame, text=' Chain: ', grid=(row,0)) tipText = 'Selects which molecular chain the spin system residue types will be predicted for; determines which range of types are available' self.chainPulldown = PulldownList(guiFrame, self.changeChain, grid=(row,1), tipText=tipText) tipText = 'Selects which shift list will be used as the source of chemical shift information to make the residue type predictions' label = Label(guiFrame, text='Shift List: ', grid=(row,2)) self.shiftListPulldown = PulldownList(guiFrame, callback=self.setShiftList, grid=(row,3), tipText=tipText) utilButtons = UtilityButtonList(guiFrame, helpUrl=self.help_url) utilButtons.grid(row=row, column=4, sticky='w') row += 1 frame = LabelFrame(guiFrame, text='Options', grid=(row,0), gridSpan=(1,5)) frame.grid_columnconfigure(3, weight=1) frow = 0 label = Label(frame, text='Keep existing types?', grid=(frow,0), sticky='e') tipText = 'Whether any existing residue type information should be preserved, when predicting the type of others' self.preserveTypesSelect = CheckButton(frame, grid=(frow,1), selected=False, callback=self.selectPreserveTypes, tipText=tipText) label = Label(frame, text='Assignment threshold: ', grid=(frow,2), sticky='e') tipText = 'The lower limit for the predicted residue type to be set with "Assign Types"; needs to be adjusted according to result statistics and amount of shift data' self.thresholdEntry = FloatEntry(frame, text=self.threshold, width=8, grid=(frow,3), tipText=tipText) frow += 1 label = Label(frame, text='Ensemble size: ', grid=(frow,0), sticky='e') tipText = 'The number of best scoring residue type mappings, from the Monte Carlo search, to use un the prediction' self.ensembleEntry = IntEntry(frame,text=20,width=4, grid=(frow,1), tipText=tipText) label = Label(frame, text='Num Search Steps: ', grid=(frow,2), sticky='e') tipText = 'The number of iterative steps that will be used in the Monte Carlo search of best spin system to residue type mappings' self.stepsEntry = IntEntry(frame, text=100000, width=8, tipText=tipText, grid=(frow,3)) frow += 1 label = Label(frame, text='Isotope shifts to consider:', grid=(frow,0), gridSpan=(1,4)) frow += 1 self.isotopes = ['1H','13C'] isos = ['1H','13C','15N'] colors = [COLOR_DICT[x] for x in isos] tipText = 'Selects which kinds of resonances, in terms of isotope, the residue type predictions will be made with' self.isotopeCheckButtons = PartitionedSelector(frame, labels=isos, objects=isos, colors=colors, callback=self.toggleIsotope, selected=self.isotopes, grid=(frow,0), gridSpan=(1,4), tipText=tipText) row += 1 guiFrame.grid_rowconfigure(row, weight=1) labelFrame = LabelFrame(guiFrame, text='Spin Systems', grid=(row,0), gridSpan=(1,5)) labelFrame.expandGrid(0,0) tipTexts = ['The spin system serial number', 'The residue to which the spin system may currently be assigned', 'Set whether to include a particular spin system in the type predictions', 'The spin system to residue type match score for a prediction; higher (less negative) is better', 'The predicted types of residue that the spin system may be', 'The chemical shifts in the spin system that will be used in the analysis'] headingList = ['#','Residue','Use?','Score','Types','Shifts'] justifyList = ['center','center','center','center','center','left'] editWidgets = [None, None, None, None, None, None] editGetCallbacks = [None, None, self.toggleInclude, None, None, None] editSetCallbacks = [None, None, None, None, None, None] self.scrolledMatrix = ScrolledMatrix(labelFrame, headingList=headingList, justifyList=justifyList, editSetCallbacks=editSetCallbacks, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, callback=self.selectCell, grid=(0,0), tipTexts=tipTexts) row += 1 tipTexts = ['Execute the Monte Carlo search that will make the residue type predictions for the spin systems', 'Assign the residue type of spin systems with a unique type prediction and prediction score above the stated threshold', 'Show a residue type prediction for the selected spin system alone; only considers that spin system of shifts, not how all spin systems fit to the sequence', 'Show a table of peaks that are assigned to the resonances of the selected spin system'] texts = ['Run\nTyping','Assign\nTypes', 'Show Individual\nClassification', 'Show\nPeaks'] commands = [self.run, self.assign, self.individualScore, self.showPeaks] bottomButtons = ButtonList(guiFrame, texts=texts, commands=commands, grid=(row,0), gridSpan=(1,5), tipTexts=tipTexts) self.runButton = bottomButtons.buttons[0] self.assignButton = bottomButtons.buttons[1] self.scoreButton = bottomButtons.buttons[2] self.peaksButton = bottomButtons.buttons[2] self.runButton.config(bg='#B0FFB0') for func in ('__init__','delete'): self.registerNotify(self.updateChains, 'ccp.molecule.MolSystem.Chain', func) self.registerNotify(self.updateShiftLists, 'ccp.nmr.Nmr.ShiftList', func) for func in ('__init__','delete','setCcpCode', 'setResidue','addResonance', 'setName', 'removeResonance','setResonances'): self.registerNotify(self.updateSpinSystemsAfter, 'ccp.nmr.Nmr.ResonanceGroup', func) self.updateChains() self.updateShiftLists() self.updateSpinSystems()
def body(self, guiFrame): self.geometry('700x500') guiFrame.expandGrid(1, 0) row = 0 # TOP LEFT FRAME frame = LabelFrame(guiFrame, text='Options') frame.grid(row=row, column=0, sticky='nsew') frame.columnconfigure(5, weight=1) label = Label(frame, text='Chain') label.grid(row=0, column=0, sticky='w') self.chainPulldown = PulldownList( frame, callback=self.changeChain, tipText='Choose the molecular system chain to make predictions for' ) self.chainPulldown.grid(row=0, column=1, sticky='w') label = Label(frame, text='Shift List') label.grid(row=0, column=2, sticky='w') self.shiftListPulldown = PulldownList( frame, callback=self.changeShiftList, tipText='Select the shift list to take input chemical shifts from') self.shiftListPulldown.grid(row=0, column=3, sticky='w') row += 1 # BOTTOM LEFT FRAME frame = LabelFrame(guiFrame, text='Secondary Structure Predictions') frame.grid(row=row, column=0, sticky='nsew') frame.grid_columnconfigure(0, weight=1) frame.grid_rowconfigure(0, weight=1) tipTexts = ('Residue number in chain', 'Residue type code', 'Current stored secondary structure code', 'Predicted secondary structure code') + SEC_STRUC_TIPS headingList = ('Res\nNum', 'Res\nType', 'Current\nSS', 'Predicted\nSS') + SEC_STRUC_KEYS n = len(headingList) editWidgets = n * [None] editGetCallbacks = n * [None] editSetCallbacks = n * [None] self.predictionMatrix = ScrolledMatrix( frame, headingList=headingList, tipTexts=tipTexts, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks) self.predictionMatrix.grid(row=0, column=0, sticky='nsew') row += 1 tipTexts = [ 'Run the D2D method to predict secondary structure', 'Store the secondary structure predictions in the CCPN project' ] texts = [ 'Run D2D Prediction!', 'Commit Predicted\nSecondary Structure' ] commands = [self.runD2D, self.storeSecondaryStructure] self.buttonList = createDismissHelpButtonList(guiFrame, texts=texts, commands=commands, help_url=self.help_url, expands=True, tipTexts=tipTexts) self.buttonList.grid(row=row, column=0, columnspan=2, sticky='ew') self.update() self.notify(self.registerNotify)
def __init__(self, parent, application, *args, **kw): project = application.project simStore = project.findFirstNmrSimStore(application=APP_NAME) or \ project.newNmrSimStore(application=APP_NAME, name=APP_NAME) self.application = application self.residue = None self.structure = None self.serverCredentials = None self.iCingBaseUrl = DEFAULT_URL self.resultsUrl = None self.chain = None self.nmrProject = application.nmrProject self.serverDone = False NmrSimRunFrame.__init__(self, parent, project, simStore, *args, **kw) # # # # # # New Structure Frame # # # # # self.structureFrame.grid_forget() tab = self.tabbedFrame.frames[0] frame = Frame(tab, grid=(1,0)) frame.expandGrid(2,1) div = LabelDivider(frame, text='Structures', grid=(0,0), gridSpan=(1,2)) label = Label(frame, text='Ensemble: ', grid=(1,0)) self.structurePulldown = PulldownList(frame, callback=self.changeStructure, grid=(1,1)) headingList = ['Model','Use'] editWidgets = [None,None] editGetCallbacks = [None,self.toggleModel] editSetCallbacks = [None,None,] self.modelTable = ScrolledMatrix(frame, grid=(2,0), gridSpan=(1,2), callback=self.selectStructModel, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, headingList=headingList) texts = ['Activate Selected','Inactivate Selected'] commands = [self.activateModels, self.disableModels] buttons = ButtonList(frame, texts=texts, commands=commands, grid=(3,0), gridSpan=(1,2)) # # # # # # Submission frame # # # # # # tab = self.tabbedFrame.frames[1] tab.expandGrid(1,0) frame = LabelFrame(tab, text='Server Job Submission', grid=(0,0)) frame.expandGrid(None,2) srow = 0 label = Label(frame, text='iCing URL:', grid=(srow, 0)) urls = [DEFAULT_URL,] self.iCingBaseUrlPulldown = PulldownList(frame, texts=urls, objects=urls, index=0, grid=(srow,1)) srow +=1 label = Label(frame, text='Results File:', grid=(srow, 0)) self.resultFileEntry = Entry(frame, bd=1, text='', grid=(srow,1), width=50) self.setZipFileName() button = Button(frame, text='Choose File', bd=1, sticky='ew', command=self.chooseZipFile, grid=(srow, 2)) srow +=1 label = Label(frame, text='Results URL:', grid=(srow, 0)) self.resultUrlEntry = Entry(frame, bd=1, text='', grid=(srow,1), width=50) button = Button(frame, text='View Results HTML', bd=1, sticky='ew', command=self.viewHtmlResults, grid=(srow, 2)) srow +=1 texts = ['Submit Project!', 'Check Run Status', 'Purge Server Result', 'Download Results'] commands = [self.runCingServer, self.checkStatus, self.purgeCingServer, self.downloadResults] self.buttonBar = ButtonList(frame, texts=texts, commands=commands, grid=(srow, 0), gridSpan=(1,3)) for button in self.buttonBar.buttons[:1]: button.config(bg=CING_BLUE) # # # # # # Residue frame # # # # # # frame = LabelFrame(tab, text='Residue Options', grid=(1,0)) frame.expandGrid(1,1) label = Label(frame, text='Chain: ') label.grid(row=0,column=0,sticky='w') self.chainPulldown = PulldownList(frame, callback=self.changeChain) self.chainPulldown.grid(row=0,column=1,sticky='w') headingList = ['#','Residue','Linking','Decriptor','Use?'] editWidgets = [None,None,None,None,None] editGetCallbacks = [None,None,None,None,self.toggleResidue] editSetCallbacks = [None,None,None,None,None,] self.residueMatrix = ScrolledMatrix(frame, headingList=headingList, multiSelect=True, editWidgets=editWidgets, editGetCallbacks=editGetCallbacks, editSetCallbacks=editSetCallbacks, callback=self.selectResidue) self.residueMatrix.grid(row=1, column=0, columnspan=2, sticky = 'nsew') texts = ['Activate Selected','Inactivate Selected'] commands = [self.activateResidues, self.deactivateResidues] self.resButtons = ButtonList(frame, texts=texts, commands=commands,) self.resButtons.grid(row=2, column=0, columnspan=2, sticky='ew') """ # # # # # # Validate frame # # # # # # frame = LabelFrame(tab, text='Validation Options', grid=(2,0)) frame.expandGrid(None,2) srow = 0 self.selectCheckAssign = CheckButton(frame) self.selectCheckAssign.grid(row=srow, column=0,sticky='nw' ) self.selectCheckAssign.set(True) label = Label(frame, text='Assignments and shifts') label.grid(row=srow,column=1,sticky='nw') srow += 1 self.selectCheckResraint = CheckButton(frame) self.selectCheckResraint.grid(row=srow, column=0,sticky='nw' ) self.selectCheckResraint.set(True) label = Label(frame, text='Restraints') label.grid(row=srow,column=1,sticky='nw') srow += 1 self.selectCheckQueen = CheckButton(frame) self.selectCheckQueen.grid(row=srow, column=0,sticky='nw' ) self.selectCheckQueen.set(False) label = Label(frame, text='QUEEN') label.grid(row=srow,column=1,sticky='nw') srow += 1 self.selectCheckScript = CheckButton(frame) self.selectCheckScript.grid(row=srow, column=0,sticky='nw' ) self.selectCheckScript.set(False) label = Label(frame, text='User Python script\n(overriding option)') label.grid(row=srow,column=1,sticky='nw') self.validScriptEntry = Entry(frame, bd=1, text='') self.validScriptEntry.grid(row=srow,column=2,sticky='ew') scriptButton = Button(frame, bd=1, command=self.chooseValidScript, text='Browse') scriptButton.grid(row=srow,column=3,sticky='ew') """ # # # # # # # # # # self.update(simStore) self.administerNotifiers(application.registerNotify)