Exemplo n.º 1
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()
Exemplo n.º 2
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()
Exemplo n.º 3
0
  def body(self, guiParent):

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

    file_types = [  FileType('Python', ['*.py']), FileType('All', ['*']) ]
    self.file_select = FileSelect(guiParent, file_types=file_types,
                                  single_callback=self.chooseFile,
                                  double_callback=self.chooseFile)
    self.file_select.grid(row=row, column=0, columnspan=2, sticky='nsew')
    
    row = row + 1
    headingList=('Function',)
    self.scrolledMatrix = ScrolledMatrix(guiParent, initialRows=4,
                            headingList=headingList, callback=self.selectFunction)
    self.scrolledMatrix.grid(row=row, column=0, columnspan=2, sticky='nsew')
    guiParent.grid_rowconfigure(row,weight=1)

    row = row + 1
    self.moduleLabel1 = Label(guiParent, text='Module: ')
    self.moduleLabel1.grid(row=row, column=0, sticky='nw')
    self.moduleLabel2 = Label(guiParent, text=' ')
    self.moduleLabel2.grid(row=row, column=1, sticky='nw')

    row = row + 1
    self.functionLabel1 = Label(guiParent, text='Function: ')
    self.functionLabel1.grid(row=row, column=0, sticky='nw')
    self.functionLabel2 = Label(guiParent, text=' ')
    self.functionLabel2.grid(row=row, column=1, sticky='nw')

    row = row + 1
    self.nameLabel = Label(guiParent, text='Name: ')
    self.nameLabel.grid(row=row, column=0, sticky='nw')
    self.nameEntry = Entry(guiParent, text=' ', width=40)
    self.nameEntry.grid(row=row, column=1, sticky='nw')

    row = row + 1
    texts = [ 'Load Macro' ]
    commands = [ self.loadMacro ]
    buttons = UtilityButtonList(guiParent, texts=texts,
                                commands=commands, helpUrl=self.help_url)
    buttons.grid(row=row, column=0, columnspan=2, sticky='ew')
    
    self.loadButton = buttons.buttons[0]
    self.loadButton.disable()
    
    self.path     = None
    self.module   = None
    self.function = None
Exemplo n.º 4
0
    def body(self, master):

        master.grid_columnconfigure(1, weight=1)

        row = 0
        label = Label(master, text='Axis unit name: ', grid=(row, 0))
        tipText = 'Short textual name for the unit, e.g. "KPa" or "ms"'
        self.nameEntry = Entry(master,
                               width=10,
                               grid=(row, 1),
                               tipText=tipText)

        row += 1
        label = Label(master, text='Unit is backwards: ', grid=(row, 0))
        tipText = 'Whether the axis values decrease left to right & bottom to top. For example "ppm" does, but most units do not'
        self.backwardsMenu = BooleanPulldownMenu(master,
                                                 grid=(row, 1),
                                                 tipText=tipText)

        row += 1
        tipTexts = [
            'Make a new unit specification using the stated options and close this popup'
        ]
        texts = ['Create']
        commands = [self.ok]
        buttons = UtilityButtonList(master,
                                    texts=texts,
                                    commands=commands,
                                    closeText='Cancel',
                                    helpUrl=self.help_url,
                                    grid=(row, 0),
                                    gridSpan=(1, 2),
                                    tipTexts=tipTexts)

        master.grid_rowconfigure(row, weight=1)
Exemplo n.º 5
0
    def body(self, guiFrame):

        self.geometry('600x250+600+250')

        analysisProfile = self.analysisProfile
        userName = analysisProfile.userName
        userOrganisation = analysisProfile.userOrganisation
        userEmail = analysisProfile.userEmail

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

        explainText = 'To keep track of our users and which versions are being used\n' \
                          'we would like you to register your details with us.\n' \
                    'Collating the number of users is important for grant applications.\n' \
                    'Please do not use accents in any of the information\n' \
                    'because Python does not handle it gracefully.'
        row = 0
        label = Label(guiFrame,
                      text=explainText,
                      grid=(row, 0),
                      gridSpan=(1, 2),
                      sticky='ew')
        row += 1

        licenseAgreeText = 'I agree to abide by the rules of the CCPN licensing agreement.'

        self.agreeButton = CheckButton(guiFrame,
                                       licenseAgreeText,
                                       tipText=licenseAgreeText)
        self.agreeButton.grid(row=row, column=1, columnspan=1, sticky='nsew')

        row += 1

        self.entryWidgets = []
        for (text, value) in (('Name', userName),
                              ('Organisation', userOrganisation), ('Email',
                                                                   userEmail)):
            label = Label(guiFrame, text=text + ':', grid=(row, 0))
            entry = Entry(guiFrame,
                          text=value or '',
                          grid=(row, 1),
                          sticky='ew',
                          tipText='Your ' + text)
            self.entryWidgets.append(entry)
            row += 1

        texts = ['Register Now', 'Read License', 'Register Later']
        tipTexts = ['Register now', 'Read License', 'Register later']
        commands = [self.register, self.openLicense, self.close]
        buttons = UtilityButtonList(guiFrame,
                                    helpUrl=self.help_url,
                                    grid=(row, 0),
                                    gridSpan=(1, 2),
                                    commands=commands,
                                    texts=texts,
                                    tipTexts=tipTexts)
        self.buttons = buttons
Exemplo n.º 6
0
  def body(self, guiFrame):
  
    self.noeClassChoice = None
    self.spectrum = None
    self.intensEntry = FloatEntry(self, returnCallback=self.setIntens, width=5)
    self.targetEntry = FloatEntry(self, returnCallback=self.setTarget, width=5)
    self.minEntry    = FloatEntry(self, returnCallback=self.setMin,    width=5)
    self.maxEntry    = FloatEntry(self, returnCallback=self.setMax,    width=5)
   
    row = 0

    label = Label(guiFrame, text='Spectrum: ', grid=(row,0))
    tipText = ''
    self.spectrumPulldown = PulldownMenu(guiFrame,self.changeSpectrum, grid=(row,1))

    row +=1

    guiFrame.expandGrid(row, 1)

    tipTexts = ['Lower bound of this intensity category. Values are relative to reference intensity.',
                'Target restraint distance for this category',
                'Lower bound distance for this category',
                'Upper bound distance for this category']
    headingList = ['Min. NOE\nIntensity','Target\nDist','Min\nDist','Max\nDist']
    editWidgets = [self.intensEntry,self.targetEntry,self.minEntry,self.maxEntry]
    editGetCallbacks = [self.getIntens,self.getTarget,self.getMin,self.getMax]
    editSetCallbacks = [self.setIntens,self.setTarget,self.setMin,self.setMax]
    
    self.noeClassMatrix = ScrolledMatrix(guiFrame,
                                         headingList=headingList,
                                         callback=self.selectClass,
                                         tipTexts=tipTexts,
                                         editWidgets=editWidgets,
                                         editSetCallbacks=editSetCallbacks,
                                         editGetCallbacks=editGetCallbacks,
                                         deleteFunc=self.deleteClass,
                                         grid=(row,0), gridSpan=(1,2))
                                         

    row +=1

    tipTexts = ['Add a new distance restraint category',
                'Deleted selected restraint categor']
    texts = ['Add Class','Delete Class']
    commands = [self.addClass,self.deleteClass]
    self.bottomButtons = UtilityButtonList(guiFrame, doClone=False, grid=(row,0),
                                           gridSpan=(1,2), tipTexts=tipTexts,
                                           commands=commands, texts=texts)

    for func in ('__init__','delete','setName'):
      self.registerNotify(self.updateSpectra, 'ccp.nmr.Nmr.Experiment', func)
      self.registerNotify(self.updateSpectra, 'ccp.nmr.Nmr.DataSource', func)

    self.updateSpectra()
    self.update()
