Пример #1
0
  def body(self, master):
    
    #
    # Popup window
    #

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

    row = row + 1
    self.multiSelect = ScrolledListbox(master,
                                       width = 50,
	                                      height = 5,
	                                      selectmode = Tkinter.MULTIPLE,
                                       initial_list = self.selectionList)
    self.multiSelect.grid(row=row, column=0, sticky=Tkinter.E, ipadx = 20)
    master.grid_columnconfigure(0, weight=1)
    master.grid_rowconfigure(row, weight=1)
    
    if self.selectedItems:
      self.multiSelect.setSelectedItems(self.selectedItems)
 
    if self.endText:
      row = row + 1
      label = Label(master, text= self.endText)
      label.grid(row=row, column=0, sticky=Tkinter.EW)
 
    row = row + 1
    texts = [ 'OK' ]
    commands = [ self.ok ]   # This calls 'ok' in BasePopup, this then calls 'apply' in here
    buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text = self.dismissText, help_url=self.help_url)
    buttons.grid(row=row, column=0)
Пример #2
0
    def body(self, master):

        if self.infoList:
            columnspan = 2
        else:
            columnspan = 1

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

        if self.infoList:
            for infoListItem in self.infoList:

                row = row + 1

                label = Label(master, text=infoListItem)
                label.grid(row=row, column=0, sticky=Tkinter.E)

                value = self.infoDict[infoListItem]

                if type(value) == type(''):
                    value = "[" + value + "]"
                else:
                    value = str(value)

                label = Label(master, text=value)
                label.grid(row=row, column=1, sticky=Tkinter.W)

        row = row + 1

        button = createDismissButton(master,
                                     dismiss_text='Continue',
                                     dismiss_cmd=self.destroy)
        button.grid(row=row, column=0, columnspan=columnspan)
Пример #3
0
  def body(self, guiFrame):

    ProgressBar.body(self, guiFrame)
    guiFrame.expandGrid(2,3)
    
    self.stepLabel = Label(guiFrame, text='Best step:  ', grid=(0,3))

    
    frame = LabelFrame(guiFrame, text='Best mappings', grid=(1,0), gridSpan=(1,4))

    row = 0
    for i in range(self.ensembleSize):
      label = Label(frame, text='', pady=0, font='Courier 10',
                    borderwidth=0, grid=(row,0), sticky='ew')
      self.labels.append(label)
      row +=1

    guiFrame.grid_rowconfigure(2, weight=1)
    self.graph = ScrolledGraph(guiFrame, width=450, height=300,
                               graphType='scatter', title='Typing Scores',
                               xLabel='Spin System', yLabel='Score',
                               grid=(2,0), gridSpan=(1,4))


    self.buttonList = ButtonList(guiFrame, texts=['Close',], commands=[self.done],
                                 grid=(3,0), gridSpan=(1,4))
    self.buttonList.buttons[0].disable() 
Пример #4
0
    def __init__(self,
                 parent,
                 label1,
                 label2='',
                 separator=': ',
                 label1_width=20,
                 label2_width=60,
                 label1_anchor=Tkinter.E,
                 label2_anchor=Tkinter.W,
                 *args,
                 **kw):

        apply(Frame.__init__, (self, parent) + args, kw)

        self.grid_columnconfigure(1, weight=1)

        self.separator = separator

        text = label1 + self.separator
        self.label1 = Label(self,
                            text=text,
                            width=label1_width,
                            anchor=label1_anchor)
        self.label1.grid(row=0, column=0, sticky=Tkinter.EW)

        text = label2
        self.label2 = Label(self,
                            text=text,
                            width=label2_width,
                            anchor=label2_anchor)
        self.label2.grid(row=0, column=1, sticky=Tkinter.EW)
