本文整理匯總了Python中qgis.PyQt.QtWidgets.QFileDialog.getExistingDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Python QFileDialog.getExistingDirectory方法的具體用法?Python QFileDialog.getExistingDirectory怎麽用?Python QFileDialog.getExistingDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qgis.PyQt.QtWidgets.QFileDialog
的用法示例。
在下文中一共展示了QFileDialog.getExistingDirectory方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: show_selection_dialog
# 需要導入模塊: from qgis.PyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
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))
示例2: askForFolder
# 需要導入模塊: from qgis.PyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
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
示例3: __import_data
# 需要導入模塊: from qgis.PyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
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())
示例4: askForFolder
# 需要導入模塊: from qgis.PyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
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
示例5: on_parentFolderButton_clicked
# 需要導入模塊: from qgis.PyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
def on_parentFolderButton_clicked(self):
'''
Opens the dialog to select the folder
'''
folder = QFileDialog.getExistingDirectory(self, self.tr('Select Directory'))
self.parentFolderEdit.setText(folder)
示例6: on_copyFilesButton_clicked
# 需要導入模塊: from qgis.PyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
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)
示例7: on_addFolderButton_clicked
# 需要導入模塊: from qgis.PyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
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))
示例8: on_outputFolderButton_clicked
# 需要導入模塊: from qgis.PyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
def on_outputFolderButton_clicked(self):
'''
Defines the output folder
'''
folder = QFileDialog.getExistingDirectory(self, self.tr("Select Directory"))
self.outputFolderEdit.setText(folder)