Exemplo n.º 7
0
    def body(self, guiFrame):
        '''This method describes the outline of the body of the
           application.
               args: guiFrame: frame the body should live in.
        '''

        self.geometry('900x700')

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

        tabbedFrame = TabbedFrame(guiFrame,
                                  options=['Spectra',
                                           'Annealing',
                                           'Results',
                                           'Bulk Transfer Assignments To Project',
                                           'Save and Load'],
                                  callback=self.toggleTab,
                                  grid=(0, 0))

        self.tabbedFrame = tabbedFrame

        autoFrame, NAFrame, resultsFrame, assignFrame, saveFrame = tabbedFrame.frames

        self.spectrumSelectionTab = SpectrumSelectionTab(self, autoFrame)
        self.assignTab = AssignMentTransferTab(self, assignFrame)
        self.saveLoadTab = SaveLoadTab(self, saveFrame)
        self.annealingSettingsTab = AnnealingSettingsTab(self, NAFrame)
        self.resultsTab = ResultsTab(self, resultsFrame)

        bottomButtons = UtilityButtonList(tabbedFrame.sideFrame,
                                          helpUrl='www.google.com')
        bottomButtons.grid(row=0, column=0, sticky='e')

        self.infoLabel = Label(guiFrame, text=' ')

        self.infoLabel.grid(row=2, column=0, sticky='w')

        self.waiting = False
        self.updateAfter()

        self.administerNotifiers(self.registerNotify)
Exemplo n.º 8
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)
Exemplo n.º 9
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()
Exemplo n.º 10
0
    def body(self, guiFrame):

        guiFrame.grid_columnconfigure(0, weight=1)

        subFrame0 = LabelFrame(guiFrame, text=self.text, grid=(0, 0))
        label = Label(subFrame0, text=self.message, anchor='w', grid=(0, 0))

        subFrame1 = LabelDivider(guiFrame, text='View Peaks', grid=(1, 0))

        texts = []
        commands = []
        for i in range(len(self.groups)):
            texts.append(self.groupNames[i])
            commands.append(lambda n=i: self.viewGroup(n))

        buttonList = UtilityButtonList(guiFrame,
                                       commands=commands,
                                       texts=texts,
                                       grid=(2, 0),
                                       tipTexts=self.tipTexts,
                                       doClone=False)
Exemplo n.º 11
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()
Exemplo n.º 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)
Exemplo n.º 13
0
    def body(self, master):

        self.geometry('650x200')

        master.grid_columnconfigure(0, weight=1)

        row = 0
        master.grid_rowconfigure(row, weight=1)
        self.storedContourTable = None
        headings = ('#', 'Experiment', 'Spectrum', 'Dims', 'Directory', 'File')
        ###self.urlWidget = Entry(self, returnCallback=self.setUrl, width=10)
        ###self.pathWidget   = Entry(self, returnCallback=self.setPath, width=10)
        ###editWidgets = [ None, None, None, None, self.urlWidget, self.pathWidget ]
        ###editGetCallbacks = [ None, None, None, None, self.getUrl, self.getPath ]
        ###editSetCallbacks = [ None, None, None, None, self.setUrl, self.setPath ]
        tipTexts = [
            'Row number',
            'The experiment that contains the spectrum to which the contour file relates',
            'The spectrum to which the contour file relates',
            'The projected spectrum dimensions which are represented by the contour file, i.e. to form the X-Y plane of the screen',
            'Directory in which the contour file is saved',
            'The name of the file in which contours for thei spectrum projection are saved'
        ]
        editWidgets = 6 * [None]
        editGetCallbacks = 6 * [None]
        editSetCallbacks = 6 * [None]
        self.storedContourTable = ScrolledMatrix(
            master,
            headingList=headings,
            callback=self.setButtonState,
            editWidgets=editWidgets,
            multiSelect=True,
            editGetCallbacks=editGetCallbacks,
            editSetCallbacks=editSetCallbacks,
            deleteFunc=self.deleteContourFile,
            tipTexts=tipTexts)
        self.storedContourTable.grid(row=row, column=0, sticky='nsew')
        row = row + 1

        tipTexts = [
            'Locate an exiting file on disk and use that as a spectrum contour file',
            'Create a new spectrum contour file; requires that the spectrum data matrix is accessible',
            'Remove the selected contour file from the CCPN project and optionally delete the file from disk'
        ]
        texts = ['Find Existing File', 'Create New File', 'Delete']
        commands = [
            self.addContourFile, self.createContourFile, self.deleteContourFile
        ]
        self.buttons = UtilityButtonList(master,
                                         texts=texts,
                                         doClone=False,
                                         commands=commands,
                                         helpUrl=self.help_url)
        self.buttons.grid(row=row, column=0, sticky='ew')

        self.updateAfter()

        for clazz in ('ccp.nmr.Nmr.Experiment', 'ccp.nmr.Nmr.DataSource'):
            self.registerNotify(self.updateAfter, clazz, 'setName')

        for func in ('__init__', 'delete', ''):
            self.registerNotify(self.updateAfter,
                                'ccpnmr.Analysis.StoredContour', func)