Пример #5
0
    def body(self, parent):

        self.bw = 2  # borderwidth
        width = self.cWidth + self.bw
        height = self.cHeight + self.bw
        self.label = Label(parent, text=self.text)
        self.label.grid(row=0, column=0, sticky=Tkinter.W)
        self.percent = Label(parent, text='    %')
        self.percent.grid(row=0, column=2, sticky=Tkinter.W)
        self.canvas = Canvas(parent,
                             background='grey70',
                             width=width,
                             height=height)
        self.canvas.grid(row=0, column=1, sticky=Tkinter.W)
        self.canvas.create_rectangle(0,
                                     0,
                                     width,
                                     height,
                                     outline='black',
                                     width=self.bw)
        self.bar = self.canvas.create_rectangle(self.bw,
                                                self.bw,
                                                self.bw,
                                                self.cHeight,
                                                outline='#B05848',
                                                fill='#B05848',
                                                width=self.bw)
        self.update()
Пример #6
0
    def createKey(self, key):

        attr = key[-1]
        s = attr.name

        if (len(key) > 1):
            if (type(key[-2]) == type(0)):
                role = key[-3]
                n = key[-2]
                t = '%s[%d]' % (role.otherClass.name, n)
            else:
                role = key[-2]
                t = role.otherClass.name
        else:
            t = self.metaclass.name

        title_label = Label(self.parent_frame)
        class_label = Label(self.parent_frame, text=t, anchor=Tkinter.W)
        name_label = Label(self.parent_frame,
                           text=s,
                           anchor=Tkinter.W,
                           bg=name_bg)
        value_label = Label(self.parent_frame, anchor=Tkinter.W, bg=value_bg)

        self.widget_dict[key] = (title_label, class_label, name_label,
                                 value_label)
Пример #7
0
  def body(self, master):
    
    #
    # Popup window
    #

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

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

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

    buttons.grid(row=row, column=0, columnspan = 3)
Пример #8
0
  def __init__(self, parent, analysis, orientation='horizontal', callback = None, *args, **kw):

    self.analysis = analysis
    self.callback = callback

    apply(Frame.__init__, (self, parent) + args, kw)

    label = Label(self, text='Experiment:')
    label.grid(row=0, column=0, sticky='ne')
    self.expt_list = ExperimentList(self, self.analysis.getExperiments,
                                    callback=self.setSpectra)
    self.expt_list.grid(row=0, column=1, sticky='nw')
 
    if orientation in ['horizontal','h','H',Tkinter.HORIZONTAL]:
      row = 0
      col = 2
    else:
      row = 1
      col = 0
    
    label = Label(self, text='Spectrum:')
    label.grid(row=row, column=col, sticky='ne')
    self.spectrum_list = SpectrumList(self, self.getSpectra,
                                      callback=self.setSpectrumProperties)
    self.spectrum_list.grid(row=row, column=col+1, sticky='nw')

    for func in notify_funcs:
      Implementation.registerNotify(self.setExperiments, 'ccp.nmr.Nmr.Experiment', func)
      Implementation.registerNotify(self.setSpectra, 'ccp.nmr.Nmr.DataSource', func)
Пример #9
0
    def body(self, master):

        #
        # Popup gui
        #

        # First row
        row = 0
        label = Label(master, text="Choose a naming system:")
        label.grid(row=row, column=0, sticky=Tkinter.W)

        row = row + 1
        label = Label(master, text="(% matches in brackets)")
        label.grid(row=row, column=0, sticky=Tkinter.W)

        row = row + 1
        self.menu = PulldownMenu(master, entries=self.namingSysList)
        self.menu.grid(row=row, column=0, sticky=Tkinter.EW)

        row = row + 1
        texts = ['OK']
        commands = [
            self.ok
        ]  # This calls 'ok' in BasePopup, this then calls 'apply' in here
        buttons = createDismissHelpButtonList(master,
                                              texts=texts,
                                              commands=commands,
                                              dismiss_text='Exit',
                                              help_url=self.help_url)
        buttons.grid(row=row, column=0)
