예제 #1
0
  def updateWindows(self, obj=None):

    index = 0
    windowPane = self.windowPulldown.getObject()
    windowPanes = []
    names = []
    
    if not windowPane:
      application = self.project.application
      name = application.getValue(self.analysisProject, keyword='printWindowWindow')
      window = self.analysisProject.findFirstSpectrumWindow(name=name)
      if window:
        windowPane = window.findFirstSpectrumWindowPane()
     

    for window in self.analysisProject.sortedSpectrumWindows():
      for windowPane0 in window.sortedSpectrumWindowPanes():
        windowPanes.append(windowPane0)
        names.append(getWindowPaneName(windowPane0))
    
    if windowPanes:
      if windowPane not in windowPanes:
        windowPane = windowPanes[0]
      
      index = windowPanes.index(windowPane)  
    
    else:
      windowPane = None
      
    self.selectWindow(windowPane)
        
    self.windowPulldown.setup(names, windowPanes, index)
예제 #2
0
    def updateWindows(self, window=None):

        windowPanes = self.getWindows()
        index = -1
        names = [getWindowPaneName(wp) for wp in windowPanes]
        windowPane = self.windowPane

        if windowPanes:
            if windowPane not in windowPanes:
                windowPane = windowPanes[0]

            index = windowPanes.index(windowPane)

        if windowPane is not self.windowPane:
            self.windowPane = windowPane
            self.windowPaneNavigate()

        self.windowPanePulldown.setup(names, windowPanes, index)
예제 #3
0
  def updateWindows(self, obj=None):

    useAll = (self.whichWindows.get() == ACTIVE_OPTIONS[0])
    
    index = 0
    windowPane = self.windowPulldown.getObject()
    windowPanes = []
    names = []
    
    if not windowPane:
      application = self.project.application
      name = application.getValue(self.analysisProject, keyword='printWindowWindow')
      if useAll:
        window = self.analysisProject.findFirstSpectrumWindow(name=name)
        if window:
          windowPane = window.findFirstSpectrumWindowPane()
      else:
        for window in self.analysisProject.sortedSpectrumWindows():
          if isActiveWindow(window):
            windowPane = window.findFirstSpectrumWindowPane()
            break
        else:
          window = None

    for window in self.analysisProject.sortedSpectrumWindows():
      if useAll or isActiveWindow(window):
        for windowPane0 in window.sortedSpectrumWindowPanes():
          windowPanes.append(windowPane0)
          names.append(getWindowPaneName(windowPane0))
    
    if windowPanes:
      if windowPane not in windowPanes:
        windowPane = windowPanes[0]
      
      index = windowPanes.index(windowPane)  
    
    else:
      windowPane = None
      
    self.selectWindow(windowPane)
        
    self.windowPulldown.setup(names, windowPanes, index)
예제 #4
0
    def updateWindows(self, *object):

        panes = self.getWindows()
        index = 0
        names = []
        pane = self.windowPane

        if panes:
            names = [getWindowPaneName(wp) for wp in panes]

            if pane not in panes:
                pane = panes[0]

            index = panes.index(pane)

        if pane is not self.windowPane:
            self.windowPane = pane
            self.updatePeakLists()

        self.windowPulldown.setup(names, panes, index)
예제 #5
0
    def updateWindowList(self):

        index = 0
        names = []
        windowPane = self.windowPane
        windowPanes = self.getWindows()

        if windowPanes:
            names = [getWindowPaneName(wp) for wp in windowPanes]
            if windowPane not in windowPanes:
                windowPane = windowPanes[0]

            index = windowPanes.index(windowPane)

        else:
            windowPane = None

        if windowPane is not self.windowPane:
            self.selectWindowPane(windowPane)

        self.windowPulldown.setup(names, windowPanes, index)
예제 #6
0
  def body(self, master):

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

    view = self.spectrumWindowView
    spectrum = view.analysisSpectrum.dataSource
    dataDims = spectrum.sortedDataDims()
    
    self.ndim = spectrum.numDim
    self.prev_label = self.ndim * [ None ]
    self.redraw = False

    row = 0
    label = Label(master, text='Window:')
    label.grid(row=row, column=0, sticky='w')
    
    name = getWindowPaneName(self.spectrumWindowView.spectrumWindowPane)
    tipText = 'The name of the window where the dimension mapping is changing '
    label = Label(master, text=name, tipText=tipText)
    label.grid(row=row, column=1, sticky='w')

    row += 1
    label = Label(master, text='Experiment:')
    label.grid(row=row, column=0, sticky='w')
    tipText = 'The NMR experiment to change dimension mapping for'
    label = Label(master, text=spectrum.experiment.name, tipText=tipText)
    label.grid(row=row, column=1, sticky='w')

    row += 1
    label = Label(master, text='Spectrum:')
    label.grid(row=row, column=0, sticky='w')
    tipText = 'The spectrum data to change the dimension mapping for'
    label = Label(master, text=spectrum.name, tipText=tipText)
    label.grid(row=row, column=1, sticky='w')

    self.axis_lists = self.ndim * [0]
    for n in range(self.ndim):
      row += 1
      callback = lambda entry_index, entry, dim=n: self.callback(dim, entry)
      dataDim = dataDims[n]
      axisMapping = findDataDimAxisMapping(view, dataDim)
      entries = self.validAxisLabels(dataDim)
      selected = axisMapping.label
      if selected not in entries:
        label = Label(master, text='Dimension %d:\n(sampled)' % (n+1,))
        label.grid(row=row, column=0, sticky='w')
      else:
        label = Label(master, text='Dimension %d:' % (n+1,))
        label.grid(row=row, column=0, sticky='w')
        selected_index = entries.index(selected)
        tipText = 'Selects which numbered spectrum dimension goes with which window axis'
        self.axis_lists[n] = PulldownMenu(master, callback=callback,
                                          entries=entries, tipText=tipText,
                                          selected_index=selected_index)
        self.axis_lists[n].grid(row=row, column=1, sticky='w')

    row += 1
    texts = commands = []
    tipTexts = ['Commit any changes to the spectrum dimension to window axis mapping and close the popup',]
    texts = [ ' Commit ',]
    commands = [ self.ok,]
    buttons = UtilityButtonList(master, texts=texts, tipTexts=tipTexts,
                                commands=commands, doClone=False,
                                helpUrl=self.help_url)
    buttons.grid(row=row, column=0, columnspan=2, sticky='ew')