Exemplo n.º 14
0
    def body(self, guiFrame):

        self.geometry("500x250")

        self.numAliasingEntry = IntEntry(self,
                                         text='',
                                         returnCallback=self.setNumAliasing,
                                         width=4)

        guiFrame.expandGrid(1, 0)

        div = LabelDivider(guiFrame,
                           text='Peak Dimension Positions',
                           grid=(0, 0))
        utilButtons = UtilityButtonList(guiFrame,
                                        doClone=False,
                                        closeCmd=self.close,
                                        helpUrl=self.help_url,
                                        grid=(0, 1))

        tipTexts = [
            'The peak/spectrum dimension number',
            'The kind of isotope measured in the dimension',
            'The position of the peak in this dimension, in units of ppm',
            'The frequency position of the peak in this dimension, in units of Hz',
            'The data point position (in the spectrum matrix) of the peak in this dimension',
            'Sets the number of spectrum sweep withs to add to the peak dimension position to locate it at its real ppm value. Note an aliasing of "1" moves a peak to a lower ppm',
            'The assignment annotation for the peak dimension'
        ]

        headingList = [
            'Dimension', 'Isotope', 'ppm', 'Hz', 'Points', 'Num.\nAliasing',
            'Annotation'
        ]
        editWidgets = [
            None, None, None, None, None, self.numAliasingEntry, None
        ]
        editGetCallbacks = [
            None, None, None, None, None, self.getNumAliasing, None
        ]
        editSetCallbacks = [
            None, None, None, None, None, self.setNumAliasing, None
        ]
        self.scrolledMatrix = ScrolledMatrix(guiFrame,
                                             tipTexts=tipTexts,
                                             editSetCallbacks=editSetCallbacks,
                                             editGetCallbacks=editGetCallbacks,
                                             editWidgets=editWidgets,
                                             initialCols=5,
                                             initialRows=3,
                                             headingList=headingList,
                                             callback=self.selectCell,
                                             grid=(1, 0),
                                             gridSpan=(1, 2))

        for func in ('__init__', 'delete', 'setAnnotation', 'setNumAliasing',
                     'setPosition'):
            self.registerNotify(self.updateAfter, 'ccp.nmr.Nmr.PeakDim', func)

        self.waiting = False
        self.updateAfter(self.peak)
Exemplo n.º 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()
Exemplo n.º 16
0
  def body(self, guiFrame):

    guiFrame.grid_columnconfigure(3, weight=1)

    self.progressBar = TypingEnsemblePopup(self,total=100)
    self.progressBar.close()
    
    row = 0
    label = Label(guiFrame, text=' Chain: ', grid=(row,0))
    tipText = 'Selects which molecular chain the spin system residue types will be predicted for; determines which range of types are available'
    self.chainPulldown = PulldownList(guiFrame, self.changeChain,
                                      grid=(row,1), tipText=tipText)

    tipText = 'Selects which shift list will be used as the source of chemical shift information to make the residue type predictions'
    label = Label(guiFrame, text='Shift List: ', grid=(row,2))
    self.shiftListPulldown = PulldownList(guiFrame, callback=self.setShiftList,
                                          grid=(row,3), tipText=tipText)

    utilButtons = UtilityButtonList(guiFrame, helpUrl=self.help_url)
    utilButtons.grid(row=row, column=4, sticky='w')

    row += 1
    frame = LabelFrame(guiFrame, text='Options', grid=(row,0), gridSpan=(1,5))
    frame.grid_columnconfigure(3, weight=1)

    frow = 0
    label = Label(frame, text='Keep existing types?',
                  grid=(frow,0), sticky='e')
    tipText = 'Whether any existing residue type information should be preserved, when predicting the type of others'
    self.preserveTypesSelect = CheckButton(frame, grid=(frow,1), selected=False, 
                                           callback=self.selectPreserveTypes,
                                           tipText=tipText)
  

    label = Label(frame, text='Assignment threshold: ',
                  grid=(frow,2), sticky='e')
    tipText = 'The lower limit for the predicted residue type to be set with "Assign Types"; needs to be adjusted according to result statistics and amount of shift data'
    self.thresholdEntry = FloatEntry(frame, text=self.threshold,
                                     width=8, grid=(frow,3), tipText=tipText)

    frow += 1
    label = Label(frame, text='Ensemble size: ', grid=(frow,0), sticky='e')
    tipText = 'The number of best scoring residue type mappings, from the Monte Carlo search, to use un the prediction'
    self.ensembleEntry = IntEntry(frame,text=20,width=4,
                                  grid=(frow,1), tipText=tipText)

    label = Label(frame, text='Num Search Steps: ', grid=(frow,2), sticky='e')
    tipText = 'The number of iterative steps that will be used in the Monte Carlo search of best spin system to residue type mappings'
    self.stepsEntry = IntEntry(frame, text=100000, width=8,
                               tipText=tipText, grid=(frow,3))

    frow += 1
    label = Label(frame, text='Isotope shifts to consider:',
                  grid=(frow,0), gridSpan=(1,4))
    
    frow += 1
    self.isotopes = ['1H','13C']
    isos   = ['1H','13C','15N']
    colors = [COLOR_DICT[x] for x in isos] 
    tipText = 'Selects which kinds of resonances, in terms of isotope, the residue type predictions will be made with'
    self.isotopeCheckButtons = PartitionedSelector(frame, labels=isos,
                                                   objects=isos, colors=colors,
                                                   callback=self.toggleIsotope,
                                                   selected=self.isotopes,
                                                   grid=(frow,0),
                                                   gridSpan=(1,4), tipText=tipText)
        
    row += 1
    guiFrame.grid_rowconfigure(row, weight=1)
    labelFrame = LabelFrame(guiFrame, text='Spin Systems', grid=(row,0), gridSpan=(1,5))
    labelFrame.expandGrid(0,0)
    
    tipTexts = ['The spin system serial number',
                'The residue to which the spin system may currently be assigned',
                'Set whether to include a particular spin system in the type predictions',
                'The spin system to residue type match score for a prediction; higher (less negative) is better',
                'The predicted types of residue that the spin system may be',
                'The chemical shifts in the spin system that will be used in the analysis']
    headingList = ['#','Residue','Use?','Score','Types','Shifts']
    justifyList = ['center','center','center','center','center','left']
    editWidgets      = [None, None, None, None, None, None]
    editGetCallbacks = [None, None, self.toggleInclude, None, None, None]
    editSetCallbacks = [None, None, None, None, None, None]
    self.scrolledMatrix = ScrolledMatrix(labelFrame, headingList=headingList,
                                         justifyList=justifyList,
 					 editSetCallbacks=editSetCallbacks,
                                         editWidgets=editWidgets,
 					 editGetCallbacks=editGetCallbacks,
                                         callback=self.selectCell,
                                         grid=(0,0), tipTexts=tipTexts)

    row += 1
    tipTexts = ['Execute the Monte Carlo search that will make the residue type predictions for the spin systems',
                'Assign the residue type of spin systems with a unique type prediction and prediction score above the stated threshold',
                'Show a residue type prediction for the selected spin system alone; only considers that spin system of shifts, not how all spin systems fit to the sequence',
                'Show a table of peaks that are assigned to the resonances of the selected spin system']
    texts    = ['Run\nTyping','Assign\nTypes',
                'Show Individual\nClassification',
                'Show\nPeaks']
    commands = [self.run, self.assign,
                self.individualScore,
                self.showPeaks]
    bottomButtons = ButtonList(guiFrame, texts=texts, commands=commands,
                               grid=(row,0), gridSpan=(1,5), tipTexts=tipTexts)
    
    self.runButton    = bottomButtons.buttons[0]
    self.assignButton = bottomButtons.buttons[1]
    self.scoreButton  = bottomButtons.buttons[2]
    self.peaksButton  = bottomButtons.buttons[2]
    self.runButton.config(bg='#B0FFB0')
    
    for func in ('__init__','delete'):
      self.registerNotify(self.updateChains, 'ccp.molecule.MolSystem.Chain', func)
      self.registerNotify(self.updateShiftLists, 'ccp.nmr.Nmr.ShiftList', func)
      
    for func in ('__init__','delete','setCcpCode',
                 'setResidue','addResonance', 'setName',
                 'removeResonance','setResonances'):
       self.registerNotify(self.updateSpinSystemsAfter, 'ccp.nmr.Nmr.ResonanceGroup', func)

    self.updateChains()
    self.updateShiftLists()
    self.updateSpinSystems()