Пример #10
0
    def body(self, master):

        master.grid_columnconfigure(0, weight=1)
        for i in range(3):
            master.grid_rowconfigure(i, weight=1)

        self.geometry('600x400')

        # Master is the owner widget (not self.parent) - parent of the widget here

        row = 0
        label = Label(master,
                      text="Residue %s-%d" %
                      (self.nmrRes.molResidue.ccpCode, self.nmrRes.seqCode))
        label.grid(row=row, column=0, sticky=Tkinter.W)

        row = row + 1
        label = Label(master, text=self.message)
        label.grid(row=row, column=0, sticky=Tkinter.W)

        row = row + 1
        self.menu = PulldownMenu(master, entries=self.optionList)
        self.menu.grid(row=row, column=0, sticky=Tkinter.EW)

        row = row + 1
        texts = ['OK']
        commands = [
            self.ok
        ]  # This calls 'ok' in BasePopup, this then calls 'apply' in here
        buttons = createHelpButtonList(master,
                                       texts=texts,
                                       commands=commands,
                                       help_url=self.help_url)
        buttons.grid(row=row, column=0)
Пример #11
0
    def body(self, master):

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

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

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

        self.itemMenu = PulldownMenu(master, entries=self.entries)
        self.itemMenu.grid(row=row, column=1, sticky=Tkinter.EW)

        row = row + 1
        texts = [self.select_text]
        commands = [self.ok]
        buttons = createDismissHelpButtonList(master,
                                              texts=texts,
                                              commands=commands,
                                              dismiss_text='Cancel')
        buttons.grid(row=row, column=0, columnspan=2, sticky=Tkinter.EW)
Пример #12
0
  def __init__(self, parent, peakList):
 
    apply(Frame.__init__, (self, parent) )

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

    self.parent      = parent
    self.peakList    = peakList
    self.specLabel   = Label(self, text='Spectrum: '  )
    self.listLabel   = Label(self, text='Peak List: ' )
    self.dimLabel    = Label(self, text='Dimension' )
    self.adjustLabel = Label(self, text='Adjustment')
    self.specLabel.grid(row = 0, column = 0, columnspan=2, sticky='nsew')
    self.listLabel.grid(row = 0, column = 2, columnspan=1, sticky='nsew')
    self.dimLabel.grid(row = 1, column = 0, columnspan=1, sticky='nsew')
    self.adjustLabel.grid(row = 1, column = 1, columnspan=2, sticky='nsew')
    
    self.goButton     = Button(self, text='Go!', command=self.go,
                               tipText='Commit the re-referencing adjustment')
    self.clearButton  = Button(self, text='Clear', command=self.update,
                               tipText='Clear the input re-referencing values')
    self.cancelButton = Button(self, text='Cancel', command=self.close,
                               tipText='Abort operation without making any changes')
   
    self.update()
Пример #13
0
  def body(self, master):
      
    row = 0
    
    label = Label(master, text= "CcpNmr resonance -> atom mapping file writer.")
    label.grid(row=row, column=0, columnspan = 2, sticky=Tkinter.W)
    
    row += 1
    
    label = Label(master, text= "File formats:")
    label.grid(row=row, column=0, sticky=Tkinter.W)

    self.formatListBox = ScrolledListbox(master, width = 50, height = 5, selectmode = Tkinter.MULTIPLE,
                                       initial_list = self.formats)
    self.formatListBox.grid(row=row, column=1, sticky=Tkinter.EW)
    
    # Default is all formats selected...
    self.formatListBox.setSelectedItems(self.formatListBox.getItems())

    row += 1
    
    label = Label(master, text= "Mapping output file:")
    label.grid(row=row, column=0, sticky=Tkinter.W)

    self.fileButton = Tkinter.Button(master, text = self.defaultText, command = self.selectFile)
    self.fileButton.grid(row=row, column=1, sticky=Tkinter.W)

    row += 1

    texts = [ 'Write mapping' ]
    commands = [ self.ok ]   # This calls 'ok' in BasePopup, this then calls 'apply' in here
    buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, help_url=self.help_url)
    buttons.grid(row=row, columnspan = 2, column=0)
Пример #14
0
    def body(self, guiFrame):

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

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

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

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

        row += 1
        texts = [self.select_text, 'Cancel']
        commands = [self.ok, self.cancel]
        buttons = ButtonList(guiFrame,
                             texts=texts,
                             commands=commands,
                             gridSpan=(1, 2),
                             grid=(row, 0))
