示例#1
0
  def body(self, guiParent):

    self.geometry('320x120')
    analysisProject = self.analysisProject
    guiParent.expandGrid(5,3)
    guiParent.expandGrid(5,4)

    row = 0
    div = LabelDivider(guiParent, text='Multi-dimensional Marks',
                       grid=(row,0), gridSpan=(1,4))
 
    buttons = UtilityButtonList(guiParent, doClone=False, helpUrl=self.help_url)
    buttons.grid(row=row, column=4, sticky='w')
    
    row += 1

    label = Label(guiParent, text='Maximum marks: ', grid=(row,0))
 
    values = range(1, self.maxAllowedMarks+1)
    entries = [ str(x) for x in  values]
    value = analysisProject.maxMarks
    tipText = 'Sets the maximum number of multi-dimensional cross-marks that the user can add to spectrum window displays'
    self.marks_menu = PulldownList(guiParent, callback=self.setMaxMarks, grid=(row,1),
                                   texts=entries, objects=values,
                                   index=value-1, tipText=tipText)

    label = Label(guiParent, text=' Mark colour: ', grid=(row,2))
 
    tipText = 'Sets the line colour of the multi-dimensional cross-marks, excepting those that go through peak centers'
    self.marksSchemePulldown = PulldownList(guiParent, callback=self.setMarksColor,
                                            grid=(row,3), tipText=tipText)

    row += 1
    label = Label(guiParent, text='(Non-peak marks only)', grid=(row,2), gridSpan=(1,2))
 
    row += 1
    div = LabelDivider(guiParent, text='1-dimensional Rulers',
                       grid=(row,0), gridSpan=(1,5))
    
    row += 1
    label = Label(guiParent, text='Maximum rulers: ', grid=(row,0))
 
    values = range(1, self.maxAllowedRulers+1)
    entries = [ str(x) for x in  values]
    value = analysisProject.maxRulers
    tipText = 'Sets the maximum number of 1-dimensional ruler lines that the user can add to spectrum window displays'
    self.rulers_menu = PulldownList(guiParent, callback=self.setMaxRulers, grid=(row,1),
                                    texts=entries, objects=values, index=value-1, tipText=tipText)
 
    label = Label(guiParent, text=' Ruler colour: ', grid=(row,2))
 
    tipText = 'Sets the line colour of the 1-dimensional ruler lines'
    self.rulersSchemePulldown = PulldownList(guiParent, callback=self.setRulersColor,
                                             grid=(row,3), tipText=tipText)

    self.updateSchemePulldowns()
    def body(self, guiFrame):
        '''Describes where all the GUI element are.'''

        self.geometry('400x500')
        guiFrame.expandGrid(0, 0)
        tableFrame = Frame(guiFrame)
        tableFrame.grid(
            row=0,
            column=0,
            sticky='nsew',
        )
        tableFrame.expandGrid(0, 0)
        buttonFrame = Frame(guiFrame)
        buttonFrame.grid(
            row=1,
            column=0,
            sticky='nsew',
        )
        headingList = ['Spinsystem Number', 'Assignment', 'Residue Type Probs']
        self.table = ScrolledMatrix(tableFrame,
                                    headingList=headingList,
                                    callback=self.updateSpinSystemSelection,
                                    multiSelect=True)
        self.table.grid(row=0, column=0, sticky='nsew')
        texts = ['Add Prob']
        commands = [self.addProb]
        self.AddProbButton = ButtonList(buttonFrame,
                                        commands=commands,
                                        texts=texts)
        self.AddProbButton.grid(row=0, column=0, sticky='nsew')
        texts = ['Remove Prob']
        commands = [self.removeProb]
        self.AddProbButton = ButtonList(buttonFrame,
                                        commands=commands,
                                        texts=texts)
        self.AddProbButton.grid(row=0, column=2, sticky='nsew')
        selectCcpCodes = sorted(self.chemCompDict.keys())
        tipText = 'select ccpCode'
        self.selectCcpCodePulldown = PulldownList(buttonFrame,
                                                  texts=selectCcpCodes,
                                                  grid=(0, 1),
                                                  tipText=tipText)

        selectCcpCodes = ['All Residue Types']

        tipText = 'select ccpCode'
        self.selectCcpCodeRemovePulldown = PulldownList(buttonFrame,
                                                        texts=selectCcpCodes,
                                                        index=0,
                                                        grid=(0, 3),
                                                        tipText=tipText)
        self.updateTable()
示例#3
0
    def body(self, guiFrame):

        guiFrame.grid_rowconfigure(0, weight=1)
        guiFrame.grid_columnconfigure(1, weight=1)

        row = 0
        if self.message:
            label = Label(guiFrame,
                          text=self.message,
                          gridSpan=(1, 2),
                          grid=(row, 0))
            row += 1

        if self.label:
            label = Label(guiFrame, text=self.label, grid=(row, 0))

        self.itemMenu = PulldownList(guiFrame,
                                     texts=self.entries,
                                     objects=self.entries,
                                     index=self.default,
                                     grid=(row, 1))

        row += 1
        texts = [self.select_text, 'Cancel']
        commands = [self.ok, self.cancel]
        buttons = ButtonList(guiFrame,
                             texts=texts,
                             commands=commands,
                             gridSpan=(1, 2),
                             grid=(row, 0))
示例#4
0
  def body(self, master):
    
    #
    # Popup window
    #

    row = 0
    
    if self.topText:
      label = Label(master, text= self.topText)
      label.grid(row=row, column=0, columnspan = 2, sticky=Tkinter.EW)
    
      row = row + 1

    label = Label(master, text= self.text)
    label.grid(row=row, column=0, sticky=Tkinter.EW)

    self.menu = PulldownList(master, texts = self.selectionList, index = self.selectedIndex)
    self.menu.grid(row=row, column=1, sticky=Tkinter.E, ipadx = 20)
 
    row = row + 1
    texts = [ 'OK' ]
    commands = [ self.ok ]   # This calls 'ok' in BasePopup, this then calls 'apply' in here
    
    if self.dismissButton:
      buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text = self.dismissText, help_url=self.help_url)
    else:
      buttons = createHelpButtonList(master, texts=texts, commands=commands, help_url=self.help_url)

    buttons.grid(row=row, column=0, columnspan = 3)
示例#5
0
    def body(self, master):

        self.geometry('600x130')
        master.grid_columnconfigure(1, weight=1)
        for n in range(5):
            master.grid_rowconfigure(n, weight=1)

        row = 0
        label = Label(master, text='Spectrum: ')
        label.grid(row=row, column=0, sticky='e')
        tipText = 'The spectrum for which the contour file is being added'
        self.expt_spectrum = PulldownList(master,
                                          callback=self.updateContourDir,
                                          tipText=tipText)
        self.expt_spectrum.grid(row=row, column=1, sticky='w')

        row = row + 1
        tipText = 'The location of the directory where contour files are stored on disk'
        label = Label(master, text='Contour dir: ')
        label.grid(row=row, column=0, sticky='e')
        self.dir_label = Label(master, text='', tipText=tipText)
        self.dir_label.grid(row=row, column=1, sticky='w')

        row = row + 1
        label = Label(
            master,
            text=
            '(file will be copied into Contour dir if it is not already in there)'
        )
        label.grid(row=row, column=1, sticky='w')

        row = row + 1
        tipText = 'Browse for a file store contour data'
        button = Button(master,
                        text='File name: ',
                        command=self.selectFile,
                        tipText=tipText)
        button.grid(row=row, column=0, sticky='e')
        tipText = 'Enter the name of the file to store contour data'
        self.file_entry = Entry(master, tipText=tipText)
        self.file_entry.grid(row=row, column=1, sticky='ew')

        row = row + 1
        texts = ['Add File']
        commands = [self.addFile]
        tipTexts = [
            'Use the selected contour file in the current project, copying it to the contour directory if required',
        ]
        self.buttons = UtilityButtonList(master,
                                         texts=texts,
                                         doClone=False,
                                         tipTexts=tipTexts,
                                         commands=commands,
                                         helpUrl=self.help_url)
        self.buttons.grid(row=row, column=0, columnspan=2, sticky='ew')

        self.curateNotifiers(self.registerNotify)
        self.updateSpectrum()
    def body(self):
        '''Sets up the body of this view.'''

        frame = self.frame
        frame.grid_rowconfigure(2, weight=1)
        frame.grid_columnconfigure(0, weight=1)

        headingList = [
            '#', 'Spectrum', 'Peak List', 'use?', 'labelling scheme'
        ]

        tipTexts = [
            'Row number', 'spectrum name', 'which peak list to use',
            'use this spectrum?',
            'Which labelling scheme belongs to this spectrum?'
        ]

        self.autoLabellingPulldown = PulldownList(self.guiParent,
                                                  self.setAutoLabellingScheme)
        self.autoPeakListPulldown = PulldownList(self.guiParent,
                                                 self.setAutoPeakList)

        editWidgets = [
            None, None, self.autoPeakListPulldown, None,
            self.autoLabellingPulldown
        ]

        editGetCallbacks = [
            None, None, self.getAutoPeakLists, self.changeUse,
            self.getAutoLabellingSchemes
        ]

        editSetCallbacks = [None, None, None, None, None]

        self.displayTable = ScrolledMatrix(frame,
                                           headingList=headingList,
                                           callback=self.selectAutoSpec,
                                           editWidgets=editWidgets,
                                           multiSelect=False,
                                           editGetCallbacks=editGetCallbacks,
                                           editSetCallbacks=editSetCallbacks,
                                           tipTexts=tipTexts)
        self.displayTable.grid(row=2, column=0, sticky='nsew')
示例#7
0
    def __init__(self, guiParent, dataText, dataObjects, dataValues, helpText,
                 selectionText, **kw):

        Frame.__init__(self, guiParent, **kw)

        label = Label(self, text=dataText + ':', grid=(0, 0))
        self.selectionList = PulldownList(self,
                                          objects=dataObjects,
                                          texts=dataValues,
                                          grid=(0, 1))
        label = Label(self, text=helpText, grid=(1, 0), gridSpan=(1, 2))
        label = Label(self, text=selectionText + ':', grid=(2, 0))
        self.selectionEntry = Entry(self, grid=(2, 1))
示例#8
0
  def body(self, master):

    row = 0
    label = Label(master, text='Axis type: ', grid=(row, 0))
    tipText = 'Selects what type of measurement is displayed along the window axis'
    self.type_list = PulldownList(master, tipText=tipText, grid=(row, 1))

    row += 1
    tipTexts = ['Make an axis of the selected type in the window & close this popup']
    texts = [ 'Create' ]
    commands = [ self.ok ]
    buttons = UtilityButtonList(master, texts=texts, doClone=False, grid=(row, 0),
                                commands=commands, helpUrl=self.help_url,
                                gridSpan=(1,2), tipTexts=tipTexts)

    self.administerNotifiers(self.registerNotify)
    self.update()
示例#9
0
  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)