Exemplo n.º 17
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()
Exemplo n.º 18
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)
Exemplo n.º 19
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()
Exemplo n.º 20
0
    def body(self, guiFrame):

        dataDim = self.dataDim
        dataDimRef = getPrimaryDataDimRef(dataDim)
        spectrum = dataDim.dataSource

        guiFrame.grid_columnconfigure(0, weight=1)

        row = 0
        label = Label(guiFrame, text='Experiment:', grid=(row, 0), sticky='e')
        tipText = 'The name of the experiment that contains the spectrum to be re-referenced'
        label = Label(guiFrame,
                      text=spectrum.experiment.name,
                      grid=(row, 1),
                      tipText=tipText)

        row += 1
        label = Label(guiFrame, text='Spectrum:', grid=(row, 0), sticky='e')
        tipText = 'The name of the spectrum to be re-referenced'
        label = Label(guiFrame,
                      text=spectrum.name,
                      grid=(row, 1),
                      tipText=tipText)

        row += 1
        label = Label(guiFrame, text='Dimension:', grid=(row, 0), sticky='e')
        tipText = 'The number of the spectrum dimension that will be re-referenced'
        label = Label(guiFrame,
                      text=self.dataDimText(dataDim),
                      grid=(row, 1),
                      tipText=tipText)

        row += 1
        label = Label(guiFrame,
                      text='Chosen reference point:',
                      grid=(row, 0),
                      sticky='e')
        text = formatFloat(self.position, places=6)
        tipText = 'The chosen position in the spectrum dimension (where the mouse was clicked) in data matrix points'
        label = Label(guiFrame, text=text, grid=(row, 1), tipText=tipText)

        row += 1
        label = Label(guiFrame,
                      text='Current reference ppm at this point:',
                      grid=(row, 0),
                      sticky='e')
        self.current_refppm = convertPosition(self.position,
                                              dataDimRef,
                                              toUnit='ppm')
        text = formatFloat(self.current_refppm, places=6)
        tipText = 'The ppm value currently associated with this points location'
        label = Label(guiFrame, text=text, grid=(row, 1), tipText=tipText)

        row += 1
        label = Label(guiFrame,
                      text='New reference ppm at this point:',
                      grid=(row, 0),
                      sticky='e')
        tipText = 'Inputs a new value for the exact ppm position of the selected point; consequently re-referencing the spectrum dimension'
        self.refppm_entry = FloatEntry(guiFrame,
                                       width=30,
                                       grid=(row, 1),
                                       sticky='ew',
                                       tipText=tipText)
        self.refppm_entry.set(0.0)  # default

        row += 1
        guiFrame.grid_rowconfigure(row, weight=1)
        tipTexts = [
            'The name of experiments within the project containing similar spectrum dimensions',
            'The name of the spectrum within the project that may be re-referenced',
            'The spectrum dimension to which the re-referencing may apply',
            'The current reference point for the spectrum dimension in its spectrum data matrix',
            'The current reference ppm value for the spectrum dimension; the value at the reference point',
            'Sets whether the spectrum dimension will be re-referenced using the above reference point and ppm value'
        ]
        headings = ('Experiment', 'Spectrum', 'Dimension', 'Reference\npoint',
                    'Reference\nppm', 'Change\nreferencing')
        editWidgets = editSetCallbacks = 6 * [None]
        editGetCallbacks = [None, None, None, None, None, self.toggleChangeRef]
        self.datadim_list = ScrolledMatrix(guiFrame,
                                           headingList=headings,
                                           initialRows=4,
                                           editWidgets=editWidgets,
                                           editGetCallbacks=editGetCallbacks,
                                           editSetCallbacks=editSetCallbacks,
                                           grid=(row, 0),
                                           gridSpan=(1, 2),
                                           tipTexts=tipTexts)
        tipTexts = [
            'Re-reference the selected spectrum dimensions using the stated ppm value',
        ]
        row += 1
        texts = ['Commit']
        commands = [self.ok]
        buttons = UtilityButtonList(guiFrame,
                                    texts=texts,
                                    commands=commands,
                                    doClone=False,
                                    closeText='Cancel',
                                    helpUrl=self.help_url,
                                    grid=(row, 0),
                                    gridSpan=(1, 2),
                                    tipTexts=tipTexts)

        self.updateDataDimList()