Пример #15
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)
Пример #16
0
    def addWidget(self, i, value=None):

        row = i % self.wrap
        col = i // self.wrap

        if self.widgetType in ('Entry', 'IntEntry', 'FloatEntry'):
            option = ''
            if i < len(self.options):
                option = self.options[i]

            label = Label(self.topFrame, text=option or '', anchor='w')
            label.grid(row=row, column=2 * col, sticky=Tkinter.E)
            self.labels.append(label)

            widget = self.widgetClass(self.topFrame, text=value, width=12)
            widget.grid(row=row, column=2 * col + 1, sticky=Tkinter.EW)

            widget.bind('<KeyPress-Return>', self.commit)
            widget.bind('<KeyPress-Escape>', self.cancel)

        elif self.widgetType == 'PulldownList':
            index = -1
            if value in self.options:
                index = self.options.index(value or self.options[0])
            widget = self.widgetClass(self.topFrame)
            widget.setup(self.options, self.options, index)
            widget.grid(row=row,
                        column=2 * col,
                        columnspan=2,
                        sticky=Tkinter.W)

        elif self.widgetType == 'PulldownMenu':
            index = -1
            if value in self.options:
                index = self.options.index(value or self.options[0])
            widget = self.widgetClass(self.topFrame)
            widget.setup(self.options, index)
            widget.grid(row=row,
                        column=2 * col,
                        columnspan=2,
                        sticky=Tkinter.W)

        elif self.widgetType == 'CheckButton':
            widget = self.widgetClass(self.topFrame)
            widget.set(value)
            widget.grid(row=row, column=2 * col, sticky=Tkinter.W)

            option = ''
            if row < len(self.options):
                option = self.options[i]

            label = Label(self.topFrame, text=option or '', anchor='w')
            label.grid(row=row, column=2 * col + 1, sticky=Tkinter.W)
            self.labels.append(label)

        else:
            raise 'Widget type %s not supported in MultiWidget' % self.widgetType

        return widget
Пример #17
0
    def body(self, guiParent):

        self.geometry('600x300')

        guiParent.grid_columnconfigure(1, weight=1)

        url = ''
        if self.server:
            url = self.server.url
        label = Label(guiParent, text='Server location: %s' % url)
        label.grid(row=0, column=0, sticky='w', columnspan=2)

        label = Label(guiParent,
                      text='Installation root: %s%s' %
                      (self.installRoot, os.sep))
        label.grid(row=1, column=0, sticky='w', columnspan=2)

        editWidgets = [None] * 5
        editGetCallbacks = [None, self.toggleSelected, None, None, None]
        editSetCallbacks = [None] * 5

        guiParent.grid_rowconfigure(2, weight=1)
        headingList = [
            'File', 'Install?', 'Date', 'Relative Path', 'Priority', 'Comments'
        ]
        self.scrolledMatrix = ScrolledMatrix(guiParent,
                                             headingList=headingList,
                                             highlightType=0,
                                             editWidgets=editWidgets,
                                             callback=self.selectCell,
                                             editGetCallbacks=editGetCallbacks,
                                             editSetCallbacks=editSetCallbacks)

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

        if self.exitOnClose:
            txt = 'Quit'
            cmd = sys.exit
        else:
            txt = 'Close'
            cmd = self.close

        texts = ['Refresh List', 'Select All', 'Install Selected', txt]
        commands = [self.updateFiles, self.selectAll, self.install, cmd]
        self.buttonList = ButtonList(guiParent,
                                     texts=texts,
                                     commands=commands,
                                     expands=True)
        self.buttonList.grid(row=3, column=0, columnspan=2, sticky='ew')

        if self.server:
            for fileUpdate in self.server.fileUpdates:
                fileUpdate.isSelected = False

        #self.update()
        # need self.updateFiles, not just self.update
        # because otherwise the 2.0.5 to 2.0.6 upgrades do not work
        # (self.server not set on first pass so need call to updateFiles here)
        self.updateFiles()
