示例#1
0
 def loadTxt(self):
     try:
         filePath, __ = QFileDialog.getOpenFileNameAndFilter(
             self,
             'Select tab or space delimited text file containing station and elevation data'
         )  # QGIS2 (using this rather than getOpenFileName will avoid opening a dialog twice)
     except:
         filePath, __ = QFileDialog.getOpenFileName(
             self,
             'Select tab or space delimited text file containing station and elevation data'
         )
     # fix_print_with_import
     print(filePath)
     try:
         self.staElev = np.loadtxt(filePath)
         self.inputFile.setText(filePath)
         self.calcType = 'UD'
         self.doIrregularProfileFlowEstimator()
     except:
         if (filePath == ('')):  # null string for cancel
             return
         QMessageBox.warning(
             self, 'Error',
             'Please check that the text file is space or tab delimited and does not contain header information'
         )
示例#2
0
    def chooseInputFile(self):
        vectorFormats = QgsProviderRegistry.instance().fileVectorFilters()
        # get last used dir and format
        settings = QSettings()
        lastDir = settings.value("/db_manager/lastUsedDir", "")
        lastVectorFormat = settings.value("/UI/lastVectorFileFilter", "")
        # ask for a filename
        (filename, lastVectorFormat) = QFileDialog.getOpenFileNameAndFilter(self, self.tr("Choose the file to import"),
                                                                            lastDir, vectorFormats, lastVectorFormat)
        if filename == "":
            return
        # store the last used dir and format
        settings.setValue("/db_manager/lastUsedDir", QFileInfo(filename).filePath())
        settings.setValue("/UI/lastVectorFileFilter", lastVectorFormat)

        self.cboInputLayer.setEditText(filename)
示例#3
0
    def chooseInputFile(self):
        vectorFormats = QgsProviderRegistry.instance().fileVectorFilters()
        # get last used dir and format
        settings = QSettings()
        lastDir = settings.value("/db_manager/lastUsedDir", "")
        lastVectorFormat = settings.value("/UI/lastVectorFileFilter", "")
        # ask for a filename
        (filename, lastVectorFormat) = QFileDialog.getOpenFileNameAndFilter(self, self.tr("Choose the file to import"),
                                                                            lastDir, vectorFormats, lastVectorFormat)
        if filename == "":
            return
        # store the last used dir and format
        settings.setValue("/db_manager/lastUsedDir", QFileInfo(filename).filePath())
        settings.setValue("/UI/lastVectorFileFilter", lastVectorFormat)

        self.cboInputLayer.setEditText(filename)