Exemplo n.º 21
0
    def body(self, master):

        fileName = self.fileName
        directory = os.path.dirname(fileName)
        if not directory:
            directory = os.getcwd()
        fileName = os.path.basename(fileName)

        m = template_re.match(fileName)
        if m:
            n = len(m.groups(2))
            ss = '%%0%dd' % n
            template = re.sub(template_re, r'\1%s\3' % ss, fileName)
        else:
            template = fileName

        master.rowconfigure(0, weight=1)
        master.rowconfigure(1, weight=1)
        master.columnconfigure(1, weight=1)

        tipTexts = [
            'The experiment is pseudo-N dimensional, with a sampled axis',
            'The experiment is the regular kind with only NMR frequency axes'
        ]
        self.pseudoButton = RadioButtons(
            master,
            entries=self.pseudoEntries,
            select_callback=self.changedPseudoMode,
            grid=(0, 0),
            sticky='nw',
            tipTexts=tipTexts)

        frame = self.pseudoFrame = Frame(master)
        self.pseudoFrame.grid(row=1, column=0, sticky='nsew')

        row = 0
        npts = self.params.npts[self.dim]
        tipText = 'Number of data points (planes) along sampled axis'
        label = Label(frame, text='Number of points: ')
        label.grid(row=row, column=0, sticky='e')
        self.nptsEntry = IntEntry(frame,
                                  text=npts,
                                  tipText=tipText,
                                  width=8,
                                  grid=(row, 1))

        tipText = 'Load the values for the sampled axis from a text file containing a list of numeric values'
        Button(frame,
               text='Load values from text file',
               command=self.loadValues,
               tipText=tipText,
               grid=(row, 2),
               sticky='ew')

        row = row + 1
        tipText = 'The values (e.g. T1, T2) corresponding to each data point (plane) along sampled axis'
        label = Label(frame, text='Point values: ')
        label.grid(row=row, column=0, sticky='e')
        self.valueEntry = FloatEntry(frame, isArray=True, tipText=tipText)
        self.valueEntry.grid(row=row, column=1, columnspan=2, sticky='ew')

        row = row + 1
        tipText = 'Fetch the Point values from the files given by the NMRPipe template'
        button = Button(
            frame,
            text='Fetch values from file(s) specified by template below',
            command=self.fetchValues,
            tipText=tipText)
        button.grid(row=row, column=1, columnspan=2, sticky='w')

        row = row + 1
        tipText = 'The directory where the data files reside'
        button = Button(frame,
                        text='Data directory: ',
                        command=self.chooseDirectory)
        button.grid(row=row, column=0, sticky='e')
        self.directoryEntry = Entry(frame,
                                    text=directory,
                                    width=40,
                                    tipText=tipText)
        self.directoryEntry.grid(row=row, column=1, columnspan=2, sticky='ew')

        row = row + 1
        tipText = 'The NMRPipe template for the data files, if you want to use these to fetch the point values from'
        button = Button(frame,
                        text='NMRPipe template: ',
                        command=self.chooseFile)
        button.grid(row=row, column=0, sticky='e')
        self.templateEntry = Entry(frame, text=template, tipText=tipText)
        self.templateEntry.grid(row=row, column=1, columnspan=2, sticky='ew')

        for n in range(row):
            frame.rowconfigure(n, weight=1)
        frame.columnconfigure(1, weight=1)

        buttons = UtilityButtonList(master,
                                    closeText='Ok',
                                    doClone=False,
                                    closeCmd=self.updateParams,
                                    helpUrl=self.help_url)
        buttons.grid(row=2, column=0, sticky='ew')