Пример #18
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()
Пример #19
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
Пример #20
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()
Пример #21
0
  def body(self, master):
      
    #
    # Popup window
    #
    
    self.widgets = []

    row = 0
    label = Label(master, text= "ChemComp formula '%s'" % self.formula)
    label.grid(row=row, column=0, columnspan = 2, sticky=Tkinter.EW)
      
    row = row + 1
    label = Label(master, text= "Number of bonds: %d" % self.bondNumber)
    label.grid(row=row, column=0, columnspan = 2, sticky=Tkinter.EW)
    
    #
    # Show relevant attributes...
    #
    
    for chemCompAttrInfo in self.chemCompInfo:
    
      row = row + 1
      
      attrName = chemCompAttrInfo[0]

      label = Label(master, text = attrName)
      label.grid(row=row, column=0, sticky=Tkinter.EW)     
      
      if attrName in self.nonEntryAttributes:
      
        widgetInfo = self.nonEntryAttributes[attrName]
        
        if widgetInfo[0] == PulldownMenu:
        
          self.widgets.append(PulldownMenu(master, entries = widgetInfo[1], selected_index = widgetInfo[1].index(chemCompAttrInfo[1])))

        elif widgetInfo[0] == CheckButton:

          self.widgets.append(CheckButton(master, selected = widgetInfo[1]))
      
      else:
      
        text = chemCompAttrInfo[1]
        if not text:
          text = ''

        self.widgets.append(Entry(master, text = text))
      
      self.widgets[-1].grid(row=row, column=1, sticky=Tkinter.EW)     

    row = row + 1
    texts = [ 'OK' ]
    commands = [ self.ok ]   # This calls 'ok' in BasePopup, this then calls 'apply' in here
    buttons = createHelpButtonList(master, texts=texts, commands=commands, help_url=self.help_url)
    buttons.grid(row=row, column=0, columnspan = 2)
Пример #22
0
    def draw(self):

        # there must be a better way of doing this. How does the garbage
        # collector work ... do I have to formally remove widgets that
        # I no longer intend to use or it is better to adopt a strategy
        # of recyling them?

        for child in self.children.values():
            child.grid_remove()

        #
        # not clear whether this should come from an object under repList
        # or from a simple variable in root. Probably best that there is
        # a data struture that includes user and repList that is initialised
        # on Login (or built from the readConfig method)

        #
        # really need to set up a dummy structure on login that we can build
        # from if the user does not wish to log in

        user_label = Label(self,
                           text="Currently Logged in as User: "******"Active repositories: ")
        rep_label.grid(row=2, column=1, columnspan=2, pady=10, sticky='w')

        # now rebuild. There must be a better way of doing this?
        repRow = 3

        # should maybe access through method?
        for rep in self.basePopup.repList.getRepositories():

            self.grid_rowconfigure(repRow, weight=0, minsize=10)

            rep_name = Label(self, text=rep.name)
            rep_name.grid(row=repRow, column=1, sticky='w')

            rep_conn = Label(self, text=rep.connect)
            rep_conn.grid(row=repRow, column=2, sticky='w')

            if rep.type == None:
                rep_type_text = 'not specified'
            else:
                rep_type_text = rep.type

            rep_type = Label(self, text=rep_type_text)
            rep_type.grid(row=repRow, column=3, sticky='w')

            repRow += 1

        self.grid_rowconfigure(repRow, weight=1, minsize=10)
Пример #23
0
  def __init__(self, guiParent, basePopup):

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

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


    Frame.__init__(self, guiParent)
  
    # set up the grid

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

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

    # build up the body.

    # Column headers

    self.user_label = Label(self,text='Username:'******'w')

    self.user_value = Text(self, width=20, height=1, text="")
    self.user_value.grid(row=1, column=2,  padx=5, pady=5, sticky='w')


    self.pswd_label = Label(self,text='Password:'******'w')

    self.pswd_value = Text(self, width=20, height=1, text="")
    self.pswd_value.grid(row=2, column=2,  padx=5, pady=5, sticky='w')

    
    self.cancel_button = Button(self, width=10, height=1,
                               text="Cancel",
                               command=self.quit )
    self.cancel_button.grid(row=3, column=1,  padx=5, pady=5, sticky='e')

    
    self.login_botton = Button(self, width=10, height=1,
                               text="Login",
                               command=self.login )
    self.login_botton.grid(row=3, column=2,  padx=5, pady=5, sticky='w')