示例#10
0
    def body(self, master):

        master.grid_columnconfigure(1, weight=1)

        row = 0
        label = Label(master, text='Panel name: ', grid=(row, 0))
        tipText = 'Short text name for the new axis panel, e.g. "N2"'
        self.name_entry = Entry(master,
                                width=15,
                                grid=(row, 1),
                                tipText=tipText)

        row += 1
        label = Label(master, text='Axis type:', grid=(row, 0))
        tipText = 'The type of axis (isotope, time, sampled etc.) represented by panel type'
        self.types_list = PulldownList(master, grid=(row, 1), tipText=tipText)

        row += 1
        tipTexts = [
            'Create a new panel type object with the selected options & close the popup'
        ]
        texts = ['Create']
        commands = [self.ok]
        buttons = UtilityButtonList(master,
                                    texts=texts,
                                    commands=commands,
                                    doClone=False,
                                    closeText='Cancel',
                                    helpUrl=self.help_url,
                                    grid=(row, 0),
                                    gridSpan=(1, 2),
                                    tipTexts=tipTexts)

        master.grid_rowconfigure(row, weight=1)

        self.administerNotifiers(self.registerNotify)
        self.update()
示例#11
0
  def body(self, guiFrame):

    self.geometry('600x350')

    project = self.project
    analysisProject = self.analysisProject

    guiFrame.grid_columnconfigure(1, weight=1)

    row = 0
    frame = Frame(guiFrame, grid=(0,0))
    label = Label(frame, text=' Window:', grid=(0,0))
    self.windowPulldown = PulldownList(frame, grid=(0,1),
                                      tipText='The window that will be printed out',
                                      callback=self.selectWindow)
                                      
    tipTexts = ['For the window pulldown, show all of the spectrum windows in the current project, irrespective of the active group',
                'For the window pulldown, show only spectrum windows that are in the currently active window group']
    self.whichWindows = RadioButtons(frame, grid=(0,2),
                                     entries=ACTIVE_OPTIONS, tipTexts=tipTexts,
                                     select_callback=self.updateWindows)
    
    texts = [ 'Save Print File' ]
    tipTexts = [ 'Save the printout to the specified file' ]
    commands = [ self.saveFile ]
    buttons = UtilityButtonList(guiFrame, helpUrl=self.help_url, grid=(row,2),
                                commands=commands, texts=texts, tipTexts=tipTexts)
    self.buttons = buttons
    buttons.buttons[0].config(bg='#B0FFB0')
    
    row += 1
    guiFrame.grid_rowconfigure(row, weight=1)
    options = ['Options', 'Spectra', 'Peak Lists', 'Region']
    tipTexts = ['Optional settings for spectra', 'Optional settings for peak lists', 'Optional settings for the region']
    tabbedFrame = TabbedFrame(guiFrame, options=options, tipTexts=tipTexts)
    tabbedFrame.grid(row=row, column=0, columnspan=3, sticky='nsew')
    self.tabbedFrame = tabbedFrame

    optionFrame, spectrumFrame, peakListFrame, regionFrame = tabbedFrame.frames

    optionFrame.expandGrid(0, 0)
    getOption = lambda key, defaultValue: PrintBasic.getPrintOption(analysisProject, key, defaultValue)
    setOption = lambda key, value: PrintBasic.setPrintOption(analysisProject, key, value)
    self.printFrame = PrintFrame(optionFrame, getOption=getOption,
                                 grid=(0,0), gridSpan=(1,1),
                                 setOption=setOption, haveTicks=True,
                                 doOutlineBox=False)

    spectrumFrame.expandGrid(0, 0)
    frame = Frame(spectrumFrame, grid=(0,0), gridSpan=(1,1))
    frame.expandGrid(1,0)

    self.overrideSpectrum = CheckButton(frame,
       text='Use below settings when printing',
       tipText='Use below settings when printing instead of the window values',
       grid=(0,0), sticky='w')

    tipText = 'Change the settings of the selected spectra back to their window values'
    button = Button(frame, text='Reset Selected', tipText=tipText,
                    command=self.resetSelected, grid=(0,1), sticky='e')

    self.posColorPulldown = PulldownList(self, callback=self.setPosColor)
    self.negColorPulldown = PulldownList(self, callback=self.setNegColor)
    headings = ['Spectrum', 'Pos. Contours\nDrawn', 'Neg. Contours\nDrawn', 'Positive\nColours', 'Negative\nColours']
    tipTexts = ['Spectrum in window', 'Whether the positive contours should be drawn', 'Whether the negative contours should be drawn',
      'Colour scheme for positive contours (can be a single colour)', 'Colour scheme for negative contours (can be a single colour)']

    editWidgets      = [ None, None, None, self.posColorPulldown, self.negColorPulldown]
    editGetCallbacks = [ None, self.togglePos, self.toggleNeg, self.getPosColor, self.getNegColor]
    editSetCallbacks = [ None, None, None, self.setPosColor, self.setNegColor]
    self.spectrumTable = ScrolledMatrix(frame, headingList=headings,
                                        tipTexts=tipTexts,
                                        multiSelect=True,
                                        editWidgets=editWidgets,
                                        editGetCallbacks=editGetCallbacks,
                                        editSetCallbacks=editSetCallbacks,
                                        grid=(1,0), gridSpan=(1,2))

    peakListFrame.expandGrid(0, 0)
    frame = Frame(peakListFrame, grid=(0,0), gridSpan=(1,3))
    frame.expandGrid(1,0)

    self.overridePeakList = CheckButton(frame,
       text='Use below settings when printing',
       tipText='Use below settings when printing instead of the window values',
       grid=(0,0))

    tipText = 'Change the settings of the selected peak lists back to their window values'
    button = Button(frame, text='Reset Selected', tipText=tipText,
                    command=self.resetSelected, grid=(0,1), sticky='e')

    colors = Color.standardColors
    self.peakColorPulldown = PulldownList(self, callback=self.setPeakColor,
                                        texts=[c.name for c in colors],
                                        objects=[c.hex for c in colors],
                                        colors=[c.hex for c in colors])
    headings = [ 'Peak List', 'Symbols Drawn', 'Peak Font', 'Peak Colour']
    self.fontMenu = FontList(self, mode='Print', extraTexts=[no_peak_text])
    editWidgets      = [ None, None, self.fontMenu, self.peakColorPulldown]
    editGetCallbacks = [ None, self.togglePeaks, self.getPeakFont, self.getPeakColor ]
    editSetCallbacks = [ None, None, self.setPeakFont, self.setPeakColor ]
    self.peakListTable = ScrolledMatrix(frame, headingList=headings,
                                        multiSelect=True,
                                        editWidgets=editWidgets,
                                        editGetCallbacks=editGetCallbacks,
                                        editSetCallbacks=editSetCallbacks,
                                        grid=(1,0), gridSpan=(1,2))

    regionFrame.expandGrid(0, 0)
    frame = Frame(regionFrame, grid=(0,0), gridSpan=(1,3))
    frame.expandGrid(3,0)
    tipText = 'Use the specified override region when printing rather than the window values'
    self.overrideButton = CheckButton(frame, text='Use override region when printing',
                                      tipText=tipText,
                                      callback=self.toggledOverride, grid=(0,0))

    tipTexts = ('Use min and max to specify override region', 'Use center and width to specify override region')
    self.use_entry = USE_ENTRIES[0]
    self.useButtons = RadioButtons(frame, entries=USE_ENTRIES,
                                      tipTexts=tipTexts,
                                      select_callback=self.changedUseEntry,
                                      grid=(1,0))

    texts = ('Set Region from Window', 'Set Center from Window', 'Set Width from Window')
    tipTexts = ('Set the override region to be the current window region',
                'Set the center of the override region to be the center of the current window region',
                'Set the width of the override region to be the width of the current window region')
    commands = (self.setRegionFromWindow, self.setCenterFromWindow, self.setWidthFromWindow)
    self.setRegionButton = ButtonList(frame, texts=texts,
                                      tipTexts=tipTexts,
                                      commands=commands, grid=(2,0))

    self.minRegionWidget = FloatEntry(self, returnCallback=self.setMinRegion, width=10)
    self.maxRegionWidget = FloatEntry(self, returnCallback=self.setMaxRegion, width=10)
    headings = MIN_MAX_HEADINGS
    editWidgets      = [ None, None, self.minRegionWidget, self.maxRegionWidget ]
    editGetCallbacks = [ None, None, self.getMinRegion,    self.getMaxRegion ]
    editSetCallbacks = [ None, None, self.setMinRegion,    self.setMaxRegion ]
    self.regionTable = RegionScrolledMatrix(frame, headingList=headings,
                                            editWidgets=editWidgets,
                                            editGetCallbacks=editGetCallbacks,
                                            editSetCallbacks=editSetCallbacks,
                                            grid=(3,0))

    self.updateWindows()
    self.updateAfter()
    
    self.administerNotifiers(self.registerNotify)