Exemplo n.º 22
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)
Exemplo n.º 23
0
class EditPeakPopup(BasePopup):
    """
  **Edit Position, Intensity & Details for a Peak**
  
  This popup window provides an means of editing peak information as an
  alternative to editing values in the main peak tables. This popup is also used
  to specify parameters for when a new peak is explicitly added to a peak list
  using a tabular display.

  The user can specify the position of the peak's dimensions in ppm, Hz or data
  point units. Also, the user can adjust the height and volume peak intensity
  values and a textual "Details" field, ,which can carry the user's comments
  about the peak.

  When editing an existing peak, no changes are made to the peak until the
  [Update] button is pressed. Likewise for a new peak the [Add Peak] button
  commits the changes. If the popup window is closed before the changes are 
  committed then the entire editing or peak addition operation is cancelled.

  """
    def __init__(self, parent, peak=None, peakList=None, *args, **kw):

        self.titleColor = '#000080'
        self.numDims = 0
        self.peak = peak

        kw['borderwidth'] = 6
        BasePopup.__init__(self, parent=parent, title='Edit Peak', **kw)

        self.registerNotify(self.deletedPeak, 'ccp.nmr.Nmr.Peak', 'delete')

        for func in ('setAnnotation', 'setDetails', 'setFigOfMerit'):
            self.registerNotify(self.updatePeak, 'ccp.nmr.Nmr.Peak', func)
        for func in ('setAnnotation', 'setPosition', 'setNumAliasing'):
            self.registerNotify(self.updatePeak, 'ccp.nmr.Nmr.PeakDim', func)
        for func in ('__init__', 'delete', 'setValue'):
            self.registerNotify(self.updatePeak, 'ccp.nmr.Nmr.PeakIntensity',
                                func)

        self.dimensionLabels = []
        self.dimensionEntries = []
        self.update(self.peak, peakList)

    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)

    def open(self):

        self.updatePeak()
        BasePopup.open(self)

    def updatePeak(self, object=None):

        peak = None
        if object:
            if object.className == 'Peak':
                peak = object
            elif object.className == 'PeakDim':
                peak = object.peak
            elif object.className == 'PeakIntensity':
                peak = object.peak

        if (peak is None) or (peak is self.peak):
            self.update(peak=self.peak)

    def update(self, peak=None, peakList=None):

        # first destroy old labels and entries (saves grid hassles)

        for label in self.dimensionLabels:
            label.destroy()
        for entry in self.dimensionEntries:
            entry.destroy()

        # now setup required data

        if peak:
            title = 'Edit Peak'
            self.buttons.buttons[0].config(text='Update')
        else:
            title = 'Add Peak'
            self.buttons.buttons[0].config(text='Add Peak')

        self.setTitle(title)

        self.peak = peak
        self.peakList = peakList
        if not peakList:
            if peak:
                self.peakList = peak.peakList
            else:
                return

        peakList = self.peakList
        spectrum = peakList.dataSource.name
        self.numDims = peakList.dataSource.numDim
        self.posn = self.numDims * [0]
        self.dataDims = peakList.dataSource.sortedDataDims()

        if self.peak:

            serial = self.peak.serial
            dims = self.peak.sortedPeakDims()
            details = self.peak.details
            if not details:
                details = ''
            if self.peak.annotation:
                annotn = '%0.16s' % self.peak.annotation
            else:
                annotn = ''

            heightIntensity = self.peak.findFirstPeakIntensity(
                intensityType='height')
            volumeIntensity = self.peak.findFirstPeakIntensity(
                intensityType='volume')

            if heightIntensity:
                height = heightIntensity.value
            else:
                height = 0.0

            if volumeIntensity:
                volume = volumeIntensity.value
            else:
                volume = 0.0

            for i in range(self.numDims):
                peakDim = dims[i]
                dataDimRef = peakDim.dataDimRef
                if dataDimRef:
                    self.posn[i] = peakDim.position + (
                        peakDim.numAliasing * dataDimRef.dataDim.numPointsOrig)
                else:
                    self.posn[i] = peakDim.position

        else:

            dict = peakList.__dict__.get('serialDict')
            if dict is None:
                serial = 1
            else:
                serial = dict.get('peaks', 0) + 1

            height = 0.0
            volume = 0.0
            details = ''
            annotn = ''

        self.specLabel.set(
            text='Experiment: %s Spectrum: %s PeakList: %d' %
            (peakList.dataSource.experiment.name, spectrum, peakList.serial))
        self.peakLabel.set(text='Peak: %d' % serial)

        self.dimensionLabels = self.numDims * ['']
        self.dimensionEntries = self.numDims * ['']
        for i in range(self.numDims):
            pos = self.posn[i]
            if self.unit != 'point':
                dataDim = self.dataDims[i]
                if dataDim.className == 'FreqDataDim':
                    pos = unit_converter[('point', self.unit)](
                        pos, getPrimaryDataDimRef(dataDim))
            self.dimensionLabels[i] = Label(self.master_frame,
                                            text='F%d' % (i + 1),
                                            borderwidth=2,
                                            relief='groove')
            tipText = 'The peak position in dimension %d, in the specified units' % (
                i + 1)
            self.dimensionEntries[i] = FloatEntry(self.master_frame,
                                                  borderwidth=1,
                                                  text='%8.4f' % pos,
                                                  tipText=tipText)

        self.heightEntry.set(text='%f' % height)
        self.volumeEntry.set(text='%f' % volume)
        self.detailEntry.set(text=details)

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

        row = row + 1
        self.peakLabel.grid(row=row, column=0, sticky='nsew')
        self.unit_frame.grid(row=row, column=1, columnspan=2, sticky='nsew')

        for i in range(self.numDims):
            row = row + 1
            self.dimensionLabels[i].grid(row=row, column=0, sticky='nsew')
            self.dimensionEntries[i].grid(row=row,
                                          column=1,
                                          columnspan=3,
                                          sticky='e')

        row = row + 1
        self.heightLabel.grid(row=row, column=0, sticky='nsew')
        self.heightEntry.grid(row=row, column=1, columnspan=3, sticky='e')

        row = row + 1
        self.volumeLabel.grid(row=row, column=0, sticky='nsew')
        self.volumeEntry.grid(row=row, column=1, columnspan=3, sticky='e')

        row = row + 1
        self.detailLabel.grid(row=row, column=0, sticky='nsew')
        self.detailEntry.grid(row=row, column=1, columnspan=3, sticky='e')

        row = row + 1
        self.buttons.grid(row=row, column=0, columnspan=4, sticky='nsew')

    def changeUnit(self, unit):

        posDisp = self.numDims * [None]
        for i in range(self.numDims):
            posDisp[i] = float(self.dimensionEntries[i].get())
            if self.unit != 'point':
                dataDim = self.dataDims[i]
                if dataDim.className == 'FreqDataDim':
                    posDisp[i] = unit_converter[(self.unit, 'point')](
                        posDisp[i], getPrimaryDataDimRef(dataDim))

        self.unit = unit
        if self.unit != 'point':
            for i in range(self.numDims):
                dataDim = self.dataDims[i]
                if dataDim.className == 'FreqDataDim':
                    posDisp[i] = unit_converter[('point', self.unit)](
                        posDisp[i], getPrimaryDataDimRef(dataDim))

        for i in range(self.numDims):
            value = posDisp[i]
            if value is None:
                self.dimensionEntries[i].set('None')
            else:
                self.dimensionEntries[i].set('%8.4f' % posDisp[i])

    def commit(self):

        posDisp = self.numDims * [0]

        for i in range(self.numDims):
            posDisp[i] = float(self.dimensionEntries[i].get())
            if self.unit != 'point':
                dataDim = self.dataDims[i]
                if dataDim.className == 'FreqDataDim':
                    self.posn[i] = unit_converter[(self.unit, 'point')](
                        posDisp[i], getPrimaryDataDimRef(dataDim))

            else:
                self.posn[i] = posDisp[i]

        if self.peak:
            movePeak(self.peak, self.posn)
        else:
            self.peak = pickPeak(self.peakList, self.posn)

        height = self.heightEntry.get()
        volume = self.volumeEntry.get()
        setManualPeakIntensity(self.peak, height, intensityType='height')
        setManualPeakIntensity(self.peak, volume, intensityType='volume')

        details = self.detailEntry.get() or None

        self.peak.setDetails(details)

        self.close()

    def deletedPeak(self, peak):

        if self.peak is peak:
            self.close()

    def destroy(self):

        self.unregisterNotify(self.deletedPeak, 'ccp.nmr.Nmr.Peak', 'delete')

        for func in ('setAnnotation', 'setDetails', 'setFigOfMerit'):
            self.unregisterNotify(self.updatePeak, 'ccp.nmr.Nmr.Peak', func)
        for func in ('setAnnotation', 'setPosition', 'setNumAliasing'):
            self.unregisterNotify(self.updatePeak, 'ccp.nmr.Nmr.PeakDim', func)
        for func in ('__init__', 'delete', 'setValue'):
            self.unregisterNotify(self.updatePeak, 'ccp.nmr.Nmr.PeakIntensity',
                                  func)

        BasePopup.destroy(self)