Пример #24
0
  def body(self, guiParent):
    
    guiParent.grid_columnconfigure(0, weight=1)

    row = 0
    guiParent.grid_rowconfigure(row, weight=1)
    inputFrame = LabelFrame(guiParent, text='Inputs:')
    inputFrame.grid(row=row, column=0, sticky=Tkinter.NSEW)
 
    label = Label(inputFrame, text='NOESY:')
    label.grid(row=0, column=0, sticky=Tkinter.NW)
    
    self.hNoesyPulldown = PulldownMenu(inputFrame,callback=self.setHNoesy)
    self.hNoesyPulldown.grid(row=0, column=1, sticky=Tkinter.NW)

    label = Label(inputFrame, text='15N NOESY:')
    label.grid(row=1, column=0, sticky=Tkinter.NW)
    
    self.nNoesyPulldown = PulldownMenu(inputFrame,callback=self.setNNoesy)
    self.nNoesyPulldown.grid(row=1, column=1, sticky=Tkinter.NW)
    
    label = Label(inputFrame, text='13C NOESY:')
    label.grid(row=2, column=0, sticky=Tkinter.NW)
 
    self.cNoesyPulldown = PulldownMenu(inputFrame,callback=self.setCNoesy)
    self.cNoesyPulldown.grid(row=2, column=1, sticky=Tkinter.NW)
    
    label = Label(inputFrame, text='Shift List:')
    label.grid(row=3, column=0, sticky=Tkinter.NW)
 
    self.shiftListPulldown = PulldownMenu(inputFrame,callback=self.setShiftList)
    self.shiftListPulldown.grid(row=3, column=1, sticky=Tkinter.NW)
    
    label = Label(inputFrame, text='2d BACUS executable:')
    label.grid(row=4, column=0, sticky=Tkinter.NW)
    
    self.executableEntry = Entry(inputFrame, text='/home/tjs23/clouds/justin/SpiBacusMidge/bacus/bacus_tjs.exe')
    self.executableEntry.grid(row=4, column=1, sticky=Tkinter.NW)

    self.executableButton = Button(inputFrame, text='Choose file', command=self.chooseExecutable)
    self.executableButton.grid(row=5, column=1, sticky=Tkinter.EW)
    
    row += 1
    outputFrame = LabelFrame(guiParent, text='Output:')
    outputFrame.grid(row=row, column=0, sticky=Tkinter.NSEW)
 
    row += 1
    texts    = ['Run BACUS 2d','Run BACUS 3d']
    commands = [self.runBacus,self.runBacus3d]
    self.bottomButtons = createDismissHelpButtonList(guiParent,texts=texts,commands=commands,expands=0,help_url=None)
    self.bottomButtons.grid(row=row, column=0, sticky=Tkinter.EW)
    
    self.update()    
Пример #25
0
    def __init__(self, guiParent, dataText, dataObjects, dataValues, helpText,
                 selectionText, **kw):

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

        label = Label(self, text=dataText + ':', grid=(0, 0))
        self.selectionList = PulldownList(self,
                                          objects=dataObjects,
                                          texts=dataValues,
                                          grid=(0, 1))
        label = Label(self, text=helpText, grid=(1, 0), gridSpan=(1, 2))
        label = Label(self, text=selectionText + ':', grid=(2, 0))
        self.selectionEntry = Entry(self, grid=(2, 1))
Пример #26
0
    def changeTabs():
        tabbedFrame.setTabs(['Option 1', 'Option 2', 'Option 3'])

        frames = tabbedFrame.frames

        l1 = Label(frames[0], text='Totally new frame 1')
        l1.grid()

        l2 = Label(frames[1], text='Totally new frame 2')
        l2.grid()

        l3 = Label(frames[2], text='Totally new frame 3')
        l3.grid()
