def body(self, master): self.geometry('600x400') master.grid_rowconfigure(0, weight=1) master.grid_columnconfigure(0, weight=1) self.result = '' self.file_select = FileSelect(master, file_types=self.file_types, directory=self.directory, prompt=self.prompt, show_file=self.show_file, file=self.initial_file, multiSelect=self.multiSelect, default_dir=self.default_dir) self.file_select.grid(row=0, column=0, sticky=Tkinter.NSEW) texts = ['Ok'] commands = [self.ok] if (self.extra_dismiss_text): texts.append(self.extra_dismiss_text) commands.append(self.extra) buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text=self.dismiss_text) buttons.grid(row=1, column=0, sticky=Tkinter.EW)
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)
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)
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)
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)
def body(self, guiParent): # Ensure that the first row and column in popup expand guiParent.grid_rowconfigure(0, weight=1) guiParent.grid_columnconfigure(0, weight=1, minsize=200) frame = Frame(guiParent) # Body widgets can be put in this frame frame.grid() buttons = createDismissHelpButtonList(frame, dismiss_text='Quit', dismiss_cmd=self.quit, help_url=self.help_url, expands=1) buttons.grid(row=0, column=0, sticky=Tkinter.NSEW) self.helpButton = buttons.buttons[-1] self.helpButtonCommand = self.helpButton.buttonCommand # the command with no project # Dictionary to store popups opened by this application - e.g. need to close upon quit self.popups = {} # Default font self.font = 'Helvetica 10' # Closing the window from the desktop environment calls the proper quit self.protocol('WM_DELETE_WINDOW', self.quit) self.mainMenu = Menu(self) self.projectMenu = self.makeProjectMenu() self.otherMenu = self.makeOtherMenu() # Put the main menu self.config(menu=self.mainMenu) self.initProject()
def body(self, master): self.geometry('600x500') master.grid_rowconfigure(1, weight=1) master.grid_columnconfigure(0, weight=1) label = Label(master, text='Select Project Directory') label.grid(row=0, column=0, sticky=Tkinter.W) file_types = [FileType('Project', ['*.xml']), FileType('All', ['*'])] self.file_select = FileSelect(master, file_types=file_types, show_file=False, double_callback=self.ok, getRowColor=self.getEntryColor, getExtraCell=self.getProjectFileText, extraHeadings=('Status', ), extraJustifies=('left', )) self.file_select.grid(row=1, column=0, sticky=Tkinter.NSEW) texts = ['Open'] commands = [self.ok] buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text='Cancel', help_msg=self.help_msg, help_url=self.help_url) buttons.grid(row=2, column=0, sticky=Tkinter.EW) self.ok_button = buttons.buttons[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)
def body(self, master): # # Popup window # row = 0 if self.headerLines: for headerLine in self.headerLines: label = Label(master, text= headerLine) label.grid(row=row, column=0, columnspan = 3, sticky=Tkinter.EW) row += 1 label = Label(master, text= "Residue type '%s'" % self.ccpCode) label.grid(row=row, column=0, columnspan = 3, sticky=Tkinter.EW) row = row + 1 matchNameString = "[%s]" % self.matchName if self.matchInfoPopup: label = Label(master, text= "%s:" % self.matchType) label.grid(row=row, column=0, sticky=Tkinter.E) button = Tkinter.Button(master, text= matchNameString, command = lambda : self.matchInfoPopup(self,self.matchName), fg = 'blue') button.grid(row=row, column=1, columnspan = 2) else: label = Label(master, text= "%s:" %self.matchType) label.grid(row=row, column=0, sticky=Tkinter.E) label = Label(master, text= matchNameString, fg = 'blue') label.grid(row=row, column=1, columnspan = 2) if self.shifts: row = row + 1 label = Label(master, text= "(shifts: %s ppm)" % self.shifts) label.grid(row=row, column=1, columnspan = 2, sticky=Tkinter.EW) row = row + 1 label = Label(master, text= "Pick atom:") label.grid(row=row, column=0, sticky=Tkinter.E) self.menu = PulldownMenu(master, entries = self.chemAtomList) self.menu.grid(row=row, column=1, columnspan = 2, ipadx = 20) row = row + 1 label = Label(master, text= "Propagate\nmapping to:") label.grid(row=row, column=0, sticky=Tkinter.E) self.propagateMenu = PulldownMenu(master, entries = self.propagateList, selected_index = self.selectedIndex) self.propagateMenu.grid(row=row, column=1, columnspan = 2) row = row + 1 texts = [ 'OK' , 'Show all atoms'] commands = [ self.ok, self.showAllAtoms] # This calls 'ok' in BasePopup, this then calls 'apply' in here buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text = 'Do not link', dismiss_cmd = self.doNotLink, help_url=self.help_url) buttons.grid(row=row, column=0, columnspan = 3)
def body(self, guiParent): guiParent.grid_columnconfigure(0, weight=1) row = 0 guiParent.grid_rowconfigure(row, weight=1) inputFrame = LabelFrame(guiParent, text='Inputs:') inputFrame.grid(row=row, column=0, sticky=Tkinter.NSEW) label = Label(inputFrame, text='NOESY:') label.grid(row=0, column=0, sticky=Tkinter.NW) self.hNoesyPulldown = PulldownMenu(inputFrame,callback=self.setHNoesy) self.hNoesyPulldown.grid(row=0, column=1, sticky=Tkinter.NW) label = Label(inputFrame, text='15N NOESY:') label.grid(row=1, column=0, sticky=Tkinter.NW) self.nNoesyPulldown = PulldownMenu(inputFrame,callback=self.setNNoesy) self.nNoesyPulldown.grid(row=1, column=1, sticky=Tkinter.NW) label = Label(inputFrame, text='13C NOESY:') label.grid(row=2, column=0, sticky=Tkinter.NW) self.cNoesyPulldown = PulldownMenu(inputFrame,callback=self.setCNoesy) self.cNoesyPulldown.grid(row=2, column=1, sticky=Tkinter.NW) label = Label(inputFrame, text='Shift List:') label.grid(row=3, column=0, sticky=Tkinter.NW) self.shiftListPulldown = PulldownMenu(inputFrame,callback=self.setShiftList) self.shiftListPulldown.grid(row=3, column=1, sticky=Tkinter.NW) label = Label(inputFrame, text='2d BACUS executable:') label.grid(row=4, column=0, sticky=Tkinter.NW) self.executableEntry = Entry(inputFrame, text='/home/tjs23/clouds/justin/SpiBacusMidge/bacus/bacus_tjs.exe') self.executableEntry.grid(row=4, column=1, sticky=Tkinter.NW) self.executableButton = Button(inputFrame, text='Choose file', command=self.chooseExecutable) self.executableButton.grid(row=5, column=1, sticky=Tkinter.EW) row += 1 outputFrame = LabelFrame(guiParent, text='Output:') outputFrame.grid(row=row, column=0, sticky=Tkinter.NSEW) row += 1 texts = ['Run BACUS 2d','Run BACUS 3d'] commands = [self.runBacus,self.runBacus3d] self.bottomButtons = createDismissHelpButtonList(guiParent,texts=texts,commands=commands,expands=0,help_url=None) self.bottomButtons.grid(row=row, column=0, sticky=Tkinter.EW) self.update()
def body(self, 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)
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)
def body(self, master): self.geometry('600x500') master.grid_rowconfigure(0, weight=1) master.grid_columnconfigure(0, weight=1) self.dataLocationFrame = DataLocationFrame(master, self.project) self.dataLocationFrame.grid(row=0, column=0, sticky='nsew') buttons = createDismissHelpButtonList(master, help_msg=self.help_msg, help_url=self.help_url) buttons.grid(row=1, column=0, sticky='ew') self.dataLocationFrame.administerNotifiers(self.registerNotify)
def body(self, master): self.frame = ChemCompFrame(master, self.project, **self.keywds) self.frame.pack(side=Tkinter.TOP, expand=Tkinter.YES, fill=Tkinter.BOTH) texts = ['OK'] commands = [self.ok] buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text='Cancel', help_url=self.help_url) buttons.pack()
def body(self, master): master.grid_columnconfigure(2, weight=1) row = 0 label = Label(master, text='Data to export:') label.grid(row=row, column=0, columnspan=3, sticky=Tkinter.W) self.check_buttons = {} i = 0 for heading in self.headings: row = row + 1 isSelected = self.exportSelection.get(row, True) self.check_buttons[i] = c = CheckButton( master, selected=isSelected, callback=self.toggleCheckButton) c.grid(row=row, column=1) label = Label(master, text=heading) label.grid(row=row, column=2, sticky=Tkinter.W) i += 1 row = row + 1 button = Button(master, text='File:', command=self.findFile) button.grid(row=row, column=0, sticky=Tkinter.W) self.file_entry = Entry(master, text=self.file, width=30) self.file_entry.grid(row=row, column=1, columnspan=2, sticky=Tkinter.EW) row = row + 1 label = Label(master, text='Format:') label.grid(row=row, column=0, sticky=Tkinter.W) self.format_menu = PulldownMenu(master, entries=exportFormats) self.format_menu.grid(row=row, column=1, columnspan=2, sticky=Tkinter.W) row = row + 1 master.grid_rowconfigure(row, weight=1) texts = ['Save'] commands = [self.ok] buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text='Cancel') buttons.grid(row=row, column=0, columnspan=3, sticky=Tkinter.EW)
def body(self, master): master.grid_columnconfigure(0, weight=1) for i in range(6): master.grid_rowconfigure(i, weight=1) self.geometry('600x400') # # Popup window # row = 0 label = Label(master, text="Residue type '%s'" % self.code3Letter) label.grid(row=row, column=0, sticky=Tkinter.EW) row = row + 1 label = Label(master, text="Resonance '%s'" % self.resName) label.grid(row=row, column=0, sticky=Tkinter.EW) row = row + 1 label = Label(master, text="Pick resonance(s):") label.grid(row=row, column=0, sticky=Tkinter.W) row = row + 1 self.list = ScrolledListbox(master, width=50, height=5, selectmode=self.selectmode, initial_list=self.resonanceList) self.list.grid(row=row, column=0, sticky=Tkinter.EW) row = row + 1 label = Label(master, text=self.helpText, fg='blue') 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) buttons.grid(row=row, column=0)
def body(self, master): self.alarm_id = None self.root_widget = getRoot(self) row = 0 label = Label(master, text='Widget count:') label.grid(row=row, column=0, sticky=Tkinter.W) self.count_label = Label(master, text='', tipText='Number of Tkinter widget objects') self.count_label.grid(row=row, column=1, sticky=Tkinter.W) row = row + 1 ind = 1 label = Label(master, text='Auto count:') label.grid(row=row, column=0, sticky=Tkinter.W) self.on_off_buttons = RadioButtons(master, entries=self.on_off_entries, select_callback=self.applyAuto, selected_index=ind) self.on_off_buttons.grid(row=row, column=1, sticky=Tkinter.EW) row = row + 1 label = Label(master, text='Auto frequency:') label.grid(row=row, column=0, sticky=Tkinter.W) self.freq_entry = IntEntry(master, text=60, returnCallback=self.applyAuto) self.freq_entry.grid(row=row, column=1, sticky=Tkinter.EW) label = Label(master, text='seconds') label.grid(row=row, column=2, sticky=Tkinter.W) row = row + 1 texts = ['Do Immediate Count'] commands = [self.applyManual] buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, help_msg=self.help_msg, help_url=self.help_url) buttons.grid(row=row, column=0, columnspan=3, sticky=Tkinter.EW) self.doCount()
def body(self, master): master.grid_rowconfigure(0, weight=1) master.grid_columnconfigure(0, weight=1) row = 0 self.printFrame = PrintFrame(master, project=self.project, appKey=self.appKey) self.printFrame.grid(row=row, column=0, sticky=Tkinter.EW) row = row + 1 texts = ['Save'] commands = [self.ok] buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text='Cancel') buttons.grid(row=row, column=0, sticky=Tkinter.EW)
def body(self, master): self.geometry('600x400') # # Quick check # if not self.chains: showError("No chains", "No chains available - cannot use export/import cycle.") self.destroy() # # Set it all up # columnspan = 2 row = 0 label = Label(master, text="AutoAssign export/import cycle.") label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) row += 1 separator = Separator(master, height=3) separator.setColor('black', bgColor='black') separator.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) row += 1 label = Label( master, fg='red', text= "Popup to export %s data from the CCPN data model,\nrun %s, then re-import the output." % (self.format, self.format)) label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) # # Make a break... # row += 1 separator = Separator(master, height=3) separator.setColor('black', bgColor='black') separator.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) # # Set up export file info # row += 1 label = Label(master, text="Export menu (using date/time label '%s')" % self.dateTimeFlag) label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) row += 1 (chainList, self.chainDict) = createSelection(self.chains) label = Label(master, text="Select chain to export:") label.grid(row=row, column=0, sticky=Tkinter.W) self.chainSelect = PulldownMenu(master, entries=chainList) self.chainSelect.grid(row=row, column=1, sticky=Tkinter.W) row += 1 label = Label(master, text="Export %s project file:" % self.format) label.grid(row=row, column=0, sticky=Tkinter.W) self.selectExportFileButton = Tkinter.Button( master, text='Select export file', command=(lambda: self.selectExportProjectFile())) self.selectExportFileButton.grid(row=row, column=1, sticky=Tkinter.W) row += 1 self.exportButton = Tkinter.Button(master, text='Export', command=(lambda: self.doExport())) self.exportButton.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) # # Make a break... # row += 1 separator = Separator(master, height=3) separator.setColor('black', bgColor='black') separator.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) # # Set up import file info # row += 1 label = Label(master, text="Re-import menu") label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) row += 1 # # Select the right chain with the right date/time flag... # label = Label(master, text="Select chain with correct date/time flag:") label.grid(row=row, column=0, sticky=Tkinter.W) self.chainDateTimeSelect = PulldownMenu( master, entries=self.chainDateTimeStamps) self.chainDateTimeSelect.grid(row=row, column=1, sticky=Tkinter.W) # TODO UPDATE THIS WHEN EXPORT BUTTON PRESSED AND GETTING OK FROM EXPORT ITSELF! # Probably also need just a message if no importDateTimeStamp available... row += 1 label = Label(master, text="Import %s output file:" % self.format) label.grid(row=row, column=0, sticky=Tkinter.W) self.selectImportFileButton = Tkinter.Button( master, text='Select import file', command=(lambda: self.selectImportShiftFile())) self.selectImportFileButton.grid(row=row, column=1, sticky=Tkinter.W) row += 1 self.importButton = Tkinter.Button(master, text='Import', command=(lambda: self.doImport())) self.importButton.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) # # Make a break... # row += 1 separator = Separator(master, height=3) separator.setColor('black', bgColor='black') separator.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) row += 1 buttons = createDismissHelpButtonList(master, texts=[], commands=[], help_url=self.help_url) buttons.grid(row=row, columnspan=columnspan, column=0)
def body(self, master): master.grid_columnconfigure(0, weight=1) master.grid_rowconfigure(0, weight=1) master.grid_rowconfigure(1, weight=1) self.geometry('500x500') fileNames = [] # All files have to be in same directory! if self.files and self.files[0].find(dirsep) > -1: (path, fileName) = splitPath(self.files[0]) directory = path fileNames.append(fileName) for file in self.files[1:]: (path, fileName) = splitPath(file) fileNames.append(fileName) else: path = None directory = normalisePath(os.path.abspath(os.curdir)) fileNames = [] #print directory #print fileName file_types = [] if fileTypeDict.has_key(self.component): if self.format and fileTypeDict[self.component].has_key( self.format): file_types.extend([ FileType(self.format, fileTypeDict[self.component][self.format]) ]) if fileTypeDict[self.component].has_key('generic'): file_types.extend([ FileType('generic', fileTypeDict[self.component]['generic']) ]) file_types.extend([FileType('All', ['*'])]) self.file_select = FileSelect(master, file_types=file_types, directory=directory, double_callback=self.ok, multiSelect=self.multiSelect) if self.multiSelect: self.file_select.setFiles(fileNames) else: if fileNames: fileName = fileNames[0] else: fileName = '' self.file_select.setFile(fileName) self.file_select.grid(row=0, column=0, sticky=Tkinter.NSEW) texts = [self.selectionText] commands = [self.ok] buttons = createDismissHelpButtonList(master, texts=texts, commands=commands) buttons.grid(row=1, column=0, sticky=Tkinter.EW)
def body(self, guiFrame): row = 0 guiFrame.grid_columnconfigure(3, weight=1) label = Label(guiFrame, text='Cloud file names:') label.grid(row=row, column=0, sticky=Tkinter.W) self.fileNameEntry = Entry(guiFrame, text='testHistone\d+.pdb', returnCallback=self.loadClouds) self.fileNameEntry.grid(row=row, column=1, sticky=Tkinter.W) strucLabel = Label(guiFrame, text='Comparison structure') strucLabel.grid(row=row, column=2, sticky=Tkinter.W) self.strucPulldown = PulldownMenu(guiFrame, entries=self.getStructures(), callback=self.setStructure, selected_index=0, do_initial_callback=0) self.strucPulldown.grid(row=row, column=3, sticky=Tkinter.W) row += 1 sdTolLabel = Label(guiFrame, text='Tolerance (SDs):') sdTolLabel.grid(row=row, column=0, sticky=Tkinter.W) self.sdToleranceEntry = FloatEntry(guiFrame, text=2.0, width=6) self.sdToleranceEntry.grid(row=row, column=1, stick=Tkinter.W) atomTypes = ['All', 'H', 'H HA', 'H HA HB'] label = Label(guiFrame, text='RMSD Atom Types:') label.grid(row=row, column=2, sticky=Tkinter.W) self.atomsPulldown = PulldownMenu(guiFrame, entries=atomTypes, callback=self.setAtomTypes, selected_index=0, do_initial_callback=0) self.atomsPulldown.grid(row=row, column=3, sticky=Tkinter.W) row += 1 guiFrame.grid_rowconfigure(row, weight=1) colHeadings = ['#', 'File name', 'RMSD to mean'] self.scrolledMatrix = ScrolledMatrix(guiFrame, initialRows=10, headingList=colHeadings, callback=self.selectCell, objectList=[], textMatrix=[ [], ], multiSelect=1) self.scrolledMatrix.grid(row=row, column=0, columnspan=4, sticky=Tkinter.NSEW) row += 1 texts = [ 'Load\nClouds', 'Align\nClouds', 'Calc\nRMSD', 'Make Cloud\nfrom structure', 'Remove', 'Remove\nbad' ] commands = [ self.loadClouds, self.alignClouds, self.calcRmsd, self.makeStrucCloud, self.deleteClouds, self.filterClouds ] self.bottomButtons = createDismissHelpButtonList( guiFrame, texts=texts, expands=1, commands=commands, help_url=self.help_url) self.bottomButtons.grid(row=row, column=0, columnspan=4, sticky=Tkinter.NSEW) self.update()
def body(self, guiFrame): guiFrame.grid_columnconfigure(3, weight=1) row = 0 label = Label(guiFrame, text='Molecular system: ') label.grid(row=row, column=0, sticky=Tkinter.NW) self.molSysPulldown = PulldownMenu(guiFrame, self.changeMolSystem, selected_index=-1, do_initial_callback=0) self.molSysPulldown.grid(row=row, column=1, sticky=Tkinter.NW) label = Label(guiFrame, text='Clouds files: ') label.grid(row=row, column=2, sticky=Tkinter.NW) self.filenameEntry = Entry(guiFrame,text='perfect00.pdb') self.filenameEntry.grid(row=row, column=3, sticky=Tkinter.NW) row += 1 label = Label(guiFrame, text='Chain: ') label.grid(row=row, column=0, sticky=Tkinter.NW) self.chainPulldown = PulldownMenu(guiFrame, self.changeChain, selected_index=-1, do_initial_callback=0) self.chainPulldown.grid(row=row, column=1, sticky=Tkinter.NW) label = Label(guiFrame, text='Thread steps: ') label.grid(row=row, column=2, sticky=Tkinter.NW) self.numStepsEntry = IntEntry(guiFrame,text=3000) self.numStepsEntry.grid(row=row, column=3, sticky=Tkinter.NW) row += 1 label = Label(guiFrame, text='Homologue PDB file: ') label.grid(row=row, column=0, sticky=Tkinter.NW) self.pdbEntry = Entry(guiFrame,text='') self.pdbEntry.grid(row=row, column=1, sticky=Tkinter.NW) label = Label(guiFrame, text='Dist. Threshold: ') label.grid(row=row, column=2, sticky=Tkinter.NW) self.distEntry = FloatEntry(guiFrame,text=3.0) self.distEntry.grid(row=row, column=3, sticky=Tkinter.NW) row += 1 label = Label(guiFrame, text='Global score: ') label.grid(row=row, column=0, sticky=Tkinter.NW) self.globalScoreLabel = Label(guiFrame, text='') self.globalScoreLabel.grid(row=row, column=1, sticky=Tkinter.NW) label = Label(guiFrame, text='Assignment Threshold: ') label.grid(row=row, column=2, sticky=Tkinter.NW) self.thresholdEntry = FloatEntry(guiFrame,text=-4.5) self.thresholdEntry.grid(row=row, column=3, sticky=Tkinter.NW) row += 1 guiFrame.grid_rowconfigure(row, weight=1) self.graph = ScrolledGraph(guiFrame, width=300, height=200) self.graph.grid(row=row, column=0, columnspan=4, sticky = Tkinter.NSEW) row += 1 texts = ['Run','Assign!'] commands = [self.run, self.assignSpinSystems] bottomButtons = createDismissHelpButtonList(guiFrame,texts=texts,commands=commands,expands=0,help_url=None) bottomButtons.grid(row=row, column=0, columnspan=4, sticky=Tkinter.EW) self.assignButton = bottomButtons.buttons[1] for func in ('__init__','delete'): Implementation.registerNotify(self.updateMolSystems, 'ccp.molecule.MolSystem.MolSystem', func) Implementation.registerNotify(self.updateChains, 'ccp.molecule.MolSystem.Chain', func) self.updateMolSystems() self.updateChains()
def body(self, guiFrame): self.specFreqEntry = IntEntry(self, text=self.specFreq, width=8, returnCallback=self.setSpecFreq) self.maxIterEntry = IntEntry(self, text=self.maxIter, width=8, returnCallback=self.setMaxIter) self.mixTimeEntry = FloatEntry(self, text=self.mixTime, width=8, returnCallback=self.setMixTime) self.corrTimeEntry = FloatEntry(self, text=self.corrTime, width=8, returnCallback=self.setCorrTime) self.leakRateEntry = FloatEntry(self, text=self.leakRate, width=8, returnCallback=self.setLeakRate) self.maxIntensEntry = IntEntry(self, text=self.maxIntens, width=8, returnCallback=self.setMaxIntens) self.mdInitTempEntry = FloatEntry(self, text='', returnCallback=self.setMdInitTemp) self.mdFinTempEntry = FloatEntry(self, text='', returnCallback=self.setMdFinTemp) self.mdCoolStepsEntry = IntEntry(self, text='', returnCallback=self.setMdCoolSteps) self.mdSimStepsEntry = IntEntry(self, text='', returnCallback=self.setMdSimSteps) self.mdTauEntry = FloatEntry(self, text='', returnCallback=self.setMdTau) self.mdRepScaleEntry = FloatEntry(self, text='', returnCallback=self.setMdRepScale) guiFrame.grid_columnconfigure(0, weight=1) row = 0 frame0 = LabelFrame(guiFrame, text='Setup peak lists') frame0.grid(row=row, column=0, sticky=Tkinter.NSEW) frame0.grid(row=row, column=0, sticky=Tkinter.NSEW) frame0.grid_columnconfigure(1, weight=1) f0row = 0 label00 = Label(frame0, text='1H-1H NOESY spectrum') label00.grid(row=f0row, column=0, sticky=Tkinter.NW) self.noesyPulldown = PulldownMenu(frame0, entries=self.getNoesys(), callback=self.setNoesy, selected_index=0, do_initial_callback=0) self.noesyPulldown.grid(row=f0row, column=1, sticky=Tkinter.NW) f0row += 1 label01 = Label(frame0, text='15N HSQC spectrum') label01.grid(row=f0row, column=0, sticky=Tkinter.NW) self.hsqcPulldown = PulldownMenu(frame0, entries=self.getHsqcs(), callback=self.setHsqc, selected_index=0, do_initial_callback=0) self.hsqcPulldown.grid(row=f0row, column=1, sticky=Tkinter.NW) f0row += 1 label02 = Label(frame0, text='15N HSQC TOCSY spectrum') label02.grid(row=f0row, column=0, sticky=Tkinter.NW) self.tocsyPulldown = PulldownMenu(frame0, entries=self.getTocsys(), callback=self.setTocsy, selected_index=0, do_initial_callback=0) self.tocsyPulldown.grid(row=f0row, column=1, sticky=Tkinter.NW) f0row += 1 label02 = Label(frame0, text='15N HSQC NOESY spectrum') label02.grid(row=f0row, column=0, sticky=Tkinter.NW) self.noesy3dPulldown = PulldownMenu(frame0, entries=self.getNoesy3ds(), callback=self.setNoesy3d, selected_index=0, do_initial_callback=0) self.noesy3dPulldown.grid(row=f0row, column=1, sticky=Tkinter.NW) f0row += 1 texts = ['Setup resonances & peaks', 'Show Peaks', 'Show resonances'] commands = [self.setupResonances, self.showPeaks, self.showResonances] self.setupButtons = ButtonList(frame0, expands=1, texts=texts, commands=commands) self.setupButtons.grid(row=f0row, column=0, columnspan=2, sticky=Tkinter.NSEW) f0row += 1 self.label03a = Label(frame0, text='Resonances found: 0') self.label03a.grid(row=f0row, column=0, sticky=Tkinter.NW) self.label03b = Label(frame0, text='NOESY peaks found: 0') self.label03b.grid(row=f0row, column=1, sticky=Tkinter.NW) row += 1 frame1 = LabelFrame(guiFrame, text='Calculate distance constraints') frame1.grid(row=row, column=0, sticky=Tkinter.NSEW) frame1.grid_columnconfigure(3, weight=1) f1row = 0 frame1.grid_rowconfigure(f1row, weight=1) data = [ self.specFreq, self.maxIter, self.mixTime, self.corrTime, self.leakRate, self.maxIntens ] colHeadings = [ 'Spectrometer\nfrequency', 'Max\niterations', 'Mixing\ntime (ms)', 'Correl.\ntime (ns)', 'Leak\nrate', 'Max\nintensity' ] editWidgets = [ self.specFreqEntry, self.maxIterEntry, self.mixTimeEntry, self.corrTimeEntry, self.leakRateEntry, self.maxIntensEntry, ] editGetCallbacks = [ self.getSpecFreq, self.getMaxIter, self.getMixTime, self.getCorrTime, self.getLeakRate, self.getMaxIntens, ] editSetCallbacks = [ self.setSpecFreq, self.setMaxIter, self.setMixTime, self.setCorrTime, self.setLeakRate, self.setMaxIntens, ] self.midgeParamsMatrix = ScrolledMatrix( frame1, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, maxRows=1, initialCols=5, headingList=colHeadings, callback=None, objectList=[ 'None', ], textMatrix=[ data, ]) self.midgeParamsMatrix.grid(row=f1row, column=0, columnspan=4, sticky=Tkinter.NSEW) f1row += 1 label10 = Label(frame1, text='Benchmark structure') label10.grid(row=f1row, column=0, sticky=Tkinter.NW) self.structurePulldown = PulldownMenu(frame1, entries=self.getStructures(), callback=self.setStructure, selected_index=0, do_initial_callback=0) self.structurePulldown.grid(row=f1row, column=1, sticky=Tkinter.NW) label11 = Label(frame1, text='ADC atom types:') label11.grid(row=f1row, column=2, sticky=Tkinter.NW) self.adcAtomsPulldown = PulldownMenu(frame1, entries=self.getAdcAtomTypes(), callback=self.setAdcAtomTypes, selected_index=0, do_initial_callback=0) self.adcAtomsPulldown.grid(row=f1row, column=3, sticky=Tkinter.NW) f1row += 1 texts = [ 'Calculate distances', 'Show distance\nconstraints', 'Show anti-distance\nconstraints' ] commands = [ self.calculateDistances, self.showConstraints, self.showAntiConstraints ] self.midgeButtons = ButtonList(frame1, expands=1, texts=texts, commands=commands) self.midgeButtons.grid(row=f1row, column=0, columnspan=4, sticky=Tkinter.NSEW) f1row += 1 self.distConstrLabel = Label(frame1, text='Distance constraints:') self.distConstrLabel.grid(row=f1row, column=0, columnspan=2, sticky=Tkinter.NW) self.antiConstrLabel = Label(frame1, text='Anti-distance constraints:') self.antiConstrLabel.grid(row=f1row, column=2, columnspan=2, sticky=Tkinter.NW) row += 1 guiFrame.grid_rowconfigure(row, weight=1) frame2 = LabelFrame(guiFrame, text='Proton cloud molecular dynamics') frame2.grid(row=row, column=0, sticky=Tkinter.NSEW) frame2.grid_columnconfigure(1, weight=1) f2row = 0 frame2.grid_rowconfigure(f2row, weight=1) data = [ self.specFreq, self.maxIter, self.mixTime, self.corrTime, self.leakRate ] colHeadings = [ 'Step', 'Initial temp.', 'Final temp.', 'Cooling steps', 'MD steps', 'MD tau', 'Rep. scale' ] editWidgets = [ None, self.mdInitTempEntry, self.mdFinTempEntry, self.mdCoolStepsEntry, self.mdSimStepsEntry, self.mdTauEntry, self.mdRepScaleEntry ] editGetCallbacks = [ None, self.getMdInitTemp, self.getMdFinTemp, self.getMdCoolSteps, self.getMdSimSteps, self.getMdTau, self.getMdRepScale ] editSetCallbacks = [ None, self.setMdInitTemp, self.setMdFinTemp, self.setMdCoolSteps, self.setMdSimSteps, self.setMdTau, self.setMdRepScale ] self.coolingSchemeMatrix = ScrolledMatrix( frame2, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, maxRows=9, initialRows=12, headingList=colHeadings, callback=self.selectCoolingStep, objectList=self.coolingScheme, textMatrix=self.coolingScheme) self.coolingSchemeMatrix.grid(row=f2row, column=0, columnspan=4, sticky=Tkinter.NSEW) f2row += 1 texts = ['Move earlier', 'Move later', 'Add step', 'Remove step'] commands = [ self.moveStepEarlier, self.moveStepLater, self.addCoolingStep, self.removeCoolingStep ] self.coolingSchemeButtons = ButtonList(frame2, expands=1, commands=commands, texts=texts) self.coolingSchemeButtons.grid(row=f2row, column=0, columnspan=4, sticky=Tkinter.EW) f2row += 1 label20 = Label(frame2, text='Number of clouds:') label20.grid(row=f2row, column=0, sticky=Tkinter.NW) self.numCloudsEntry = FloatEntry(frame2, text=100, returnCallback=self.setNumClouds, width=10) self.numCloudsEntry.grid(row=f2row, column=1, sticky=Tkinter.NW) label21 = Label(frame2, text='Cloud file prefix:') label21.grid(row=f2row, column=2, sticky=Tkinter.NW) self.filePrefixEntry = Entry(frame2, text='cloud_', returnCallback=self.setFilePrefix, width=10) self.filePrefixEntry.grid(row=f2row, column=3, sticky=Tkinter.NW) f2row += 1 texts = ['Start molecular dynamics', 'Show dynamics progress'] commands = [self.startMd, self.showMdProgress] self.mdButtons = ButtonList(frame2, expands=1, commands=commands, texts=texts) self.mdButtons.grid(row=f2row, column=0, columnspan=4, sticky=Tkinter.NSEW) row += 1 self.bottomButtons = createDismissHelpButtonList(guiFrame, expands=0, help_url=None) self.bottomButtons.grid(row=row, column=0, sticky=Tkinter.EW) self.setButtonStates()
def body(self, master): # # Peaklist setup # self.peakListDict = {} for experiment in self.project.currentNmrProject.sortedExperiments(): for dataSource in experiment.sortedDataSources(): for peakList in dataSource.sortedPeakLists(): peakListLabel = "%s:%s:%d:%s" % ( experiment.name, dataSource.name, peakList.serial, peakList.name) self.peakListDict[peakListLabel] = peakList peakListLabels = self.peakListDict.keys() peakListLabels.sort() # # chemical shift list setup # self.shiftListDict = {} self.shiftListDict['None'] = None for shiftList in self.project.currentNmrProject.findAllMeasurementLists( className='ShiftList'): shiftListLabel = "%d:%s" % (shiftList.serial, shiftList.name) self.shiftListDict[shiftListLabel] = shiftList shiftListLabels = self.shiftListDict.keys() shiftListLabels.sort() row = 0 label = Label(master, text="Generation of chemical shift list") label.grid(row=row, column=0, columnspan=2, sticky=Tkinter.W) row += 1 label = Label(master, text="Peak lists:") label.grid(row=row, column=0, sticky=Tkinter.W) self.peakListBox = ScrolledListbox(master, width=50, height=5, selectmode=Tkinter.MULTIPLE, initial_list=peakListLabels) self.peakListBox.grid(row=row, column=1, sticky=Tkinter.EW) row += 1 label = Label(master, text="Use existing shift list:") label.grid(row=row, column=0, sticky=Tkinter.W) self.shiftListSelect = PulldownMenu(master, entries=shiftListLabels) self.shiftListSelect.grid(row=row, column=1, sticky=Tkinter.EW) row += 1 label = Label(master, text="Use multiple assignments:") label.grid(row=row, column=0, sticky=Tkinter.W) self.useAllContribs = CheckButton(master) self.useAllContribs.grid(row=row, column=1, sticky=Tkinter.W) # # Setup the default shift error per nucleus # self.defaultShiftError = {} for (nucl, text, defValue) in [('1H', 'proton', '0.002'), ('13C', 'carbon', '0.1'), ('15N', 'nitrogen', '0.1')]: row += 1 label = Label(master, text="Default %s shift error:" % text) label.grid(row=row, column=0, sticky=Tkinter.W) self.defaultShiftError[nucl] = Entry(master, text=defValue) self.defaultShiftError[nucl].grid(row=row, column=1, sticky=Tkinter.W) row += 1 texts = ['Create shift list'] 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)
def body(self, guiParent): now = datetime.date.today().strftime('%y%m%d') filePrefix = '%s_%s' % (self.project.name, now) projDir = getUserDataPath(self.project) directory = os.path.dirname(projDir) guiParent.grid_rowconfigure(0, weight=1) guiParent.grid_columnconfigure(1, weight=1) row = 0 label = Label(guiParent, text='Archive File:') label.grid(row=row, column=0, sticky=Tkinter.E) tipText = 'File name (excluding .tgz ending) for archive' self.fileEntry = Entry(guiParent, text=filePrefix, tipText=tipText) self.fileEntry.grid(row=row, column=1, sticky=Tkinter.EW) label = Label(guiParent, text='.tgz (automatically appended)') label.grid(row=row, column=2, sticky=Tkinter.W) row = row + 1 self.backupCheck = CheckButton( guiParent, text='Include *.xml.bak files', tipText='If checked include *.xml.bak files') self.backupCheck.grid(row=row, column=1, columnspan=2, sticky=Tkinter.W) row = row + 1 self.dataCheck = CheckButton( guiParent, text='Include data files which are in project directory', tipText= 'If checked include data files if they are located in project directory' ) self.dataCheck.grid(row=row, column=1, columnspan=2, sticky=Tkinter.W) row = row + 1 labelFrame = LabelFrame(guiParent, text='Archive Location') labelFrame.grid(row=row, column=0, columnspan=3, sticky=Tkinter.NSEW) labelFrame.grid_rowconfigure(0, weight=1) labelFrame.grid_columnconfigure(0, weight=1) self.dirSelect = FileSelect(labelFrame, directory=directory, show_file=False) self.dirSelect.grid(row=0, column=0, sticky=Tkinter.NSEW) guiParent.grid_rowconfigure(row, weight=1) row = row + 1 texts = ['Save'] tipTexts = ['Create archive file'] commands = [self.save] buttons = createDismissHelpButtonList(guiParent, texts=texts, tipTexts=tipTexts, commands=commands, help_msg=self.help_msg, help_url=self.help_url, dismiss_text=self.dismiss_text, expands=True) buttons.grid(row=row, column=0, columnspan=3, sticky=Tkinter.EW)
def body(self, guiFrame): self.specFreqEntry = IntEntry(self, text=self.specFreq, width=8, returnCallback=self.setSpecFreq) self.maxIterEntry = IntEntry(self, text=self.maxIter, width=8, returnCallback=self.setMaxIter) self.mixTimeEntry = FloatEntry(self, text=self.mixTime, width=8, returnCallback=self.setMixTime) self.corrTimeEntry = FloatEntry(self, text=self.corrTime, width=8, returnCallback=self.setCorrTime) self.leakRateEntry = FloatEntry(self, text=self.leakRate, width=8, returnCallback=self.setLeakRate) guiFrame.grid_columnconfigure(0, weight=1) guiFrame.grid_rowconfigure(1, weight=1) row = 0 labelFrame0 = LabelFrame(guiFrame, text='Input data') labelFrame0.grid(row=row, column=0, sticky=Tkinter.NSEW) labelFrame0.grid_columnconfigure(3, weight=1) label = Label(labelFrame0, text='Assigned NOESY spectrum') label.grid(row=0, column=0, sticky=Tkinter.NW) self.noesyPulldown = PulldownMenu(labelFrame0, entries=self.getNoesys(), callback=self.setNoesy, selected_index=0, do_initial_callback=0) self.noesyPulldown.grid(row=0, column=1, sticky=Tkinter.NW) label = Label(labelFrame0, text='H/D ratio: ') label.grid(row=0, column=2, sticky=Tkinter.NW) self.ratioHDEntry = FloatEntry(labelFrame0, text=self.ratioHD, width=6) self.ratioHDEntry.grid(row=0, column=3, sticky=Tkinter.NW) label = Label(labelFrame0, text='NOESY spectrum 1:') label.grid(row=1, column=0, sticky=Tkinter.NW) self.tmix1Pulldown = PulldownMenu(labelFrame0, entries=self.getNoesys(), callback=self.setNoesy1, selected_index=-0, do_initial_callback=0) self.tmix1Pulldown.grid(row=1, column=1, sticky=Tkinter.NW) label = Label(labelFrame0, text='Tmix (ms): ') label.grid(row=1, column=2, sticky=Tkinter.NW) self.tmix1Entry = FloatEntry(labelFrame0, text=60, width=6) self.tmix1Entry.grid(row=1, column=3, sticky=Tkinter.NW) label = Label(labelFrame0, text='NOESY spectrum 2:') label.grid(row=2, column=0, sticky=Tkinter.NW) self.tmix2Pulldown = PulldownMenu(labelFrame0, entries=self.getNoesys(), callback=self.setNoesy2, selected_index=0, do_initial_callback=0) self.tmix2Pulldown.grid(row=2, column=1, sticky=Tkinter.NW) label = Label(labelFrame0, text='Tmix (ms): ') label.grid(row=2, column=2, sticky=Tkinter.NW) self.tmix2Entry = FloatEntry(labelFrame0, text=120, width=6) self.tmix2Entry.grid(row=2, column=3, sticky=Tkinter.NW) label = Label(labelFrame0, text='NOESY spectrum 3:') label.grid(row=3, column=0, sticky=Tkinter.NW) self.tmix3Pulldown = PulldownMenu(labelFrame0, entries=self.getNoesys(), callback=self.setNoesy3, selected_index=0, do_initial_callback=0) self.tmix3Pulldown.grid(row=3, column=1, sticky=Tkinter.NW) label = Label(labelFrame0, text='Tmix (ms): ') label.grid(row=3, column=2, sticky=Tkinter.NW) self.tmix3Entry = FloatEntry(labelFrame0, text=200, width=6) self.tmix3Entry.grid(row=3, column=3, sticky=Tkinter.NW) label = Label(labelFrame0, text='3D NOESY:') label.grid(row=4, column=0, sticky=Tkinter.NW) self.noesy3dPulldown = PulldownMenu(labelFrame0, entries=self.getNoesys3d(), callback=self.setNoesy3d, selected_index=0, do_initial_callback=0) self.noesy3dPulldown.grid(row=4, column=1, sticky=Tkinter.NW) label10 = Label(labelFrame0, text='Num peaks:') label10.grid(row=5, column=0, sticky=Tkinter.NW) self.numPeaksLabel = Label(labelFrame0, text='0') self.numPeaksLabel.grid(row=5, column=1, sticky=Tkinter.NW) label11 = Label(labelFrame0, text='Num resonances:') label11.grid(row=5, column=2, sticky=Tkinter.NW) self.numResonancesLabel = Label(labelFrame0, text='0') self.numResonancesLabel.grid(row=5, column=3, sticky=Tkinter.NW) row += 1 labelFrame1 = LabelFrame(guiFrame, text='Parameters') labelFrame1.grid(row=row, column=0, sticky=Tkinter.NSEW) labelFrame1.grid_columnconfigure(3, weight=1) label = Label(labelFrame1, text='15N labelled sample:') label.grid(row=0, column=0, sticky=Tkinter.NW) self.nitrogenSelect = CheckButton(labelFrame1, callback=self.setNitrogenLabel) self.nitrogenSelect.grid(row=0, column=1, sticky=Tkinter.W) self.nitrogenSelect.set(1) label = Label(labelFrame1, text='13C labelled sample:') label.grid(row=0, column=2, sticky=Tkinter.NW) self.carbonSelect = CheckButton(labelFrame1, callback=self.setCarbonLabel) self.carbonSelect.grid(row=0, column=3, sticky=Tkinter.W) self.carbonSelect.set(0) labelFrame1.grid_rowconfigure(1, weight=1) data = [ self.specFreq, self.maxIter, self.mixTime, self.corrTime, self.leakRate ] colHeadings = [ 'Spectrometer\nfrequency', 'Max\niterations', 'Mixing\ntime (ms)', 'Correl.\ntime (ns)', 'Leak\nrate' ] editWidgets = [ self.specFreqEntry, self.maxIterEntry, self.mixTimeEntry, self.corrTimeEntry, self.leakRateEntry, ] editGetCallbacks = [ self.getSpecFreq, self.getMaxIter, self.getMixTime, self.getCorrTime, self.getLeakRate, ] editSetCallbacks = [ self.setSpecFreq, self.setMaxIter, self.setMixTime, self.setCorrTime, self.setLeakRate, ] self.midgeParamsMatrix = ScrolledMatrix( labelFrame1, editSetCallbacks=editSetCallbacks, editGetCallbacks=editGetCallbacks, editWidgets=editWidgets, maxRows=1, initialCols=5, headingList=colHeadings, callback=None, objectList=[ 'None', ], textMatrix=[ data, ]) self.midgeParamsMatrix.grid(row=1, column=0, columnspan=4, sticky=Tkinter.NSEW) label10 = Label(labelFrame1, text='Benchmark structure') label10.grid(row=2, column=0, sticky=Tkinter.NW) self.structurePulldown = PulldownMenu(labelFrame1, entries=self.getStructures(), callback=self.setStructure, selected_index=0, do_initial_callback=0) self.structurePulldown.grid(row=2, column=1, sticky=Tkinter.NW) label11 = Label(labelFrame1, text='ADC atom types:') label11.grid(row=2, column=2, sticky=Tkinter.NW) self.adcAtomsPulldown = PulldownMenu(labelFrame1, entries=self.getAdcAtomTypes(), callback=self.setAdcAtomTypes, selected_index=0, do_initial_callback=0) self.adcAtomsPulldown.grid(row=2, column=3, sticky=Tkinter.NW) row += 1 labelFrame2 = LabelFrame(guiFrame, text='Output') labelFrame2.grid(row=row, column=0, sticky=Tkinter.NSEW) labelFrame2.grid_columnconfigure(3, weight=1) label20 = Label(labelFrame2, text='Distance constraints:') label20.grid(row=0, column=0, sticky=Tkinter.NW) self.distConstrLabel = Label(labelFrame2, text='0') self.distConstrLabel.grid(row=0, column=1, sticky=Tkinter.NW) label21 = Label(labelFrame2, text='Anti-distance constraints:') label21.grid(row=0, column=2, sticky=Tkinter.NW) self.antiConstrLabel = Label(labelFrame2, text='0') self.antiConstrLabel.grid(row=0, column=3, sticky=Tkinter.NW) texts = [ 'Calculate distances', 'Show distance\nconstraints', 'Show anti-distance\nconstraints' ] commands = [ self.calculateDistances, self.showConstraints, self.showAntiConstraints ] self.midgeButtons = ButtonList(labelFrame2, expands=1, texts=texts, commands=commands) self.midgeButtons.grid(row=1, column=0, columnspan=4, sticky=Tkinter.NSEW) row += 1 self.bottomButtons = createDismissHelpButtonList(guiFrame, expands=0, help_url=None) self.bottomButtons.grid(row=row, column=0, columnspan=4, sticky=Tkinter.EW) self.getPeaks() self.getResonances() self.update() self.geometry('600x400')
def body(self, parent): row = 0 columnspan = 3 if self.numDim != None: columnspan += 1 if self.topText: label = Label(parent, text=self.topText) label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) row = row + 1 if self.expName: expNameText = " for experiment '%s'" % self.expName else: expNameText = '' label = Label( parent, text= 'Select a reference experiment%s from the list below, then press Create' % expNameText) label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) row = row + 1 colHeadings = self.getHeadings() parent.grid_rowconfigure(row, weight=1, minsize=300) parent.grid_columnconfigure(0, weight=1, minsize=100) self.table = ScrolledMatrix(parent, headingList=colHeadings, callback=None) self.table.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.NSEW) row = row + 1 texts = ['Create'] commands = [ self.ok ] # This calls 'ok' in BasePopup, this then calls 'apply' in here if self.numDim != None: texts.append('Show all experiments') commands.append(self.showAll) buttons = createDismissHelpButtonList(parent, texts=texts, commands=commands, dismiss_text='Skip', help_url=self.help_url) buttons.grid(row=row, column=0) self.update()
def body(self, master): self.geometry('600x400') columnspan = 5 row = 0 label = Label(master, text="AutoAssign project file setup window.") label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.W) # # Set up the spectra # row += 1 label = Label(master, text="Spectrum type") label.grid(row=row, column=0, columnspan=2, sticky=Tkinter.W) label = Label(master, text="CCPN peak list") label.grid(row=row, column=2, columnspan=2, sticky=Tkinter.W) label = Label(master, text="Phase") # TODO What's this? label.grid(row=row, column=4, sticky=Tkinter.W) self.spectrumSelectWidget = {} self.spectrumPhaseWidget = {} for i in range(len(self.autoAssignProjectFile.defaultSpectra)): row += 1 specType = self.autoAssignProjectFile.defaultSpectra[i][0] if i == 0: labelText = "%s (root)" % specType else: labelText = "%s" % specType label = Label(master, text=labelText) label.grid(row=row, column=0, columnspan=2, sticky=Tkinter.W) self.spectrumSelectWidget[specType] = PulldownMenu( master, entries=self.peakNameList) self.spectrumSelectWidget[specType].grid(row=row, column=2, columnspan=2, sticky=Tkinter.W) self.spectrumPhaseWidget[specType] = Entry(master, text="", width=4) self.spectrumPhaseWidget[specType].grid(row=row, column=4, sticky=Tkinter.W) # # Make a break... # row += 1 separator = Separator(master, height=3) separator.setColor('black', bgColor='black') separator.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) # # Set up the tolerances # row += 1 label = Label(master, text="Atom tolerances") label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) toleranceAtoms = self.autoAssignProjectFile.toleranceAtoms toleranceDefault = self.autoAssignProjectFile.toleranceDefault self.toleranceWidget = {} for i in range(0, len(toleranceAtoms), 2): row += 1 for j in range(2): curPos = i + j if curPos == len(toleranceAtoms): break toleranceAtom = toleranceAtoms[curPos] label = Label(master, text=toleranceAtom) label.grid(row=row, column=2 * j, sticky=Tkinter.E) self.toleranceWidget[toleranceAtom] = Entry( master, text=str(toleranceDefault[curPos]), width=6) self.toleranceWidget[toleranceAtom].grid(row=row, column=1 + 2 * j, sticky=Tkinter.W) # # Make a break... # row += 1 separator = Separator(master, height=3) separator.setColor('black', bgColor='black') separator.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) row += 1 label = Label( master, text="Will save the peak files in the project file directory.", fg='red') label.grid(row=row, column=0, columnspan=columnspan, sticky=Tkinter.EW) 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, help_url=self.help_url) buttons.grid(row=row, columnspan=columnspan, column=0)
def body(self, master): # Master is the owner widget (not self.parent) - parent of the widget here # # Popup window # self.entries = [] self.labels = [] value = 0 row = 0 label = Label(master, text="Window function:") label.grid(row=row, column=0, sticky=Tkinter.EW) self.menuRow = row self.menu = PulldownMenu(master, entries=self.windowFuncList, selected_index=self.winFuncIndex) self.menu.grid(row=row, column=1, sticky=Tkinter.W, ipadx=20) self.menulabel = Label( master, text="(" + self.windowFunctions[self.format][self.winFuncIndex][1] + ")") self.menulabel.grid(row=row, column=2, sticky=Tkinter.E) # # Setup arguments - make room for four # for argIndex in range(0, self.maxArgs): row = row + 1 try: argRef = self.windowFunctions[self.format][ self.winFuncIndex][2][argIndex] argName = argRef[0] argValue = argRef[1] except: argName = None argValue = None self.labels.append(Label(master, text="%s" % argName)) self.labels[-1].grid(row=row, column=0, sticky=Tkinter.EW) self.entries.append(Entry(master, text=str(argValue))) self.entries[-1].grid(row=row, column=1, columnspan=2, sticky=Tkinter.W) if not argName: self.labels[-1].grid_forget() self.entries[-1].grid_forget() # # Add callback to menu after setup # self.menu.callback = self.updateWindow 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, help_url=self.help_url) buttons.grid(row=row, column=0, columnspan=3)
def body(self, master): self.geometry('700x500') # # Setup header # row = 0 label = Label(master, text='Original', width=10) label.grid(row=row, column=0, sticky=Tkinter.EW) label = Label(master, text='Modify ChemCompVar', width=35) label.grid(row=row, column=1, sticky=Tkinter.EW) label = Label(master, text='Status', width=20) label.grid(row=row, column=2, sticky=Tkinter.EW) label = Label(master, text='', width=5) label.grid(row=row, column=3, sticky=Tkinter.EW) row += 1 label = Label(master, text='code', width=10) label.grid(row=row, column=0, sticky=Tkinter.EW) label = Label(master, text='ccpCode (molType): linking, descriptor', width=35) label.grid(row=row, column=1, sticky=Tkinter.EW) label = Tkinter.Button(master, text='Add new molecule', command=self.addNewMolecule) label.grid(row=row, column=2) row += 1 separator = Separator(master, height=3) separator.setColor('black', bgColor='black') separator.grid(row=row, columnspan=3, sticky=Tkinter.EW) row += 1 # THIS BIT TELLS MASTER TO CONFIGURE WINDOW ON INSIDE WIDGET!! master.grid_rowconfigure(row, weight=1) for i in range(4): master.grid_columnconfigure(i, weight=1) self.sequenceFrame = ScrolledFrame(master, width=70, height=300, doExtraConfig=False) self.sequenceFrame.grid(row=row, column=0, columnspan=4, sticky=Tkinter.NSEW) self.sequenceFrameRow = row self.sequenceFrameMaster = master row += 1 separator = Separator(master, height=3) separator.setColor('black', bgColor='black') separator.grid(row=row, columnspan=3, sticky=Tkinter.EW) row += 1 texts = ['Change', 'Change and quit'] commands = [ self.updateMolDict, self.ok ] # This calls 'ok' in BasePopup, this then calls 'apply' in here buttons = createDismissHelpButtonList(master, texts=texts, commands=commands, dismiss_text='Cancel', help_url=self.help_url) buttons.grid(row=row, column=0, columnspan=3, sticky=Tkinter.EW) self.setupSequenceFrame()