Exemplo n.º 24
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()
Exemplo n.º 25
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)
Exemplo n.º 26
0
class EditContourFilesPopup(BasePopup):
    """
  **Manage Contour Files in Project**

  The purpose of this dialog is to allow the user to manage contour files.
  A contour file stores contours calculated at specified contour levels in
  a specified region of a spectrum, as an alternative to calculating contours
  on the fly.  You cannot pick peaks using contour files but after peaks have
  been picked, contour files are a reasonable alternative to contours for large
  3D and 4D data sets, since the spectrum data does not need to be read from disk.

  This dialog lists the contour files that are in the project.  To create a
  new contour file click on the "Create New File" button and to add a contour
  file that already exists on disk (e.g. from another project) then click on
  the "Find Existing File" button.

  When a contour file is created for a spectrum then by default it is used to
  display contours rather than having them calculated on the fly.  This can be
  changed in the main `Spectra`_ dialog in the Display Options tab.

  See also: `Creating Contour Files`_, `Add Existing Contour Files`_.

  .. _`Spectra`: EditSpectrumPopup.html
  .. _`Creating Contour Files`: CreateContourFilePopup.html
  .. _`Add Existing Contour Files`: AddContourFilePopup.html
"""
    def __init__(self, parent, *args, **kw):

        self.waiting = False
        self.contourFileDir = None

        BasePopup.__init__(self,
                           parent=parent,
                           title='Spectrum Contour Files',
                           **kw)

    def body(self, master):

        self.geometry('650x200')

        master.grid_columnconfigure(0, weight=1)

        row = 0
        master.grid_rowconfigure(row, weight=1)
        self.storedContourTable = None
        headings = ('#', 'Experiment', 'Spectrum', 'Dims', 'Directory', 'File')
        ###self.urlWidget = Entry(self, returnCallback=self.setUrl, width=10)
        ###self.pathWidget   = Entry(self, returnCallback=self.setPath, width=10)
        ###editWidgets = [ None, None, None, None, self.urlWidget, self.pathWidget ]
        ###editGetCallbacks = [ None, None, None, None, self.getUrl, self.getPath ]
        ###editSetCallbacks = [ None, None, None, None, self.setUrl, self.setPath ]
        tipTexts = [
            'Row number',
            'The experiment that contains the spectrum to which the contour file relates',
            'The spectrum to which the contour file relates',
            'The projected spectrum dimensions which are represented by the contour file, i.e. to form the X-Y plane of the screen',
            'Directory in which the contour file is saved',
            'The name of the file in which contours for thei spectrum projection are saved'
        ]
        editWidgets = 6 * [None]
        editGetCallbacks = 6 * [None]
        editSetCallbacks = 6 * [None]
        self.storedContourTable = ScrolledMatrix(
            master,
            headingList=headings,
            callback=self.setButtonState,
            editWidgets=editWidgets,
            multiSelect=True,
            editGetCallbacks=editGetCallbacks,
            editSetCallbacks=editSetCallbacks,
            deleteFunc=self.deleteContourFile,
            tipTexts=tipTexts)
        self.storedContourTable.grid(row=row, column=0, sticky='nsew')
        row = row + 1

        tipTexts = [
            'Locate an exiting file on disk and use that as a spectrum contour file',
            'Create a new spectrum contour file; requires that the spectrum data matrix is accessible',
            'Remove the selected contour file from the CCPN project and optionally delete the file from disk'
        ]
        texts = ['Find Existing File', 'Create New File', 'Delete']
        commands = [
            self.addContourFile, self.createContourFile, self.deleteContourFile
        ]
        self.buttons = UtilityButtonList(master,
                                         texts=texts,
                                         doClone=False,
                                         commands=commands,
                                         helpUrl=self.help_url)
        self.buttons.grid(row=row, column=0, sticky='ew')

        self.updateAfter()

        for clazz in ('ccp.nmr.Nmr.Experiment', 'ccp.nmr.Nmr.DataSource'):
            self.registerNotify(self.updateAfter, clazz, 'setName')

        for func in ('__init__', 'delete', ''):
            self.registerNotify(self.updateAfter,
                                'ccpnmr.Analysis.StoredContour', func)

        ###self.registerNotify(self.updateAfter, 'memops.Implementation.Url', 'setPath')

    def open(self):

        self.updateAfter()
        BasePopup.open(self)

    def destroy(self):

        for clazz in ('ccp.nmr.Nmr.Experiment', 'ccp.nmr.Nmr.DataSource'):
            self.registerNotify(self.updateAfter, clazz, 'setName')

        for func in ('__init__', 'delete', ''):
            self.unregisterNotify(self.updateAfter,
                                  'ccpnmr.Analysis.StoredContour', func)

        ###self.unregisterNotify(self.updateAfter, 'memops.Implementation.Url', 'setPath')

        BasePopup.destroy(self)

    def updateAfter(self, *extra):

        if self.waiting:
            return
        else:
            self.waiting = True
            self.after_idle(self.update)

    def update(self):

        self.updateStoredContourTable()
        self.setButtonState()
        self.waiting = False

    def updateStoredContourTable(self, *extra):

        analysisSpectra = self.analysisProject.analysisSpectra

        objectList = []
        textMatrix = []
        n = 0
        for analysisSpectrum in analysisSpectra:
            spectrum = analysisSpectrum.dataSource
            for storedContour in analysisSpectrum.storedContours:
                if storedContour.isDeleted:
                    continue

                n = n + 1
                dims = ', '.join(['%d' % dim for dim in storedContour.dims])

                text = [
                    n, spectrum.experiment.name, spectrum.name, dims,
                    analysisSpectrum.contourDir.dataLocation,
                    storedContour.path
                ]

                objectList.append(storedContour)
                textMatrix.append(text)

        self.storedContourTable.update(objectList=objectList,
                                       textMatrix=textMatrix)

    """
  def getUrl(self, storedContour):

    self.urlWidget.set(storedContour.url.path)

  def setUrl(self, *extra):

    storedContour = self.getStoredContour()
    if not storedContour:
      return
    
    path = self.urlWidget.get()
    if not path:
      return

    url = storedContour.url
    project = self.project
    analysisProject = self.analysisProject
    if len(analysisProject.findAllStoredContours(url=url)) > 1 or \
        project.findAllStorages(url=url) or project.findAllDataLocations(url=url):
      # create a new url with new path
      url = project.newUrl(name='storedContourUrl', path=path)
    else:
      # just change url path since (hopefully) nobody else is using it
      try:
        url.path = path
      except Implementation.ApiError, e:
        showError('Setting url path', e.error_msg, parent=self)

  def getPath(self, storedContour):

    self.pathWidget.set(storedContour.path)

  def setPath(self, *extra):

    storedContour = self.getStoredContour()
    if not storedContour:
      return
    
    path = self.pathWidget.get()
    if not path:
      return

    try:
      storedContour.path = path
    except Implementation.ApiError, e:
      showError('Setting stored contour path', e.error_msg, parent=self)
"""

    def setButtonState(self, *extra):

        if self.storedContourTable.objectList:
            state = 'normal'
        else:
            state = 'disabled'

        self.buttons.buttons[2].config(state=state)

    def getSpectrum(self):

        storedContour = self.getStoredContour()
        if storedContour:
            try:
                spectrum = storedContour.dataSource
            except:
                spectrum = None
        else:
            spectrum = None

        return spectrum

    def getStoredContour(self):

        if self.storedContourTable:
            storedContour = self.storedContourTable.currentObject
            if storedContour and storedContour.isDeleted:
                storedContour = None
        else:
            storedContour = None

        return storedContour

    def getStoredContours(self):

        if (self.storedContourTable):
            storedContours = self.storedContourTable.currentObjects

        return storedContours

    def addContourFile(self, *extra):

        spectrum = self.getSpectrum()
        self.parent.addSpectrumContourFile(spectrum)

    def createContourFile(self, *extra):

        spectrum = self.getSpectrum()
        self.parent.createSpectrumContourFile(spectrum)

    def deleteContourFile(self, *extra):

        storedContours = self.getStoredContours()
        if not storedContours:
            return

        if len(storedContours) == 1:
            s = t = ''
        else:
            s = ' %d ' % len(storedContours)
            t = 's'
        if (showYesNo(
                'Delete stored contour%s from project' % t,
                'Are you sure you want to delete selected %sstored contour%s from the project?'
                % (s, t),
                parent=self)):
            if (showYesNo(
                    'Delete underlying contour file%s on disk' % t,
                    'Do you also want to delete underlying contour file%s on disk (normally yes)?'
                    % t,
                    parent=self)):
                for storedContour in storedContours:
                    path = storedContour.fullPath
                    try:
                        os.remove(path)
                    except:
                        print 'Warning: could not remove %s' % path
            for storedContour in storedContours:
                storedContour.delete()