示例#12
0
    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):
        '''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)
示例#14
0
  def body(self, master):

    self.geometry('650x200')

    master.grid_columnconfigure(1, weight=1)

    row = 0
    frame = Frame(master, grid=(row, 0), gridSpan=(1,2))
    
    label = Label(frame, text='Spectrum: ', grid=(row, 0))
    tipText = 'Selects the experiment and spectrum for which to make a contour file'
    self.expt_spectrum = PulldownList(frame, grid=(row, 1),
                                      tipText=tipText, callback=self.update)

    label = Label(frame, text=' (X-dim, Y-dim): ', grid=(row, 2))
    tipText = 'Selects which dimensions (projection) of the spectrum form the X and Y axes of the contour file'
    self.dim_menu = PulldownList(frame, grid=(row, 3), tipText=tipText,
                                 callback=self.updateFile)

    row = row + 1
    master.grid_rowconfigure(row, weight=1)
    #### for now not editable because only allow one include region
    ###self.conditionMenu = PulldownMenu(self, entries=('include', 'exclude'),
    ###                       callback=self.selectedCondition, do_initial_callback=False)
    self.regionEntry = FloatEntry(self, text='', returnCallback=self.setRegion, width=10)
    tipTexts = ['Whether to include or exclude the region in the contour file',
                '',
                '',
                '']
    headingList = ['Condition','','','','']
    editSetCallbacks = [None]
    editGetCallbacks = [None]
    ###editWidgets = [self.conditionMenu]
    editWidgets = [None]
    self.conditionTable = ScrolledMatrix(master, initialRows=6,
                                         grid=(row, 0), gridSpan=(1,2),
                                         tipTexts=tipTexts,
                                         headingList=headingList,
                                         callback=self.selectCell,
                                         editWidgets=editWidgets,
                                         editGetCallbacks=editGetCallbacks,
                                         editSetCallbacks=editSetCallbacks)

    # TBD: make directory editable
    row = row + 1
    label = Label(master, text='Contour dir: ', grid=(row, 0), sticky='e')
    tipText = 'The directory location on disk into which contour files are saved'
    self.dir_label = Label(master, text='', grid=(row, 1), tipText=tipText)

    row = row + 1
    label = Label(master, text='File name: ', grid=(row, 0), sticky='e')
    tipText = 'Sets the name of the contour file to save to disk'
    self.file_entry = Entry(master, grid=(row, 1), tipText=tipText)

    ##row = row + 1
    ##label = Label(master, text='Contour levels: ')
    ##label.grid(row=row, column=0, sticky='e')
    ##self.levels_entry = FloatEntry(master, isArray=True, returnCallback=self.saveLevels)
    ##self.levels_entry.grid(row=row, column=1, sticky='ew')

    row = row + 1
    tipTexts = ['Add a new contour region for including in or excluding from the contour file ',
                'Remove the selected contour region from the table',
                'Make the specified contour file using the input settings & regions']
    texts = [ 'Add Condition', 'Delete Condition', 'Contour and Save' ]
    commands = [ self.addCondition, self.deleteCondition, self.contourAndSaveSpectrum ]
    self.buttons = UtilityButtonList(master, texts=texts, commands=commands,
                                     doClone=False, helpUrl=self.help_url,
                                     grid=(row, 0), gridSpan=(1,2), tipTexts=tipTexts)

    ### TBD disabled for now
    for n in range(2):
      self.buttons.buttons[n].config(state='disabled')

    self.curateNotifiers(self.registerNotify)
    self.updateSpectrum()
    self.updateDimMenu()
示例#15
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()
示例#16
0
    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()
示例#17
0
    def body(self, guiFrame):

        guiFrame.grid_columnconfigure(0, weight=1)

        row = 0

        frame = Frame(guiFrame, grid=(row, 0), sticky='ew')
        frame.grid_columnconfigure(6, weight=1)

        label = Label(frame, text='MolSystem:', grid=(0, 0))
        tipText = 'Selects which molecular system to select a structure for'
        self.molSystemPulldown = PulldownList(frame,
                                              callback=self.setMolSystem,
                                              grid=(0, 1),
                                              tipText=tipText)

        label = Label(frame, text=' Ensemble:', grid=(0, 2))
        tipText = 'Selects which structure ensemble to display, for the specified molecular system'
        self.structurePulldown = PulldownList(frame,
                                              callback=self.setStructure,
                                              grid=(0, 3),
                                              tipText=tipText)

        label = Label(frame, text=' Model:', grid=(0, 4))
        tipText = 'Selects which conformational model of the selected structure/ensemble to display'
        self.modelPulldown = PulldownList(frame,
                                          callback=self.setModel,
                                          grid=(0, 5),
                                          tipText=tipText)

        label = Label(frame, text='Peak List:', grid=(0, 7), sticky='e')
        tipText = 'When using the "Show Peak" option, sets which peak list is used to display atom connectivities'
        self.peakListPulldown = PulldownList(frame,
                                             callback=self.setPeakList,
                                             grid=(0, 8),
                                             sticky='e',
                                             tipText=tipText)

        label = Label(frame, text=' Dist Method:', grid=(0, 9), sticky='e')
        tipText = 'Where the distances between sets of atoms are displayed, sets whether to use the NOE equivalent (sum r^-6 intensities) or minimum distance'
        self.distMethodPulldown = PulldownList(frame,
                                               callback=self.setDistMethod,
                                               texts=distanceMethods.keys(),
                                               grid=(0, 10),
                                               sticky='e',
                                               tipText=tipText)

        row += 1
        guiFrame.grid_rowconfigure(row, weight=1)

        analysisProject = self.analysisProject
        getOption = lambda key, defaultValue: getPrintOption(
            analysisProject, key, defaultValue)
        setOption = lambda key, value: setPrintOption(analysisProject, key,
                                                      value)
        self.structFrame = ViewStructureFrame(guiFrame,
                                              project=self.project,
                                              radiiScale=0.0,
                                              bondWidth=1,
                                              atomCallback=self.selectAtom,
                                              getPrintOption=getOption,
                                              setPrintOption=setOption,
                                              grid=(row, 0))

        row += 1

        frame = Frame(guiFrame)
        frame.grid(row=row, column=0, sticky='ew')
        frame.grid_columnconfigure(2, weight=1)

        tipTexts = [
            'Remove all highlights and connections from the structure display',
            'For an ensemble, calculate the per-atom coordinate root mean square deviations and adjust atom size and colours accordingly',
            'Display the selected structural parameters on the structure, adjusting atom labels, size and colours accordingly'
        ]
        texts = [
            'Reset',
            'RMSDs',
            'Display Params:',
        ]
        commands = [
            self.clearConnections,
            self.displayAtomRmsds,
            self.displayStrucParams,
        ]

        self.paramButtons = ButtonList(frame,
                                       texts=texts,
                                       commands=commands,
                                       grid=(0, 0),
                                       tipTexts=tipTexts)

        tipText = 'Selects which structural parameters, from those calculated, to display on the structure'
        self.strucParamPulldown = PulldownList(frame,
                                               grid=(0, 1),
                                               tipText=tipText)

        tipTexts = [
            'In the stated peak list, display peak assignment connectivities between the highlighted atoms (left click to select atoms in the display)',
        ]
        texts = ['Show Peaks']
        commands = [
            self.showPeaks,
        ]
        self.bottomButtons = UtilityButtonList(frame,
                                               texts=texts,
                                               commands=commands,
                                               helpUrl=self.help_url,
                                               grid=(0, 3),
                                               tipTexts=tipTexts)

        self.updateMolSystems()
        self.updatePeakLists()
        self.administerNotifiers(self.registerNotify)
示例#18
0
  def body(self, guiFrame):

    self.geometry('700x700')

    self.update_idletasks()

    guiFrame.grid_columnconfigure(0, weight=1)
 
    row = 0
    
    frame = Frame(guiFrame, relief='raised', bd=1, grid=(row,0), sticky='ew')
    frame.grid_columnconfigure(8, weight=1)
    
    label = Label(frame, text='MolSystem:', grid=(0,0))
    tipText = 'Selects which molecular system to display data for; from which a structure is selected'
    self.molSystemPulldown = PulldownList(frame, callback=self.setMolSystem,
                                          grid=(0,1), tipText=tipText)
    
    label = Label(frame, text=' Structure:', grid=(0,2))
    tipText = 'Selects which structure ensemble to display phi/psi backbone angle data for'
    self.structurePulldown = PulldownList(frame, callback=self.setStructure,
                                          grid=(0,3), tipText=tipText)
    
    label = Label(frame, text='    Model:', grid=(0,4))
    tipText = 'Selects which conformational model(s), from the structure ensemble, to display data for'
    self.modelPulldown = PulldownList(frame, callback=self.setModel,
                                      grid=(0,5), tipText=tipText)
        

    label = Label(frame, text=' Labels:', grid=(0,6))
    tipText = 'Sets which phi/psi points carry residue labels, e.g. according to whether values are "disallowed" (very uncommon)'
    self.labelPulldown = PulldownList(frame, texts=LABEL_MODES, index=1,
                                      callback=self.updateLabels, grid=(0,7),
                                      sticky='e', tipText=tipText)

    utilButtons = UtilityButtonList(frame, helpUrl=self.help_url, grid=(0,9))

    
    label = Label(frame, text='Ccp Code:', grid=(1,0))
    tipText = 'Allows the phi/psi points to be restricted to only those from a particular residue type'
    self.ccpCodePulldown = PulldownList(frame, callback=self.setCcpCode,
                                        grid=(1,1), tipText=tipText)
    
    label = Label(frame, text=' Residue:', grid=(1,2))
    tipText = 'Allows the display of phi/psi points from only a single residue'
    self.residuePulldown = PulldownList(frame, callback=self.setResidue,
                                        grid=(1,3), tipText=tipText)
    
    label = Label(frame, text=' Spot Size:', grid=(1,4))
    sizes = [1,2,3,4,5,6,7,8,9,10]
    texts = [str(s) for s in sizes]
    tipText = 'Sets how large to display the circles that indicate the phi/psi points'
    self.spotSizePulldown = PulldownList(frame, texts=texts, objects=sizes,
                                         callback=self.updateAfter, index=1,
                                         grid=(1,5), tipText=tipText)
       
    label = Label(frame, text=' Colours:', grid=(1,6)) 
    tipText = 'Selects which colour scheme to use to distinguish phi/psi points from different conformational models'
    self.schemePulldown = PulldownList(frame, callback=self.selectColorScheme,
                                       grid=(1,7), tipText=tipText)
 
    row +=1
    tipText = 'The percentage of residues found in the different regions of the Ramachandran plot, according to PROCHECK cetegories' 
    self.regionLabel = Label(guiFrame, text=REGION_TEXT % (0.0,0.0,0.0),
                             grid=(row, 0), tipText=tipText)

    row +=1
    self.colorRow = row
    self.colorFrame = Frame(guiFrame, sticky='ew')
    self.colorFrame.grid_columnconfigure(0, weight=1)
    self.colorLabels = []

    tipText = 'The colors of the ensembles in the plot'
    label = Label(self.colorFrame, text='Colors: ', grid=(0,0), sticky='w', tipText=tipText)

    row +=1

    guiFrame.grid_rowconfigure(row, weight=1)
    self.plot = ViewRamachandranFrame(guiFrame, relief='sunken',
                                      bgColor=self.cget('bg'))
    self.plot.grid(row=row, column=0, sticky='nsew')

    row +=1
    tipTexts = ['Show phi/spi spots for the previous residue in the sequence; when there is no current residue, starts fron the first in sequence there is data for',
                'Show phi/spi spots for the next residue in the sequence; when there is no current residue, starts fron the first in sequence there is data for']
    texts    = ['Previous Residue','Next Residue']
    commands = [self.prevResidue,self.nextResidue]
    self.bottomButtons = ButtonList(guiFrame, commands=commands,
                                    texts=texts, grid=(row,0),
                                    tipTexts=tipTexts)

    self.updateColorSchemes()
    self.updateMolSystems()
    self.updateAfter()
    
    self.administerNotifiers(self.registerNotify)
示例#19
0
    def body(self, guiParent):

        self.geometry("+150+150")

        guiParent.grid_columnconfigure(0, weight=1)
        self.master_frame = guiParent

        units = ('ppm', 'point', 'Hz')

        self.unit = 'ppm'

        self.specLabel = Label(guiParent,
                               fg=self.titleColor,
                               grid=(0, 0),
                               sticky='ew')

        self.peakLabel = Label(guiParent, grid=(0, 1), sticky='ew')

        self.unit_frame = frame = Frame(guiParent,
                                        grid=(1, 1),
                                        gridSpan=(1, 2))

        self.unitLabel = Label(frame, text='Current units: ', grid=(0, 0))
        tipText = 'Selects which unit of measurement to display peak dimension positions with'
        self.unitSelect = PulldownList(frame,
                                       callback=self.changeUnit,
                                       texts=units,
                                       grid=(0, 1),
                                       tipText=tipText)

        self.heightLabel = Label(guiParent,
                                 text='Height',
                                 borderwidth=2,
                                 relief='groove')
        tipText = 'Sets the peak height; the value of the spectrum point intensity (albeit often interpolated)'
        self.heightEntry = FloatEntry(guiParent,
                                      borderwidth=1,
                                      tipText=tipText)
        self.volumeLabel = Label(guiParent,
                                 text='Volume',
                                 borderwidth=2,
                                 relief='groove')
        tipText = 'Sets the peak volume integral; normally a summation of data point values'
        self.volumeEntry = FloatEntry(guiParent,
                                      borderwidth=1,
                                      tipText=tipText)
        self.detailLabel = Label(guiParent,
                                 text='Details',
                                 borderwidth=2,
                                 relief='groove')
        tipText = 'A user-configurable textual comment for the peak, which appears an tables and occasionally on spectrum displays'
        self.detailEntry = Entry(guiParent, borderwidth=1, tipText=tipText)

        tipTexts = [
            'Commits the specified values to update the peak and closes the popup',
        ]
        texts = ['Update']
        commands = [self.commit]
        self.buttons = UtilityButtonList(guiParent,
                                         texts=texts,
                                         commands=commands,
                                         doClone=False,
                                         helpUrl=self.help_url,
                                         tipTexts=tipTexts)
示例#20
0
    def body(self, guiFrame):

        self.geometry('450x500')

        guiFrame.grid_rowconfigure(0, weight=1)
        guiFrame.grid_columnconfigure(0, weight=1)

        options = ['Peak Separator', 'Advanced Settings']

        tabbedFrame = TabbedFrame(guiFrame, options=options)
        tabbedFrame.grid(row=0, column=0, sticky='nsew')

        buttons = UtilityButtonList(tabbedFrame.sideFrame,
                                    helpUrl=self.help_url)
        buttons.grid(row=0, column=0, sticky='e')

        self.tabbedFrame = tabbedFrame
        frameA, frameB = tabbedFrame.frames

        #
        # FrameA : Main Settings
        #

        frameA.grid_columnconfigure(1, weight=1)
        row = 0  # Label row

        row += 1
        div = LabelDivider(frameA, text='Peak Separator Parameters')
        div.grid(row=row, column=0, columnspan=2, sticky='ew')

        row += 1
        label = Label(frameA, text='Min. number of peaks:')
        label.grid(row=row, column=0, sticky='w')
        self.minPeaksEntry = IntEntry(frameA, returnCallback=self.applyChange, width=10, \
              tipText='Minimum number of peaks to find (must be > 0)')
        self.minPeaksEntry.grid(row=row, column=1, sticky='n')
        self.minPeaksEntry.bind('<Leave>', self.applyChange, '+')

        row += 1
        label = Label(frameA, text='Max. number of peaks:')
        label.grid(row=row, column=0, sticky='w')
        self.maxPeaksEntry = IntEntry(frameA, returnCallback=self.applyChange, width=10, \
              tipText='Maximum number of peaks to find (0 is unlimited - not recommended)')
        self.maxPeaksEntry.grid(row=row, column=1, sticky='n')
        self.maxPeaksEntry.bind('<Leave>', self.applyChange, '+')

        row += 1
        label = Label(frameA, text='Only pick positive peaks:')
        label.grid(row=row, column=0, sticky='w')
        entries = ['False', 'True']
        self.posPeaksButtons = RadioButtons(
            frameA,
            entries=entries,
            select_callback=self.applyChange,
            direction='horizontal',
            tipTexts=[
                'Search for both positive and negative intensity peaks',
                'Limit search to only positive peaks'
            ])
        self.posPeaksButtons.grid(row=row, column=1, sticky='n')

        row += 1
        label = Label(frameA, text='Peak Model:')
        label.grid(row=row, column=0, sticky='w')
        ### G/L Mixture works, but volume calculation involves Gamma function
        # entries = ['Gaussian', 'Lorentzian', 'G/L Mixture']
        entries = ['Gaussian', 'Lorentzian']
        self.shapeButtons = RadioButtons(
            frameA,
            entries=entries,
            select_callback=self.applyChange,
            direction='horizontal',
            tipTexts=[
                'Choose a Gaussian model peak shape to fit to peaks',
                'Choose a Lorentzian model peak shape to fit to peaks'
            ])
        self.shapeButtons.grid(row=row, column=1, sticky='n')

        row += 1
        div = LabelDivider(frameA,
                           text='Region',
                           tipText='Region that search will limit itself to')
        div.grid(row=row, column=0, columnspan=2, sticky='ew')

        row += 1
        label = Label(frameA, text='Peak List:')
        label.grid(row=row, column=0, sticky='nw')
        self.peakListPulldown = PulldownList(
            frameA,
            callback=self.setManuallyPickPeakList,
            tipText='Select which peak list new peaks are to be added to')
        self.peakListPulldown.grid(row=row, column=1, sticky='nw')

        # tricky scrolled matrix
        row += 1
        self.regionTable = None
        frameA.grid_rowconfigure(row, weight=1)
        headings = ('dim.', 'start (ppm)', 'end (ppm)', 'actual size')

        self.editDimEntry = IntEntry(self,
                                     returnCallback=self.applyChange,
                                     width=5,
                                     tipText='Dimension number')
        self.editStartEntry = FloatEntry(self,
                                         returnCallback=self.applyChange,
                                         width=5,
                                         tipText='Search area lower bound')
        self.editEndEntry = FloatEntry(self,
                                       returnCallback=self.applyChange,
                                       width=5,
                                       tipText='Search area upper bound')

        editWidgets = [
            self.editDimEntry, self.editStartEntry, self.editEndEntry, None
        ]

        editGetCallbacks = [None, None, None, None]
        editSetCallbacks = [None, None, None, None]

        self.regionTable = ScrolledMatrix(frameA,
                                          headingList=headings,
                                          multiSelect=False,
                                          editWidgets=editWidgets,
                                          editGetCallbacks=editGetCallbacks,
                                          editSetCallbacks=editSetCallbacks,
                                          initialRows=5)

        self.regionTable.grid(row=row, column=0, columnspan=2, sticky='nsew')

        # Run Button
        row += 1
        texts = ['Add Region']
        commands = [self.updateFromRegion]
        self.addResetButtons = ButtonList(
            frameA,
            texts=texts,
            commands=commands,
            tipTexts=['Add selected specrtral region'])
        self.addResetButtons.grid(row=row, column=0, columnspan=2, sticky='ew')

        row += 1
        texts = ['Separate Peaks']
        commands = [self.runPeakSeparator]
        self.runButton = ButtonList(frameA,
                                    texts=texts,
                                    commands=commands,
                                    expands=True,
                                    tipTexts=['Run peak search now'])
        self.runButton.grid(row=row, column=0, columnspan=2, sticky='nsew')

        #
        # FrameB : Further Settings
        #

        frameB.grid_columnconfigure(0, weight=1)

        row = 0

        div = LabelDivider(frameB, text='Rate:')
        div.grid(row=row, column=0, columnspan=2, sticky='ew')
        row += 1

        label = Label(frameB, text='Rate of MCMC step size change')
        label.grid(row=row, column=0, columnspan=1, sticky='w')

        self.rateEntry = FloatEntry(frameB, returnCallback=self.applyChange, width=10, \
              tipText='Rate effects speed of run, smaller values take longer but may produce better results')
        self.rateEntry.grid(row=row, column=1, sticky='n')
        self.rateEntry.bind('<Leave>', self.applyChange, '+')
        self.rateEntry.set(self.params.rate)

        # tricky scrolled matrix for line width
        row += 2
        div = LabelDivider(frameB, text='Line Width (Hz):')
        div.grid(row=row, column=0, columnspan=2, sticky='ew')

        row += 1
        label = Label(frameB, text="Descr.")
        label.grid(row=row, rowspan=2, column=0, sticky='w')

        row += 1
        self.lineWidthTable = None
        frameB.grid_rowconfigure(row, weight=1)
        lineWidthHeadings = ('dim.', 'min. σ (Hz)', 'max. σ (Hz)')

        self.editMinSigmaEntry = FloatEntry(self,
                                            returnCallback=self.applyChange,
                                            width=5,
                                            tipText='Minimum line width (Hz)')
        self.editMaxSigmaEntry = FloatEntry(self,
                                            returnCallback=self.applyChange,
                                            width=5,
                                            tipText='Maximum line width (Hz)')

        # self.editDimEntry is also from regionTable
        initialWidthRows = 4

        editLineWidthWidgets = [
            None, self.editMinSigmaEntry, self.editMaxSigmaEntry
        ]
        editLineWidthGetCallbacks = [None, self.getSigmaMin, self.getSigmaMax]
        editLineWidthSetCallbacks = [None, self.setSigmaMin, self.setSigmaMax]

        self.lineWidthTable = ScrolledMatrix(
            frameB,
            headingList=lineWidthHeadings,
            multiSelect=False,
            editWidgets=editLineWidthWidgets,
            editGetCallbacks=editLineWidthGetCallbacks,
            editSetCallbacks=editLineWidthSetCallbacks,
            initialRows=initialWidthRows)

        self.lineWidthTable.grid(row=row,
                                 column=0,
                                 columnspan=2,
                                 sticky='nsew')

        # option to 'repick' exisiting peak list
        row += initialWidthRows
        div = LabelDivider(frameB, text='(optional - repick entire peak list)')
        div.grid(row=row, column=0, columnspan=2, sticky='ew')
        row += 1

        self.repickListPulldown = PulldownList(
            frameB,
            callback=self.setRePickPeakList,
            tipText=
            'Select which peak list to repick (new peaks will be put into a new peak list)'
        )
        self.repickListPulldown.grid(row=row, column=0, sticky='nw')

        texts = ['Repick Peak List']
        commands = [self.runRepickPeaks]
        self.runButton = ButtonList(
            frameB,
            texts=texts,
            commands=commands,
            expands=True,
            tipTexts=['Repick selected peak list into a new peak list.'])
        self.runButton.grid(row=row, column=1, columnspan=1, sticky='nsew')

        row += 1
        div = LabelDivider(frameB)
        row += 1
        texts = ['Separate Peaks']
        commands = [self.runPeakSeparator]
        self.runButton = ButtonList(frameB,
                                    texts=texts,
                                    commands=commands,
                                    expands=True,
                                    tipTexts=['Run peak search now'])
        self.runButton.grid(row=row, column=0, columnspan=2, sticky='nsew')

        self.setWidgetEntries()

        self.administerNotifiers(self.registerNotify)
示例#21
0
  def __init__(self, guiParent, ccpnProject=None, **kw):

    self.guiParent = guiParent
    self.project = ccpnProject
    self.spectrum = None
    self.peakMode = 0
    
    if ccpnProject:
      self.nmrProject = ccpnProject.currentNmrProject
    else:
      self.nmrProject = None
    
    Frame.__init__(self, guiParent, **kw)
  
    self.expandGrid(0,0)

    options = ['Peak Picking',] #,'About Auremol' 'NOE assignment','Homology Modelling',]
    self.tabbedFrame = TabbedFrame(self, options=options)
    self.tabbedFrame.grid(row=0,column=0,sticky='nsew')
    frameA = self.tabbedFrame.frames[0]
    
    #frameC.grid_columnconfigure(0, weight=1)
    #frameC.grid_rowconfigure(0, weight=1)
    #frameD.grid_columnconfigure(0, weight=1)
    #frameD.grid_rowconfigure(0, weight=1)
    
    #
    # Frame A
    #
    frameA.expandGrid(2,0)
    frameA.expandGrid(3,0)
    frameA.expandGrid(4,0)
    frameA.expandGrid(5,0)
    
    
    frame = Frame(frameA, grid=(0,0))
    frame.expandGrid(0,4)
    
    label = Label(frame, text='Spectrum:', grid=(0,0))
    self.spectrumPulldown = PulldownList(frame, self.changeSpectrum, grid=(0,1))
    
    label = Label(frame, text='  Use Peak Sign:', grid=(0,2))
    self.peakModePulldown = PulldownList(frame, self.changePeakMode, texts=PEAK_MODES,
                                         objects=[0,1,2], grid=(0,3))
    
    
    frame = Frame(frameA, grid=(1,0))
    frame.expandGrid(0,4)
    
    label = Label(frame, text='Integration Depth (Relative to max):', grid=(1,0))
    self.segLevelEntry = FloatEntry(frame, text=0.1, grid=(1,1), width=8)
    
    label = Label(frame, text='Threshold (Threshold only):', grid=(1,3))
    self.thresholdEntry = IntEntry(frame, text=100000, grid=(1,4), width=8)
    
    label = Label(frame, text='Keep Peaks (Adaptive only):', grid=(1,5))
    self.keepPeakEntry = IntEntry(frame, text=4000, grid=(1,6), width=8)
    
    texts = ['Threshold\nPeak Pick','Adaptive\nPeak Pick']
    commands = [self.pickThreshold, self.pickAdaptive]
    self.buttons = ButtonList(frameA, texts=texts, commands=commands,
                              grid=(2,0),  sticky='NSEW')
    
    frame = Frame(frameA, grid=(3,0))
    frame.expandGrid(0,0)
    frame = Frame(frameA, grid=(4,0))
    frame.expandGrid(0,0)
    frame = Frame(frameA, grid=(5,0))
    frame.expandGrid(0,0)
     
    #
    # About
    """
    frameB.expandGrid(4,0)

    label = Label(frameB, text='References', font='Helvetica 12 bold')
    label.grid(row=0, column=0, sticky='w')
    
    text = 
    * Gronwald W, Brunner K, Kirchhofer R, Nasser A, Trenner J, Ganslmeier B,
    Riepl H, Ried A, Scheiber J, Elsner R, Neidig K-P, Kalbitzer HR
    AUREMOL, a New Program for the Automated Structure Elucidation of Biological Macromolecules
    Bruker Reports 2004; 154/155: 11-14

    * Ried A, Gronwald W, Trenner JM, Brunner K, Neidig KP, Kalbitzer HR
    Improved simulation of NOESY spectra by RELAX-JT2 including effects of J-coupling,
    transverse relaxation and chemical shift anisotrophy
    J Biomol NMR. 2004 Oct;30(2):121-31

    * Gronwald W, Moussa S, Elsner R, Jung A, Ganslmeier B, Trenner J, Kremer W, Neidig KP, Kalbitzer HR
    Automated assignment of NOESY NMR spectra using a knowledge based method (KNOWNOE)
    J Biomol NMR. 2002 Aug;23(4):271-87

    * Gronwald W, Kirchhofer R, Gorler A, Kremer W, Ganslmeier B, Neidig KP, Kalbitzer HR
    RFAC, a program for automated NMR R-factor estimation
    J Biomol NMR. 2000 Jun;17(2):137-51
    
    label = Label(frameB, text=text)
    label.grid(row=1, column=0, sticky='w')
    """
   
    #
    # Frame C
    #

    
    #
    # Frame D
    #

  
    self.updateAll()
示例#22
0
  def body(self, guiFrame):

    self.geometry('700x700')
   
    guiFrame.expandGrid(0,0)
    
    options = ['Peak Lists & Settings','Peak Intensity Comparison']
    tabbedFrame = TabbedFrame(guiFrame, options=options, callback=self.changeTab)
    tabbedFrame.grid(row=0, column=0, sticky='nsew')
    self.tabbedFrame = tabbedFrame
    frameA, frameB = tabbedFrame.frames

    row = 0
    frameA.grid_columnconfigure(1, weight=1)
    frameA.grid_columnconfigure(3, weight=1)
    frameA.grid_columnconfigure(5, weight=1)
    frameA.grid_rowconfigure(5, weight=1)

    tipText = 'Number of reference peaks (no saturation)'
    self.peaksALabel = Label(frameA, text='Number of Ref Peaks: ', tipText=tipText)
    self.peaksALabel.grid(row=1,column=0,columnspan=2,sticky='w')

    tipText = 'Number of NOE saturation peaks'
    self.peaksBLabel = Label(frameA, text='Number of Sat Peaks: ', tipText=tipText)
    self.peaksBLabel.grid(row=1,column=2,columnspan=2,sticky='w')

    tipText = 'Number of peaks in assigned list'
    self.peaksCLabel = Label(frameA, text='Number of Assign Peaks: ', tipText=tipText)
    self.peaksCLabel.grid(row=1,column=4,columnspan=2,sticky='w')
    
    tipText = 'Selects which peak list is considered the NOE intensity reference (no saturation)'
    specALabel = Label(frameA, text='Ref Peak List: ')
    specALabel.grid(row=0,column=0,sticky='w')
    self.specAPulldown = PulldownList(frameA, callback=self.setRefPeakList, tipText=tipText)
    self.specAPulldown.grid(row=0,column=1,sticky='w')

    tipText = 'Selects which peak list is considered as NOE saturated.'
    specBLabel = Label(frameA, text='Sat Peak List: ')
    specBLabel.grid(row=0,column=2,sticky='w')
    self.specBPulldown = PulldownList(frameA, callback=self.setSatPeakList, tipText=tipText)
    self.specBPulldown.grid(row=0,column=3,sticky='w')

    tipText = 'Selects a peak list with assignments to use as a positional reference'
    specCLabel = Label(frameA, text='Assignment Peak List: ')
    specCLabel.grid(row=0,column=4,sticky='w')
    self.specCPulldown = PulldownList(frameA, callback=self.setAssignPeakList, tipText=tipText)
    self.specCPulldown.grid(row=0,column=5,sticky='w')

    frame0a = Frame(frameA)
    frame0a.grid(row=2,column=0,columnspan=6,sticky='nsew')
    frame0a.grid_columnconfigure(9, weight=1)
    
    tipText = '1H ppm tolerance for matching assigned peaks to reference & NOE saturation peaks'
    tolHLabel   = Label(frame0a, text='Tolerances: 1H')
    tolHLabel.grid(row=0,column=0,sticky='w')
    self.tolHEntry = FloatEntry(frame0a,text='0.02', width=6, tipText=tipText)
    self.tolHEntry .grid(row=0,column=1,sticky='w')  

    tipText = '15N ppm tolerance for matching assigned peaks to reference & NOE saturation peaks'
    tolNLabel   = Label(frame0a, text=' 15N')
    tolNLabel .grid(row=0,column=2,sticky='w')   
    self.tolNEntry = FloatEntry(frame0a,text='0.1', width=6, tipText=tipText)
    self.tolNEntry .grid(row=0,column=3,sticky='w')   

    tipText = 'Whether to peak new peaks in reference & NOE saturated lists (at assignment locations)'
    label = Label(frame0a, text=' Pick new peaks?', grid=(0,4)) 
    self.pickPeaksSelect = CheckButton(frame0a, tipText=tipText,
                                       grid=(0,5), selected=True)

    tipText = 'Whether to assign peaks in the peaks in the reference & NOE saturation lists, if not already assigned'
    label = Label(frame0a, text=' Assign peaks?')
    label.grid(row=0,column=6,sticky='w')   
    self.assignSelect = CheckButton(frame0a, tipText=tipText)
    self.assignSelect.set(1)
    self.assignSelect.grid(row=0,column=7,sticky='w')    

    tipText = 'Whether to consider peak height or volume in the heteronuclear NOE calculation'
    intensLabel = Label(frame0a, text=' Intensity Type:')
    intensLabel .grid(row=0,column=8,sticky='w')   
    self.intensPulldown = PulldownList(frame0a, texts=['height','volume'],
                                       callback=self.setIntensityType,
                                       tipText=tipText)
    self.intensPulldown.grid(row=0,column=9,sticky='w')    

    divider = LabelDivider(frameA, text='Peaks', grid=(3,0),
                           gridSpan=(1,6))

    tipTexts = ['Show the selected intensity reference peaks in the below table',
                'Show the selected NOE saturation peaks in the below table',
                'Show the selected assigned peak list in the below table',
                'Show the displayed peaks in a separate peak table, where assignments etc. may be adjusted']
    texts    = ['Show Ref Peaks','Show Sat Peaks',
                'Show Assign Peaks', 'Separate Peak Table']
    commands = [self.viewRefPeakList, self.viewSatPeakList,
                self.viewAssignPeakList, self.viewSeparatePeakTable]
    self.viewPeaksButtons = ButtonList(frameA, expands=True, tipTexts=tipTexts,
                                       texts=texts, commands=commands)
    self.viewPeaksButtons.grid(row=4,column=0,columnspan=6,sticky='nsew')

    self.peakTable = PeakTableFrame(frameA, self.guiParent, grid=(5,0),
                                    gridSpan=(1,6))
    self.peakTable.bottomButtons1.grid_forget()
    self.peakTable.bottomButtons2.grid_forget()
    #self.peakTable.topFrame.grid_forget()
    self.peakTable.topFrame.grid(row=2, column=0, sticky='ew')
    # Next tab

    frameB.expandGrid(0,0)
    
    tipTexts = ['Row number',
                'Assignment annotation for NOE saturation peak',
                'Assignment annotation for reference peak (no saturation)',
                '1H chemical shift of NOE saturation peak',
                '1H chemical shift of reference peak',
                '15N chemical shift of NOE saturation peak',
                '15N chemical shift of reference peak',
                'The separation between compared peaks: square root of the sum of ppm differences squared',
                'The intensity if the NOE saturation peak',
                'The intensity of the reference peak (no saturation)',
                'Ratio of peak intensities: saturated over reference',
                'Residue(s) for reference peak']
    colHeadings      = ['#','Sat Peak','Ref Peak','1H shift A',
                        '1H shift B','15N shift A','15N shift B',
                        'Closeness\nScore','Intensity A','Intensity B',
                        'Intensity\nRatio','Residue']
    self.scrolledMatrix = ScrolledMatrix(frameB, multiSelect=True, 
                                         headingList=colHeadings,
                                         callback=self.selectCell,
                                         tipTexts=tipTexts,
                                         grid=(0,0),
                                         deleteFunc=self.removePair)

    tipTexts = ['Force a manual update of the table; pair-up NOE saturation and reference peaks according to assigned peak positions',
                'Remove the selected rows of peak pairs',
                'Show peaks corresponding to the selected row in a table',
                'Save the Heteronuclear NOE values in the CCPN project as a data list']
    texts    = ['Refresh Table','Remove Pairs',
                'Show Peak Pair','Create Hetero NOE List']
    commands = [self.matchPeaks,self.removePair,
                self.showPeakPair,self.makeNoeList]
    self.pairButtons = ButtonList(frameB, tipTexts=tipTexts, grid=(1,0),
                                  texts=texts, commands=commands)


    bottomButtons = UtilityButtonList(tabbedFrame.sideFrame, helpUrl=self.help_url)
    bottomButtons.grid(row=0, column=0, sticky='e')
    
    self.updatePulldowns()
    self.updateAfter()

    self.administerNotifiers(self.registerNotify)
示例#23
0
    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()
示例#24
0
  def body(self, guiFrame):

    self.geometry("500x500")

    self.nameEntry  = Entry(self, text='', returnCallback=self.setName,    width=12)
    self.detailsEntry = Entry(self, text='', returnCallback=self.setDetails, width=16)
    self.valueEntry = FloatEntry(self, text='', returnCallback=self.setValue, width=10)
    self.errorEntry = FloatEntry(self, text='', returnCallback=self.setError, width=8)
    
    self.conditionNamesPulldown = PulldownList(self, callback=self.setConditionName,
                                               texts=self.getConditionNames())
    self.unitPulldown = PulldownList(self, callback=self.setUnit,
                                     texts=self.getUnits())
    self.experimentPulldown = PulldownList(self, callback=self.setExperiment)

    guiFrame.grid_columnconfigure(0, weight=1)

    row = 0
    frame = Frame(guiFrame, grid=(row, 0))
    frame.expandGrid(None,0)
    div = LabelDivider(frame, text='Current Series', grid=(0, 0))
    utilButtons = UtilityButtonList(frame, helpUrl=self.help_url, grid=(0,1))

    row += 1
    frame0 = Frame(guiFrame, grid=(row, 0))
    frame0.expandGrid(0,0)
    tipTexts = ['The serial number of the experiment series, but left blank if the series as actually a pseudo-nD experiment (with a sampled non-frequency axis)',
                'The name of the experiment series, which may be a single pseudo-nD experiment',
                'The number of separate experiments (and hence spectra) present in the series',
                'The kind of quantity that varies for different experiments/planes within the NMR series, e.g. delay time, temperature, ligand concentration etc.',
                'The number of separate points, each with a separate experiment/plane and parameter value, in the series']
    headingList      = ['#','Name','Experiments','Parameter\nVaried','Num\nPoints']
    editWidgets      = [None, self.nameEntry, None, self.conditionNamesPulldown, None]
    editGetCallbacks = [None, self.getName,   None, self.getConditionName, None]
    editSetCallbacks = [None, self.setName,   None, self.setConditionName, None]
    self.seriesMatrix = ScrolledMatrix(frame0, tipTexts=tipTexts,
                                       editSetCallbacks=editSetCallbacks,
                                       editGetCallbacks=editGetCallbacks,
                                       editWidgets=editWidgets,
                                       headingList=headingList,
                                       callback=self.selectExpSeries,
                                       deleteFunc=self.deleteExpSeries,
                                       grid=(0,0), gridSpan=(None, 3))

    tipTexts = ['Make a new, blank NMR series specification in the CCPN project',
                'Delete the selected NMR series from the project, although any component experiments remain. Note you cannot delete pseudo-nD series; delete the actual experiment instead',
                'Colour the spectrum contours for each experiment in the selected series (not pseudo-nD) using a specified scheme']
    texts    = ['Add Series','Delete Series',
                'Auto Colour Spectra']
    commands = [self.addExpSeries,self.deleteExpSeries,
                self.autoColorSpectra]
                
    self.seriesButtons = ButtonList(frame0, texts=texts, commands=commands,
                                    grid=(1,0), tipTexts=tipTexts)

    label = Label(frame0, text='Scheme:', grid=(1,1))
    
    tipText = 'Selects which colour scheme to apply to the contours of (separate) experiments within an NMR series'
    self.colorSchemePulldown = PulldownList(frame0, grid=(1,2), tipText=tipText)

    row += 1
    div = LabelDivider(guiFrame, text='Experimental Parameters & Conditions', grid=(row, 0))

    row += 1
    guiFrame.grid_rowconfigure(row, weight=1)
    frame1 = Frame(guiFrame, grid=(row, 0))
    frame1.expandGrid(0,0)
    tipTexts = ['The kind of experimental parameter that is being used to define the NMR series',
                'The experiment that corresponds to the specified parameter value; can be edited from an arbitrary initial experiment',
                'The numeric value of the parameter (condition) that relates to the experiment or point in the NMR series',
                'The estimated error in value of the condition',
                'The measurement unit in which the value of the condition is represented']
    headingList      = ['Parameter','Experiment','Value','Error','Unit']
    editWidgets      = [None,self.experimentPulldown,self.valueEntry,self.errorEntry, self.unitPulldown]
    editGetCallbacks = [None,self.getExperiment,     self.getValue,  self.getError,   self.getUnit]
    editSetCallbacks = [None,self.setExperiment,     self.setValue,  self.setError,   self.setUnit]
    self.conditionPointsMatrix = ScrolledMatrix(frame1, grid=(0,0), tipTexts=tipTexts,
                                                editSetCallbacks=editSetCallbacks,
                                                editGetCallbacks=editGetCallbacks,
                                                editWidgets=editWidgets,
                                                headingList=headingList,
                                                callback=self.selectConditionPoint,
                                                deleteFunc=self.deleteConditionPoint)
    
    self.conditionPointsMatrix.doEditMarkExtraRules = self.conditionTableShow 
    tipTexts = ['Add a new point to the NMR series with an associated parameter value and experiment',
                'Remove the selected point from the series, including any associated parameter value',
                'For appropriate kinds of NMR series, set or unset a point as representing the plane to use as a reference']
    texts    = ['Add Series Point','Delete Series Point','Set/Unset Ref Plane']
    commands = [self.addConditionPoint,self.deleteConditionPoint,self.setSampledReferencePlane]
    self.conditionPointsButtons = ButtonList(frame1, texts=texts, commands=commands,
                                             tipTexts=tipTexts, grid=(1,0))
    
    self.updateAfter()
    self.updateColorSchemes()

    self.administerNotifiers(self.registerNotify)
示例#25
0
    def __init__(self,
                 parent,
                 file_types=None,
                 directory=None,
                 single_callback=None,
                 double_callback=None,
                 select_dir_callback=None,
                 change_dir_callback=None,
                 should_change_dir_callback=None,
                 prompt=None,
                 show_file=True,
                 file='',
                 multiSelect=False,
                 default_dir=None,
                 getRowColor=None,
                 getExtraCell=None,
                 extraHeadings=None,
                 extraJustifies=None,
                 displayExtra=True,
                 manualFileFilter=False,
                 extraTipTexts=None,
                 *args,
                 **kw):

        if file_types is None:
            file_types = [FileType("All", ["*"])]

        if manualFileFilter:
            self.manualFilter = FileType("Manual")
            file_types.append(self.manualFilter)
        else:
            self.manualFilter = None

        if directory is None:
            directory = normalisePath(os.getcwd())

        if extraHeadings is None:
            extraHeadings = ()
        else:
            extraHeadings = tuple(extraHeadings)

        if extraJustifies is None:
            extraJustifies = ()
        else:
            extraJustifies = tuple(extraJustifies)

        if extraHeadings or extraJustifies:
            assert len(extraHeadings) == len(extraJustifies)
            assert getExtraCell

        self.extraHeadings = extraHeadings
        self.extraJustifies = extraJustifies
        self.extraTipTexts = extraTipTexts or []
        self.displayExtra = displayExtra

        Frame.__init__(self, parent, *args, **kw)

        self.file_types = file_types
        self.fileType = file_types[0]
        self.single_callback = single_callback
        self.double_callback = double_callback
        self.select_dir_callback = select_dir_callback
        self.change_dir_callback = change_dir_callback
        self.should_change_dir_callback = should_change_dir_callback
        self.show_file = show_file
        self.directory = None
        self.historyBack = []
        self.historyFwd = []
        self.determineDir(directory)
        self.default_dir = default_dir
        self.getRowColor = getRowColor
        self.getExtraCell = getExtraCell

        self.grid_columnconfigure(0, weight=1)

        row = 0
        if prompt:
            label = Label(self, text=prompt, grid=(row, 0))
            row += 1

        self.grid_rowconfigure(row, weight=1)
        if show_file:
            headings = ('Name', 'Size', 'Date')
            justifies = ('left', 'right', 'right')
            tipTexts = [
                'Name of file, directory or link', 'Size of file in bytes',
                'Date of last modification'
            ]
        else:
            headings = ('Directory', )
            justifies = ('left', )
            tipTexts = ['Name of directory']

        self.normalHeadings = headings
        self.normalJustifies = justifies
        self.normalTipTexts = tipTexts
        headings = headings + extraHeadings
        justifies = justifies + extraJustifies
        tipTexts += [None] * len(extraHeadings)

        self.fileList = ScrolledMatrix(self,
                                       headingList=headings,
                                       justifyList=justifies,
                                       initialRows=10,
                                       callback=self.singleCallback,
                                       doubleCallback=self.doubleCallback,
                                       tipTexts=tipTexts,
                                       multiSelect=multiSelect,
                                       grid=(row, 0))

        row += 1
        tipTexts = [
            'Go to previous location in history',
            'Go forward in location history', 'Go up one directory level',
            'Go to root directory', 'Go to home directory',
            'Make a new directory', 'Refresh directory listing'
        ]

        texts = ['Back', 'Forward', 'Up', 'Top', 'Home', 'New', 'Refresh']
        commands = [
            self.backDir, self.fwdDir, self.upDir, self.topDir, self.homeDir,
            self.createDir, self.updateFileList
        ]

        if self.default_dir:
            texts.append('Default')
            commands.append(self.setDefaultDir)
            tipTexts.append('Set the current directory as the default')

        self.icons = []
        for name in ICON_NAMES:
            icon = Tkinter.PhotoImage(
                file=os.path.join(GFX_DIR, name + '.gif'))
            self.icons.append(icon)

        self.buttons = ButtonList(self,
                                  texts=texts,
                                  commands=commands,
                                  images=self.icons,
                                  grid=(row, 0),
                                  tipTexts=tipTexts)

        if show_file:
            row += 1
            self.file_entry = LabeledEntry(self,
                                           label='File name',
                                           label_width=10,
                                           entry_width=40,
                                           returnCallback=self.setSelectedFile)
            self.file_entry.grid(row=row, column=0, sticky=Tkinter.EW)
        else:
            self.file_entry = None

        row += 1
        self.directory_entry = LabeledEntry(self,
                                            label='Directory',
                                            entry=directory,
                                            label_width=10,
                                            entry_width=40,
                                            returnCallback=self.entryDir)
        self.directory_entry.grid(row=row, column=0, sticky=Tkinter.EW)

        row += 1
        subFrame = Frame(self, grid=(row, 0))
        subFrame.expandGrid(None, 6)

        if show_file:

            label = Label(subFrame, text='File type:', grid=(0, 0))

            type_labels = self.determineTypeLabels()
            self.fileType_menu = PulldownList(
                subFrame,
                callback=self.typeCallback,
                texts=type_labels,
                objects=self.file_types,
                grid=(0, 1),
                tipText='Restrict listed files to selected suffix')

        label = Label(subFrame, text=' Show hidden:', grid=(0, 2))

        self.hidden_checkbutton = CheckButton(
            subFrame,
            text='',
            selected=False,
            callback=self.updateFileList,
            grid=(0, 3),
            tipText='Show hidden files beginning with "." etc.')

        label = Label(subFrame, text='Dir path:', grid=(0, 4))

        self.pathMenu = PulldownList(
            subFrame,
            callback=self.dirCallback,
            objects=range(len(self.dirs)),
            texts=self.dirs,
            index=len(self.dirs) - 1,
            indent='  ',
            prefix=dirsep,
            grid=(0, 5),
            tipText='Directory navigation to current location')

        if show_file and self.manualFilter is not None:
            row += 1
            self.manual_filter_entry = LabeledEntry(
                self,
                label='Manual Select',
                entry=defaultFilter,
                label_width=13,
                entry_width=40,
                returnCallback=self.entryFilter,
                tipText=
                'Path specification with wildcards to select multiple files')
            self.manual_filter_entry.grid(row=row, column=0, sticky=Tkinter.EW)

        self.updateFileList()
        self.updateButtons()

        if file:
            self.setFile(file)
示例#26
0
    def __init__(self, guiParent, basePopup):

        # Base popup required to handle notification of data model changes
        # e.g. new peak lists, so that the GUI can update to the latest
        # state
        self.basePopup = basePopup
        self.guiParent = guiParent

        # should the screen autorefresh
        self.autoRefresh = False

        # add this to shortcuts to ease navigation
        self.basePopup.frameShortcuts['Repository'] = self

        # get a port proxy instance
        # this should probably belong to the repository directly
        # or else should belong in a dictionary in the main gui
        # layer when it can be picked up easily

        # FIXME JMCI
        # need to work out how to get a number of these!

        loc = SharedBeanServiceLocator()
        self.port = loc.getSharedBean()

        self.registerNotify = basePopup.registerNotify
        self.unregisterNotify = basePopup.unregisterNotify

        Frame.__init__(self, guiParent)

        # set up the grid

        self.grid_columnconfigure(0, weight=0, minsize=20)
        self.grid_columnconfigure(1, weight=1, minsize=10)
        self.grid_columnconfigure(2, weight=0, minsize=20)

        self.grid_rowconfigure(0, weight=0, minsize=5)
        self.grid_rowconfigure(1, weight=0, minsize=0)
        self.grid_rowconfigure(2, weight=0, minsize=10)
        self.grid_rowconfigure(3, weight=0, minsize=10)
        self.grid_rowconfigure(4, weight=0, minsize=10)
        self.grid_rowconfigure(5, weight=1, minsize=10)
        self.grid_rowconfigure(6, weight=0, minsize=10)
        self.grid_rowconfigure(7, weight=0, minsize=10)

        # widgets for view when no data

        self.noDataWidgets = []

        self.noRepLabel = Label(self, text='No repository currently selected.')
        self.noDataWidgets.append(self.noRepLabel)

        # widgets for view when current repository set

        self.dataWidgets = []

        self.repTitle = Label(self, text='Repository:', font='Helvetica16')
        self.dataWidgets.append(self.repTitle)

        #self.repLabel = Label(self,text='All Projects in Repository')
        #self.dataWidgets.append(self.repLabel)

        self.repTree = Tree(self, doubleCallback=self.goto_project_tab)
        self.dataWidgets.append(self.repTree)

        sel = 1
        if self.autoRefresh:
            sel = 0
        self.autoRefreshSwitchLabel = Label(self, text='Auto Refresh')
        self.autoRefreshSwitch = RadioButtons(self, ['on', 'off'],
                                              select_callback=self.set_refresh,
                                              selected_index=sel)

        # need to decide whether this is static or not
        r_button_texts = [
            'Add to Basket', '  Import  ', '  Export  ', '  Refresh ',
            'Properties'
        ]
        r_button_cmds = [
            self.tmpCall, self.import_project, self.export_project,
            self.drawFrame, self.goto_project_tab
        ]

        self.rep_button_list = ButtonList(self, r_button_texts, r_button_cmds)
        self.dataWidgets.append(self.rep_button_list)

        self.filterFrame = FilterFrame(self, self.basePopup, text='Filter')
        self.dataWidgets.append(self.filterFrame)

        baskets = ('basket1', 'basket2', 'basket3')
        self.basketSelect = PulldownList(self, self.tmpCall, baskets)
        self.dataWidgets.append(self.basketSelect)

        basketElements = ('1ay3', '1ay7')
        self.basketList = ScrolledListbox(self, basketElements, 25, 18)
        self.dataWidgets.append(self.basketList)

        b_button_texts = ['Remove from Basket', 'New Basket']
        b_button_cmds = [self.tmpCall, self.tmpCall]

        self.b_button_list = ButtonList(self, b_button_texts, b_button_cmds)
        self.dataWidgets.append(self.b_button_list)

        # draw if not automatically refreshing
        if sel == 1:
            self.drawFrame()

        # set up a loop
        self.refresh()
示例#27
0
    def body(self, guiFrame):

        guiFrame.grid_columnconfigure(0, weight=1)
        row = 0

        self.scrolledGraph = ScrolledGraph(guiFrame,
                                           width=400,
                                           height=300,
                                           symbolSize=5,
                                           symbols=['square', 'circle'],
                                           dataColors=['#000080', '#800000'],
                                           lineWidths=[0, 1],
                                           grid=(row, 0))

        #self.scrolledGraph.setZoom(0.7)

        row += 1
        frame = Frame(guiFrame, grid=(row, 0), sticky='ew')

        label = Label(frame, text='Fitting Function:', grid=(0, 0))

        tipText = 'Selects which form of function to fit to the experimental data'
        self.methodPulldown = PulldownList(frame,
                                           self.changeMethod,
                                           grid=(0, 1),
                                           tipText=tipText)

        row += 1
        frame = Frame(guiFrame, grid=(row, 0), sticky='ew')

        tipText = 'The effective equation of the final fitted graph, incorporating all parameters'
        self.equationLabel = Label(frame,
                                   text='Equation:',
                                   grid=(0, 0),
                                   tipText=tipText)

        tipText = 'The error in the fit of the selected parameterised function to the experimental data'
        self.errorLabel = Label(frame,
                                text='Fit Error:',
                                grid=(0, 1),
                                tipText=tipText)

        row += 1
        frame = Frame(guiFrame, grid=(row, 0), sticky='ew')

        label = Label(frame, text='Include x origin?:', grid=(0, 0))

        tipText = 'Whether to include the x=0 point in the drawing'
        self.xOriginSelect = CheckButton(frame,
                                         callback=self.draw,
                                         grid=(0, 1),
                                         selected=False,
                                         tipText=tipText)

        label = Label(frame, text='Include y origin?:', grid=(0, 2))

        tipText = 'Whether to include the y=0 point in the drawing'
        self.yOriginSelect = CheckButton(frame,
                                         callback=self.draw,
                                         grid=(0, 3),
                                         selected=False,
                                         tipText=tipText)

        label = Label(frame, text='Include y error?:', grid=(0, 4))

        tipText = 'Whether to include the y error bars in the drawing (if these exist)'
        self.yErrorSelect = CheckButton(frame,
                                        callback=self.draw,
                                        grid=(0, 5),
                                        selected=False,
                                        tipText=tipText)

        row += 1
        frame = Frame(guiFrame, grid=(row, 0), sticky='ew')

        label = Label(frame, text='Navigation Window:', grid=(0, 0))

        tipText = 'Selects which spectrum window will be used for navigating to peak positions'
        self.windowPanePulldown = PulldownList(frame,
                                               self.changeWindow,
                                               grid=(0, 1),
                                               tipText=tipText)

        label = Label(frame, text='Follow in window?:', grid=(0, 2))

        tipText = 'Whether to navigate to the position of the reference peak (for the group), in the selected window'
        self.followSelect = CheckButton(frame,
                                        callback=self.windowPaneNavigate,
                                        grid=(0, 3),
                                        selected=False,
                                        tipText=tipText)

        label = Label(frame, text='Mark Ref Peak?:', grid=(0, 4))

        tipText = 'Whether to put a multi-dimensional cross-mark through the reference peak position, so it can be identified in spectra'
        self.markSelect = CheckButton(frame,
                                      callback=None,
                                      tipText=tipText,
                                      grid=(0, 5),
                                      selected=False)

        row += 1
        guiFrame.grid_rowconfigure(row, weight=1)
        tipTexts = [
            'The number of the data point, in order of increasing X-axis value',
            'For each point, the value of the parameter which is varied in the NMR series, e.g. T1, temperature, concentration etc.',
            'For each point, the experimental value being fitted, e.g. peak intensity of chemical shift distance',
            'The value of the best-fit function at the X-axis location',
            'The difference between the experimental (Y-axis) value and the fitted value',
            'The error in the experimental (Y-axis) value'
        ]
        headingList = ['Point', 'x', 'y', 'Fitted y', u'\u0394', 'y error']
        self.scrolledMatrix = ScrolledMatrix(guiFrame,
                                             headingList=headingList,
                                             callback=self.selectObject,
                                             tipTexts=tipTexts,
                                             grid=(row, 0))

        row += 1
        tipTexts = [
            'Remove the selected data point, optionally removing the underlying peak',
            'Show a table of spectrum peaks that correspond to the selected data point'
        ]
        texts = ['Remove Point', 'Show Peak']
        commands = [self.removePoint, self.showObject]

        if self.prevSetFunction:
            texts.append('Previous Set')
            tipTexts.append(
                'Move to the previous set of fitted values; the next group of peaks, often corresponding to a different residue or resonance'
            )
            commands.append(self.prevSet)

        if self.nextSetFunction:
            tipTexts.append(
                'Move to the next set of fitted values; the next group of peaks, often corresponding to a different residue or resonance'
            )
            texts.append('Next Set')
            commands.append(self.nextSet)

        bottomButtons = UtilityButtonList(guiFrame,
                                          texts=texts,
                                          commands=commands,
                                          helpUrl=self.help_url,
                                          tipTexts=tipTexts,
                                          grid=(row, 0),
                                          doClone=False)
        self.removeButton = bottomButtons.buttons[0]

        for func in ('__init__', 'delete', 'setName'):
            self.registerNotify(self.updateWindows,
                                'ccpnmr.Analysis.SpectrumWindow', func)

        self.update()
示例#28
0
    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)
示例#29
0
    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)
示例#30
0
  def body(self, guiFrame):
  
    guiFrame.grid_columnconfigure(0, weight=1)
    guiFrame.grid_rowconfigure(0, weight=1)

    options = ['Parameters','Restraints','Alignment Media & Tensors','About Meccano']
    tabbedFrame = TabbedFrame(guiFrame, options=options)
    tabbedFrame.grid(row=0, column=0, sticky='nsew')
    
    frameA, frameB, frameC, frameD = tabbedFrame.frames
    frameA.grid_columnconfigure(1, weight=1)
    frameA.grid_rowconfigure(13, weight=1)
    frameB.grid_columnconfigure(1, weight=1)
    frameB.grid_rowconfigure(1, weight=1)
    frameC.grid_columnconfigure(0, weight=1)
    frameC.grid_rowconfigure(1, weight=1)
    frameD.grid_columnconfigure(0, weight=1)
    frameD.grid_rowconfigure(0, weight=1)
    
    texts = ['Run MECCANO!']
    commands = [self.runMeccano]
    bottomButtons = createDismissHelpButtonList(guiFrame, texts=texts,
                                                commands=commands, expands=True)
    bottomButtons.grid(row=1, column=0, sticky='ew')

    if not Meccano:
      bottomButtons.buttons[0].disable()
  
    # Parameters
        
    row = 0
    label = Label(frameA, text='Calculation Run:')
    label.grid(row=row,column=0,sticky='w')
    self.runPulldown = PulldownList(frameA, callback=self.selectRun)
    self.runPulldown.grid(row=row,column=1,sticky='w')
    
    row += 1    
    label = Label(frameA, text='Shift List (for CO):')
    label.grid(row=row,column=0,sticky='w')
    self.shiftListPulldown = PulldownList(frameA, callback=self.selectShiftList)
    self.shiftListPulldown.grid(row=row,column=1,sticky='w')
           
    row += 1    
    label = Label(frameA, text='Keep Copy of Used Shifts:')
    label.grid(row=row,column=0,sticky='w')
    self.toggleCopyShifts = CheckButton(frameA)
    self.toggleCopyShifts.grid(row=row,column=1,sticky='w')
    self.toggleCopyShifts.set(True)
        
    row += 1    
    label = Label(frameA, text='Molecular System:')
    label.grid(row=row,column=0,sticky='w')
    self.molSystemPulldown = PulldownList(frameA, callback=self.selectMolSystem)
    self.molSystemPulldown.grid(row=row,column=1,sticky='w')
        
    row += 1    
    label = Label(frameA, text='Chain:')
    label.grid(row=row,column=0,sticky='w')
    self.chainPulldown = PulldownList(frameA, callback=self.selectChain)
    self.chainPulldown.grid(row=row,column=1,sticky='w')
    self.chainPulldown.bind('<Leave>', self.updateRunParams) 
        
    row += 1    
    label = Label(frameA, text='First Peptide Plane:')
    label.grid(row=row,column=0,sticky='w')
    self.firstResEntry = IntEntry(frameA, text=None, width=8)
    self.firstResEntry.grid(row=row,column=1,sticky='w')
    self.firstResEntry.bind('<Leave>', self.updateRunParams) 
        
    row += 1    
    label = Label(frameA, text='Last Peptide Plane:')
    label.grid(row=row,column=0,sticky='w')
    self.lastResEntry = IntEntry(frameA, text=None, width=8)
    self.lastResEntry.grid(row=row,column=1,sticky='w')
    self.lastResEntry.bind('<Leave>', self.updateRunParams) 
        
    row += 1    
    label = Label(frameA, text='Max Num Optimisation Steps:')
    label.grid(row=row,column=0,sticky='w')
    self.maxOptStepEntry = IntEntry(frameA, text=500, width=8)
    self.maxOptStepEntry.grid(row=row,column=1,sticky='w')
    self.maxOptStepEntry.bind('<Leave>', self.updateRunParams) 
        
    row += 1    
    label = Label(frameA, text='Num Optimisation Peptide Planes:')
    label.grid(row=row,column=0,sticky='w')
    self.numOptPlaneEntry = IntEntry(frameA, text=2, width=8)
    self.numOptPlaneEntry.grid(row=row,column=1,sticky='w')
    self.numOptPlaneEntry.bind('<Leave>', self.updateRunParams) 
        
    row += 1    
    label = Label(frameA, text='Min Num Optimisation Hits:')
    label.grid(row=row,column=0,sticky='w')
    self.numOptHitsEntry = IntEntry(frameA, text=5, width=8)
    self.numOptHitsEntry.grid(row=row,column=1,sticky='w')
    self.numOptHitsEntry.bind('<Leave>', self.updateRunParams) 

    row += 1    
    label = Label(frameA, text='File Name Prefix:')
    label.grid(row=row,column=0,sticky='w')
    self.pdbFileEntry = Entry(frameA, text='Meccano', width=8)
    self.pdbFileEntry.grid(row=row,column=1,sticky='w')
    self.pdbFileEntry.bind('<Leave>', self.updateRunParams) 
           
    row += 1    
    label = Label(frameA, text='Write Output File (.out):')
    label.grid(row=row,column=0,sticky='w')
    self.toggleWriteOutFile = CheckButton(frameA)
    self.toggleWriteOutFile.grid(row=row,column=1,sticky='w')
    self.toggleWriteOutFile.set(False)
    self.toggleWriteOutFile.bind('<Leave>', self.updateRunParams) 
           
    row += 1    
    label = Label(frameA, text='Write PDB File (.pdb):')
    label.grid(row=row,column=0,sticky='w')
    self.toggleWritePdbFile = CheckButton(frameA)
    self.toggleWritePdbFile.grid(row=row,column=1,sticky='w')
    self.toggleWritePdbFile.set(True)
    self.toggleWritePdbFile.bind('<Leave>', self.updateRunParams) 
    
    if not Meccano:
      row += 1    
      label = Label(frameA, text='The Meccano executable is not available (it needs to be compiled)', fg='red')
      label.grid(row=row,column=0,columnspan=2,sticky='w')

    # Restraints
    
    label = Label(frameB, text='Constraint Set:')
    label.grid(row=0,column=0,sticky='w')
    
    self.constraintSetPulldown = PulldownList(frameB, callback=self.selectConstraintSet)
    self.constraintSetPulldown.grid(row=0,column=1,sticky='w')
    
    self.alignMediumPulldown= PulldownList(self, callback=self.setAlignMedium)
    
    headingList = ['#','List Type','Use?','Alignment\nMedium','Num\nRestraints']
    editWidgets      = [None,None,None,self.alignMediumPulldown,None]
    editGetCallbacks = [None,None,self.toggleUseRestraints,self.getAlignMedium,None]
    editSetCallbacks = [None,None,None,self.setAlignMedium,None]
    self.restraintMatrix = ScrolledMatrix(frameB,
                                          headingList=headingList,
                                          editSetCallbacks=editSetCallbacks,
                                          editGetCallbacks=editGetCallbacks, 
                                          editWidgets=editWidgets,
                                          callback=None,
                                          multiSelect=True)
    self.restraintMatrix.grid(row=1,column=0,columnspan=2,sticky='nsew')
    
    
    # Alignment Media
    
    div = LabelDivider(frameC,text='Alignment Media')
    div.grid(row=0,column=0,sticky='ew')
    
    self.mediumNameEntry = Entry(self, returnCallback=self.setMediumName)
    self.mediumDetailsEntry = Entry(self, returnCallback=self.setMediumDetails)
    
    headingList = ['#','Name','Details','Static Tensor','Dynamic Tensor']
    editWidgets      = [None, self.mediumNameEntry, self.mediumDetailsEntry, None, None]
    editGetCallbacks = [None, self.getMediumName, self.getMediumDetails, None, None]
    editSetCallbacks = [None, self.setMediumName, self.setMediumDetails, None, None]
    self.mediaMatrix = ScrolledMatrix(frameC,
                                      headingList=headingList,
                                      editSetCallbacks=editSetCallbacks,
                                      editGetCallbacks=editGetCallbacks, 
                                      editWidgets=editWidgets,
                                      callback=self.selectAlignMedium,
                                      multiSelect=True)
                                 
    self.mediaMatrix.grid(row=1,column=0,sticky='nsew')
     
    
    texts = ['Add Alignment medium','Remove Alignment Medium']
    commands = [self.addAlignMedium,self.removeAlignMedium]
    buttonList = ButtonList(frameC, texts=texts, commands=commands, expands=True)
    buttonList.grid(row=2,column=0,sticky='nsew')
    
    self.editAxialEntry = FloatEntry(self, returnCallback=self.setAxial)
    self.editRhombicEntry = FloatEntry(self, returnCallback=self.setRhombic)
    self.editAlphaEulerEntry = FloatEntry(self, returnCallback=self.setEulerAlpha)
    self.editBetaEulerEntry = FloatEntry(self, returnCallback=self.setEulerBeta)
    self.editGammaEulerEntry = FloatEntry(self, returnCallback=self.setEulerGamma)
    
    
    div = LabelDivider(frameC,text='Alignment Tensors')
    div.grid(row=3,column=0,sticky='ew')
    
    headingList = ['Type', u'Axial (\u03B6)',u'Rhombic (\u03B7)',
                   u'Euler \u03B1',u'Euler \u03B2',u'Euler \u03B3']
    editWidgets      = [None,self.editAxialEntry,
                        self.editRhombicEntry,self.editAlphaEulerEntry,
                        self.editBetaEulerEntry,self.editGammaEulerEntry]
    editSetCallbacks = [None,self.setAxial,self.setRhombic,
                        self.setEulerAlpha,self.setEulerBeta,self.setEulerGamma]
    editGetCallbacks = [None,self.getAxial,self.getRhombic,
                        self.getEulerAlpha,self.getEulerBeta,self.getEulerGamma]
                   
    self.tensorMatrix = ScrolledMatrix(frameC, maxRows=2,
                                       headingList=headingList,
                                       editSetCallbacks=editSetCallbacks,
                                       editGetCallbacks=editGetCallbacks, 
                                       editWidgets=editWidgets,
                                       callback=self.selectTensor,
                                       multiSelect=True)
                                          
    self.tensorMatrix.grid(row=4,column=0,sticky='nsew')
    
    texts = ['Add Static Tensor','Add Dynamic Tensor','Remove Tensor']
    commands = [self.addStaticTensor,self.addDynamicTensor,self.removeTensor]
    buttonList = ButtonList(frameC,texts=texts, commands=commands, expands=True)
    buttonList.grid(row=5,column=0,sticky='ew')
       
    # About
    
    label = Label(frameD, text='About Meccano...')
    label.grid(row=0,column=0,sticky='w')
  
    #
  
    self.geometry('500x400')

    self.updateShiftLists()
    self.updateMolSystems()
    self.updateResidueRanges()
    self.updateConstraintSets()
    self.updateAlignMedia()
    self.updateRuns()