Пример #27
0
  def __init__(self, guiParent, basePopup, borderRelief='raised', text=' ', justify='left',
               width=None, font=None, height=None, *args, **kw):

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


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


    LabelFrame.__init__(self, guiParent, borderRelief, text, justify,
                        width, font, height, *args, **kw)
  
    # set up the grid

    self.grid_columnconfigure(0, weight=0, minsize=20)

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

    # build up the body.

    self.nameLabel = Label(self,text='Name:')
    self.nameLabel.grid(row=1, column=0, padx=2, sticky='nw')

    self.nameText = Text(self, width=15, height=1)
    self.nameText.grid(row=1, column=1, sticky='nw')

    self.userLabel = Label(self,text='User:'******'nw')

    self.userText = Text(self, width=15, height=1)
    self.userText.grid(row=2, column=1, sticky='nw')

    self.clearButton = Button(self, text='Clear', command=self.clear_filter, width=7, height=1)
    self.clearButton.grid(row=3, column=0, columnspan=2, sticky='nw')

    self.filterButton = Button(self, text='Go', command=self.tmpCall, width=7, height=1)
    self.filterButton.grid(row=3, column=1, columnspan=2, sticky='ne')
Пример #28
0
    def body(self, master):

        #
        # Popup window
        #

        row = 0

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

        row = row + 1

        self.valueWidgets = []

        for i in range(0, len(self.valueList)):

            value = self.valueList[i]
            labelText = self.valueInfo[i]

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

            self.valueWidgets.append(Entry(master, text=str(value)))
            self.valueWidgets[-1].grid(row=row,
                                       column=1,
                                       sticky=Tkinter.E,
                                       ipadx=20)

            row = row + 1

        texts = ['OK']
        commands = [
            self.ok
        ]  # This calls 'ok' in BasePopup, this then calls 'apply' in here

        if self.dismissButton:
            buttons = createDismissHelpButtonList(
                master,
                texts=texts,
                commands=commands,
                dismiss_text=self.dismissText,
                help_url=self.help_url)
        else:
            buttons = createHelpButtonList(master,
                                           texts=texts,
                                           commands=commands,
                                           help_url=self.help_url)

        buttons.grid(row=row, column=0, columnspan=3)
Пример #29
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
Пример #30
0
    def body(self, master):

        row = 0

        label = Label(master,
                      text="BMRB chemical shift deposition file writer.")
        label.grid(row=row, column=0, columnspan=2, sticky=Tkinter.W)

        row += 1

        label = Label(master, text="Shift lists:")
        label.grid(row=row, column=0, sticky=Tkinter.W)

        self.shiftListSelect = PulldownMenu(master,
                                            entries=self.shiftLists,
                                            callback=self.setChainList,
                                            do_initial_callback=False)
        self.shiftListSelect.grid(row=row, column=1, sticky=Tkinter.EW)

        row += 1

        label = Label(master, text="Chains (only one per file):")
        label.grid(row=row, column=0, sticky=Tkinter.W)

        self.chainListSelect = PulldownMenu(master, entries=self.chainList)
        self.chainListSelect.grid(row=row, column=1, sticky=Tkinter.EW)
        self.setChainList(0, self.shiftLists[0])

        row += 1

        label = Label(master, text="Chemical shift deposition file:")
        label.grid(row=row, column=0, sticky=Tkinter.W)

        self.fileButton = Tkinter.Button(master,
                                         text=self.defaultText,
                                         command=self.selectFile)
        self.fileButton.grid(row=row, column=1, sticky=Tkinter.W)

        row += 1

        texts = ['Write file']
        commands = [
            self.ok
        ]  # This calls 'ok' in BasePopup, this then calls 'apply' in here
        buttons = createDismissHelpButtonList(master,
                                              texts=texts,
                                              commands=commands,
                                              help_url=self.help_url)
        buttons.grid(row=row, columnspan=2, column=0)