Python qgis.PyQt.QtWidgets.QFileDialog.getExistingDirectory() Examples
The following are 8
code examples of qgis.PyQt.QtWidgets.QFileDialog.getExistingDirectory().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
qgis.PyQt.QtWidgets.QFileDialog
, or try the search function
.
Example #1
Source File: file_selection_widget.py From quickmapservices with GNU General Public License v2.0 | 6 votes |
def show_selection_dialog(self): # Find the file dialog's working directory settings = QSettings() text = self.leText.text() if os.path.isdir(text): path = text elif os.path.isdir(os.path.dirname(text)): path = os.path.dirname(text) else: path = PluginSettings.last_icon_path() if self.is_folder: folder = QFileDialog.getExistingDirectory(self, self.dialog_title, path) if folder: self.leText.setText(folder) PluginSettings.set_last_icon_path(os.path.dirname(folder)) else: filename = getOpenFileName(self, self.dialog_title, path, self.ext) if filename: self.leText.setText(filename) PluginSettings.set_last_icon_path(os.path.dirname(filename))
Example #2
Source File: QgsFmvUtils.py From QGISFMV with GNU General Public License v3.0 | 5 votes |
def askForFolder(parent, msg=None, options=QFileDialog.ShowDirsOnly): ''' dialog for save or load folder ''' msg = msg or 'Select folder' caller = _callerName().split(".") name = "/".join(["LAST_PATH", caller[-1]]) namespace = caller[0] path = pluginSetting(name, namespace) folder = QFileDialog.getExistingDirectory(parent, msg, path, options) if folder: setPluginSetting(name, folder, namespace) return folder
Example #3
Source File: plugin.py From albion with GNU General Public License v3.0 | 5 votes |
def __import_data(self): assert(self.project) dir_ = QFileDialog.getExistingDirectory( None, u"Data directory", QgsProject.instance().readEntry("albion", "last_dir", "")[0], QFileDialog.ShowDirsOnly | QFileDialog.DontUseNativeDialog ) if not dir_: return QgsProject.instance().writeEntry("albion", "last_dir", dir_), progressMessageBar = self.__iface.messageBar().createMessage( "Loading {}...".format(dir_) ) progress = QProgressBar() progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) progressMessageBar.layout().addWidget(progress) self.__iface.messageBar().pushWidget(progressMessageBar) self.project.import_data(dir_, ProgressBar(progress)) #self.project.triangulate() self.project.create_section_view_0_90(4) self.__iface.messageBar().clearWidgets() collar = QgsProject.instance().mapLayersByName("collar") if len(collar): collar[0].reload() collar[0].updateExtents() self.__iface.setActiveLayer(collar[0]) QApplication.instance().processEvents() while self.__iface.mapCanvas().isDrawing(): QApplication.instance().processEvents() self.__iface.zoomToActiveLayer() self.__iface.actionSaveProject().trigger() self.__viewer3d.widget().resetScene(self.project) self.__current_section.clear() self.__current_section.addItems(self.project.sections())
Example #4
Source File: heatmapDialog.py From qgis-d3datavis-plugin with GNU General Public License v2.0 | 5 votes |
def askForFolder(parent, name="HeatmapPath"): path = getSetting(LAST_PATH, name) folder = QFileDialog.getExistingDirectory(parent, "Select folder to store chart", path) if folder: setSetting(LAST_PATH, name, folder) return folder
Example #5
Source File: inventoryTools.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def on_parentFolderButton_clicked(self): ''' Opens the dialog to select the folder ''' folder = QFileDialog.getExistingDirectory(self, self.tr('Select Directory')) self.parentFolderEdit.setText(folder)
Example #6
Source File: inventoryTools.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def on_copyFilesButton_clicked(self): ''' Opens the dialog to define the copy destination folder ''' folder = QFileDialog.getExistingDirectory(self, self.tr('Select Directory')) self.destinationFolderEdit.setText(folder)
Example #7
Source File: processingTools.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def on_addFolderButton_clicked(self): ''' Adds a folder to be processed ''' folder = QFileDialog.getExistingDirectory(self, self.tr("Select Directory")) for dirName, subdirList, fileList in os.walk(folder): for fileName in fileList: if fileName.split(".")[-1] == 'tif': self.fileListWidget.addItem(os.path.join(dirName,fileName))
Example #8
Source File: processingTools.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def on_outputFolderButton_clicked(self): ''' Defines the output folder ''' folder = QFileDialog.getExistingDirectory(self, self.tr("Select Directory")) self.outputFolderEdit.setText(folder)