Exemplo n.º 27
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)
Exemplo n.º 28
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)
Exemplo n.º 29
0
  def body(self, guiFrame):
    
    self.geometry("775x500")
    guiFrame.expandGrid(0,0)
    
    options = ['1D Graphs','Amino Acid CA CB']
    tipTexts = ['Simple graphs of how chemical shift values are distributed for a given atom type',
                'Density plots of alpha a & beta carbon shift distributions for common amnio acids']
    tabbedFrame = TabbedFrame(guiFrame, options=options, grid=(0,0), tipTexts=tipTexts)
    frameA, frameB = tabbedFrame.frames
    
    # # # # # # #  1D GRAPHS  # # # # # # # 
    
 
    row = 0
     
    MolType = self.project.metaclass.metaObjFromQualName('ccp.molecule.ChemComp.MolType')
    molTypes = MolType.enumeration
    molTypes.remove('other')
    molTypes.remove('carbohydrate')
   
    self.molType = 'protein'
    
    ccpCodes = self.getCcpCodes(self.molType) or [None,]
    self.ccpCode = 'Ala'
    
    self.atomType = ATOM_TYPES[0]
    
    self.atomNamesDict = {}
    self.chemAtomNmrRefs = self.getCcpCodeData(self.ccpCode, atomType=self.atomType)
    
    
    tipText = 'Which of the common bio-polymer types to show data for'
    self.molTypeLabel     = Label(frameA, text = 'Molecule Type:', grid=(row,0))
    self.molTypePulldown  = PulldownList(frameA, callback=self.changeMolType,
                                         texts=molTypes, grid=(row,1), tipText=tipText)

    tipText = 'Which residue code to show chemical shift distributions for'
    self.ccpCodeLabel     = Label(frameA, text = 'Residue Code:', grid=(row,2))
    self.ccpCodePulldown  = PulldownList(frameA, callback=self.changeCcpCode, texts=ccpCodes,
                                         index=ccpCodes.index(self.ccpCode), 
                                         grid=(row,3), tipText=tipText)

    tipText = 'Whether to show distributions for hydrogen atoms or other atoms'
    self.atomTypeLabel    = Label(frameA, text = 'Atom Type:', grid=(row,4))
    self.atomTypePulldown = PulldownList(frameA, callback=self.changeAtomType,
                                         texts=ATOM_TYPES, tipText=tipText,
                                         grid=(row,5))

    row += 1

    tipText = 'The selection of atom name to display distributions for'
    self.atomSelector = PartitionedSelector(frameA, self.toggleAtom,
                                            tipText=tipText, maxRowObjects=20)
    self.atomSelector.grid(row=row, column=0, columnspan=6, sticky='ew')

    row += 1

    frameA.expandGrid(row,5)
    self.scrolledGraph = ScrolledGraph(frameA, symbolSize=2, reverseX=True, width=650,
                                       height=300, title='Chemical shift distribution',
                                       xLabel='Chemical shift', yLabel='proportion',
                                       motionCallback=self.updateCrosshairs)
    self.scrolledGraph.grid(row=row, column=0, columnspan=6, sticky='nsew')
    
    # # # # # # #  PROTEIN CA CB   # # # # # # # 
    
    frameB.expandGrid(0,0)
    matrix, ppms = self.getCaCbMatrix()
    title = 'Amino Acid CA & CB Chemical Shifts'
    self.cacbMatrix = ScrolledDensityMatrix(frameB, matrix=matrix, boxSize=14,
                                            title=title,
                                            xLabels=ppms, yLabels=AMINO_ACIDS,
                                            borderColor='grey', zoom=1.0,
                                            labelAxes=True, barPlot=False,
                                            doLegend=False, grid=(0,0))
    
    sdm = self.cacbMatrix
    font = sdm.boldFont
    
    x0, y0 = (470,370)
    sdm.canvas.create_rectangle(x0+170,y0-6,x0+182,y0+6,fill='#4040A0',
                                outline=sdm.borderColor, width=1)
    sdm.canvas.create_text(x0+200, y0, text='CA', font=font)
    sdm.canvas.create_rectangle(x0+220,y0-6,x0+232,y0+6,fill='#A04040',
                                outline=sdm.borderColor, width=1)
    sdm.canvas.create_text(x0+250, y0, text='CB', font=font)
    sdm.canvas.create_text(x0, y0, text='13C PPM +/- 0.5', font=font)
    
    # # # # # # #  M A I N   # # # # # # # 
    
    tipText = 'Whether to use chemical shift data from the BMRB (unfiltered) or RefDB sets'
    label = Label(tabbedFrame.sideFrame, text='Source Database:', grid=(0,0), sticky='e')
    index = SOURCE_NAMES.index(self.sourceName)
    self.sourcePulldown = PulldownList(tabbedFrame.sideFrame, self.changeSource,
                                       texts=SOURCE_NAMES, index=index, 
                                       grid=(0,1), sticky='e', tipText=tipText)

    self.bottomButtons = UtilityButtonList(tabbedFrame.sideFrame, expands=True,
                                           helpUrl=self.help_url, sticky='e',
                                           grid=(0,2))
                                               
    self.waiting = False
    self.updateAfter()

    for func in ('__init__', 'delete'):
      self.registerNotify(self.updateAfter, 'ccp.nmr.NmrReference.NmrReferenceStore', func)
Exemplo n.º 30
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)
Exemplo n.º 31
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)