def chooseOldProjectFile(self): fileTypes = [ FileType('CING', ['project.xml']), FileType('All', ['*']) ] popup = FileSelectPopup(self, file_types = fileTypes, title = 'Select CING project file', dismiss_text = 'Cancel', selected_file_must_exist = True) fileName = popup.getFile() # dirName = popup.getDirectory() if len(fileName) > 0: # Put text into entry,name widgets dummy,name = cing.Project.rootPath(fileName) self.projEntry.configure(state='normal') self.projEntry.set(fileName) self.nameEntry.configure(state='normal') self.nameEntry.set(name) self.nameEntry.configure(state='disabled') # choose the correct radiobutton self.projOptionsSelect.setIndex(0) self.updateGui() # end if #nd if popup.destroy()
def chooseOldProjectFile(self): fileTypes = [FileType('CING', ['project.xml']), FileType('All', ['*'])] popup = FileSelectPopup(self, file_types=fileTypes, title='Select CING project file', dismiss_text='Cancel', selected_file_must_exist=True) fileName = popup.getFile() # dirName = popup.getDirectory() if len(fileName) > 0: # Put text into entry,name widgets dummy, name = cing.Project.rootPath(fileName) self.projEntry.configure(state='normal') self.projEntry.set(fileName) self.nameEntry.configure(state='normal') self.nameEntry.set(name) self.nameEntry.configure(state='disabled') # choose the correct radiobutton self.projOptionsSelect.setIndex(0) self.updateGui() # end if #nd if popup.destroy()
def selectDir(self): popup = FileSelectPopup(self, show_file=False) dir = popup.getDirectory() popup.destroy() if (dir): self.dir_entry.set(dir) self.setDir()
def selectExecutable(self): """ Choose the MODULE executable appropriate for your system. """ popup = FileSelectPopup(self, show_file=True) executable = popup.getFile() if executable: self.moduleExeEntry.set(executable) popup.destroy()
def selectWorkingDir(self): popup = FileSelectPopup(self, show_file=False) directory = popup.getDirectory() if directory: self.workingDirEntry.set(directory) popup.destroy() self.updateAfter()
def selectTempDir(self): popup = FileSelectPopup(self, show_file=False) directory = popup.getDirectory() if directory: self.tempDirEntry.set( directory ) popup.destroy() self.updateEntryParams()
def chooseMiscScript(self): # Prepend default Cyana file extension below fileTypes = [ FileType('All', ['*']), ] popup = FileSelectPopup(self, file_types = fileTypes, title = 'Script file', dismiss_text = 'Cancel', selected_file_must_exist = True) fileName = popup.getFile() self.miscScriptEntry.set(fileName) popup.destroy()
def chooseValidScript(self): # Prepend default Cyana file extension below fileTypes = [ FileType('Python', ['*.py']), ] popup = FileSelectPopup(self, file_types = fileTypes, title='Python file', dismiss_text='Cancel', selected_file_must_exist = True) fileName = popup.getFile() self.validScriptEntry.set(fileName) popup.destroy()
def chooseDirectory(self): directory = os.path.dirname(self.fileName) if not directory: directory = os.getcwd() popup = FileSelectPopup(self, directory=directory, show_file=False) directory = popup.getDirectory() popup.destroy() if directory: self.directoryEntry.set(directory)
def chooseZipFile(self): fileTypes = [ FileType('Zip', ['*.zip']), ] popup = FileSelectPopup(self, file_types=fileTypes, file=self.resultFileEntry.get(), title='Results zip file location', dismiss_text='Cancel', selected_file_must_exist=False) fileName = popup.getFile() if fileName: self.resultFileEntry.set(fileName) popup.destroy()
def selectFile(self): spectrum = self.spectrum if spectrum: directory = spectrum.analysisSpectrum.contourDir.dataLocation else: directory = os.getcwd() popup = FileSelectPopup(self, directory=directory) fileName = popup.getFile() popup.destroy() if fileName: self.file_entry.set(fileName)
def chooseFile(self): directory = self.directoryEntry.get() if not directory: directory = os.getcwd() popup = FileSelectPopup(self, directory=directory) file = popup.getFile() popup.destroy() if file: template = os.path.basename(file) self.templateEntry.set(template)
def selectCnsExe(self): fileTypes = [ FileType("All", ["*"]), FileType("EXE", ["*.exe"]) ] popup = FileSelectPopup(self, fileTypes) file = popup.getFile() if file: self.cnsExeEntry.set( file ) popup.destroy() self.updateEntryParams()
def chooseCyanaFile(self): # Prepend default Cyana file extension below fileTypes = [ FileType('All', ['*']), ] popup = FileSelectPopup(self, file_types = fileTypes, title = 'CYANA fproject file', dismiss_text = 'Cancel', selected_file_must_exist = True) fileName = popup.getFile() self.cyanaEntry.set(fileName) self.projOptionsSelect.setIndex(3) popup.destroy()
def askDir(title, prompt, initial_value = '', parent = None, dismiss_text='Cancel', extra_dismiss_text = '', default_dir = None): if (parent): popup = FileSelectPopup(parent, title=title, prompt=prompt, show_file=False, dismiss_text=dismiss_text, extra_dismiss_text=extra_dismiss_text, file=initial_value, default_dir = default_dir) dir = popup.getDirectory() popup.destroy() return dir else: return askString(title, prompt, initial_value)
def askFile(title, prompt, initial_value = '', parent = None, dismiss_text='Cancel', extra_dismiss_text = ''): if (parent): popup = FileSelectPopup(parent, title=title, prompt=prompt, show_file=True, dismiss_text=dismiss_text, extra_dismiss_text=extra_dismiss_text, file=initial_value) file = popup.getFile() popup.destroy() return file else: return askString(title, prompt, initial_value)
def findFile(self): format = self.format_menu.getSelected() if (format == tabFormat): file_types = [FileType('All', ['*']), FileType('Text', ['*.txt'])] else: file_types = [FileType('All', ['*']), FileType('CSV', ['*.csv'])] popup = FileSelectPopup(self, file_types=file_types) file = popup.getFile() if (file): self.file_entry.set(file) popup.destroy()
def getDataUrl(self, *extra): if self.dataStore: dataStore = self.dataStore oldPath = dataStore.dataUrl.url.dataLocation if os.path.exists(oldPath): directory = oldPath elif os.path.exists(os.path.dirname(oldPath)): directory = os.path.dirname(oldPath) else: directory = None popup = FileSelectPopup(self, directory=directory, show_file=False) newPath = popup.getDirectory() popup.destroy() if newPath and oldPath != newPath: changeDataStoreUrl(dataStore, newPath)
def chooseCyanaFile(self): # Prepend default Cyana file extension below fileTypes = [ FileType('All', ['*']), ] popup = FileSelectPopup(self, file_types=fileTypes, title='CYANA fproject file', dismiss_text='Cancel', selected_file_must_exist=True) fileName = popup.getFile() self.cyanaEntry.set(fileName) self.projOptionsSelect.setIndex(3) popup.destroy()
def chooseCcpnFile(self): fileTypes = [ FileType('XML', ['*.xml']), FileType('All', ['*'])] popup = FileSelectPopup(self, file_types = fileTypes, title = 'CCPN project XML file', dismiss_text = 'Cancel', selected_file_must_exist = True) fileName = popup.getFile() if len(fileName)>0: self.pdbEntry.configure(state='normal') self.pdbEntry.set(fileName) self.projOptionsSelect.setIndex(1) _dir,name,dummy = nTpath( fileName ) self.nameEntry.set(name) #end if self.ccpnEntry.set(fileName) self.projOptionsSelect.setIndex(2) popup.destroy()
def choosePdbFile(self): fileTypes = [ FileType('PDB', ['*.pdb']), FileType('All', ['*'])] popup = FileSelectPopup(self, file_types = fileTypes, title = 'PDB file', dismiss_text = 'Cancel', selected_file_must_exist = True) fileName = popup.getFile() if len(fileName)>0: # Put text into entry widget self.pdbEntry.configure(state='normal') self.pdbEntry.set(fileName) # Put text into name widget _dir,name,dummy = nTpath( fileName ) self.nameEntry.configure(state='normal') self.nameEntry.set(name) # choose the correct radiobutton self.projOptionsSelect.setIndex(1) self.updateGui() #end if popup.destroy()
def getDataPath(self, *extra): if self.dataStore: dataStore = self.dataStore oldPath = dataStore.fullPath directory = file = '' if os.path.exists(oldPath): file = oldPath elif os.path.exists(os.path.dirname(oldPath)): directory = os.path.dirname(oldPath) elif os.path.exists(dataStore.dataUrl.url.dataLocation): directory = dataStore.dataUrl.url.dataLocation popup = FileSelectPopup(self, file=file, directory=directory) newPath = popup.getFile() popup.destroy() if newPath and oldPath != newPath: pp = dataStore.dataUrl.url.dataLocation if newPath.startswith(pp): newPath = newPath[len(pp) + 1:] dataStore.path = newPath else: setDataStoreFileName(dataStore, newPath)
def chooseCcpnFile(self): fileTypes = [FileType('XML', ['*.xml']), FileType('All', ['*'])] popup = FileSelectPopup(self, file_types=fileTypes, title='CCPN project XML file', dismiss_text='Cancel', selected_file_must_exist=True) fileName = popup.getFile() if len(fileName) > 0: self.pdbEntry.configure(state='normal') self.pdbEntry.set(fileName) self.projOptionsSelect.setIndex(1) _dir, name, dummy = nTpath(fileName) self.nameEntry.set(name) #end if self.ccpnEntry.set(fileName) self.projOptionsSelect.setIndex(2) popup.destroy()
def selectModuleBvExport(self): """ Choose the Back Value file that was exported from MODULE. """ file_types = [ FileType("Back Value files", ["*.back"]), FileType("All files", ["*"]) ] popup = FileSelectPopup(self, file_types, dismiss_text='Cancel', show_file=True) chosenBvFile = popup.getFile() if os.path.isfile(chosenBvFile): moduleBackValueFile = chosenBvFile else: warnPopup = showWarning('MODULE', 'File %s not found.' % chosenBvFile, parent=self) return None popup.destroy() return moduleBackValueFile
def choosePdbFile(self): fileTypes = [FileType('PDB', ['*.pdb']), FileType('All', ['*'])] popup = FileSelectPopup(self, file_types=fileTypes, title='PDB file', dismiss_text='Cancel', selected_file_must_exist=True) fileName = popup.getFile() if len(fileName) > 0: # Put text into entry widget self.pdbEntry.configure(state='normal') self.pdbEntry.set(fileName) # Put text into name widget _dir, name, dummy = nTpath(fileName) self.nameEntry.configure(state='normal') self.nameEntry.set(name) # choose the correct radiobutton self.projOptionsSelect.setIndex(1) self.updateGui() #end if popup.destroy()