Example #1
0
    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()
Example #2
0
    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()
Example #3
0
    def selectDir(self):

        popup = FileSelectPopup(self, show_file=False)
        dir = popup.getDirectory()
        popup.destroy()

        if (dir):
            self.dir_entry.set(dir)
            self.setDir()
Example #4
0
    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()
Example #5
0
    def selectWorkingDir(self):

        popup = FileSelectPopup(self, show_file=False)

        directory = popup.getDirectory()
        if directory:
            self.workingDirEntry.set(directory)

        popup.destroy()
        self.updateAfter()
Example #6
0
  def selectTempDir(self):
    
    popup = FileSelectPopup(self, show_file=False)

    directory = popup.getDirectory()
    if directory:
      self.tempDirEntry.set( directory )
    
    popup.destroy()
    self.updateEntryParams()
Example #7
0
    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()
Example #8
0
  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()
Example #9
0
    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)
Example #10
0
  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()
Example #11
0
    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)
Example #12
0
    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)
Example #13
0
  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()
Example #14
0
    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()
Example #15
0
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)
Example #16
0
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)
Example #17
0
    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()
Example #18
0
    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)
Example #19
0
    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()
Example #20
0
    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()
Example #21
0
    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()
Example #22
0
    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)
Example #23
0
    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()
Example #24
0
    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
Example #25
0
    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()