本文整理汇总了Python中qtpy.QtWidgets.QFileDialog.getExistingDirectory方法的典型用法代码示例。如果您正苦于以下问题:Python QFileDialog.getExistingDirectory方法的具体用法?Python QFileDialog.getExistingDirectory怎么用?Python QFileDialog.getExistingDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QFileDialog
的用法示例。
在下文中一共展示了QFileDialog.getExistingDirectory方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: output_dir_button_clicked
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def output_dir_button_clicked(self):
_output_folder = QFileDialog.getExistingDirectory(caption="Select Output Folder ...",
directory=self.parent.output_folder,
options=QFileDialog.ShowDirsOnly)
if _output_folder:
self.ui.output_dir_label.setText(str(_output_folder))
self.parent.output_folder = str(_output_folder)
示例2: cache_dir_button_clicked
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def cache_dir_button_clicked(self):
_cache_folder = QFileDialog.getExistingDirectory(caption="Select Cache Folder ...",
directory=self.parent.cache_folder,
options=QFileDialog.ShowDirsOnly)
if _cache_folder:
self.ui.cache_dir_label.setText(str(_cache_folder))
self.parent.cache_folder = str(_cache_folder)
示例3: get_directory_name_for_saving
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def get_directory_name_for_saving(self):
"""
Pops up a directory selection dialogue
:return : The path to the directory
"""
# Note that the native dialog does not always show the files
# in the directory on Linux, but using the non-native dialog
# is not very pleasant on Windows or Mac
directory = QFileDialog.getExistingDirectory(caption='Select folder for exported plots')
return directory
示例4: _savedir_browse
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def _savedir_browse(self):
save_dir = QFileDialog.getExistingDirectory(self, "Output Directory - Choose a directory",
os.path.expanduser('~'),
QFileDialog.ShowDirsOnly
| QFileDialog.DontResolveSymlinks)
if not save_dir:
return
if isinstance(save_dir, tuple):
save_dir = save_dir[0]
self._content.savedir_edit.setText(save_dir)
示例5: _output_dir_browse
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def _output_dir_browse(self):
output_dir = QFileDialog.getExistingDirectory(self, "Output Directory - Choose a directory",
os.path.expanduser('~'),
QFileDialog.ShowDirsOnly
| QFileDialog.DontResolveSymlinks)
if not output_dir:
return
if isinstance(output_dir, tuple):
output_dir = output_dir[0]
self._summary.output_dir_edit.setText(output_dir)
self._settings.emit_key_value("OUTPUT_DIR", output_dir)
示例6: target_autonom_clicked
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def target_autonom_clicked(self):
_autonom_folder = QFileDialog.getExistingDirectory(caption="Select Output autoNOM Folder ...",
directory=self.parent.current_folder,
options=QFileDialog.ShowDirsOnly)
if not _autonom_folder:
return
if isinstance(_autonom_folder, tuple):
_autonom_folder = _autonom_folder[0]
_autonom_folder = os.path.basename(_autonom_folder)
self.ui.target_autonom_value.setText(str(_autonom_folder))
self.check_status_transfer_button()
示例7: dir_browse_dialog
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def dir_browse_dialog(self):
"""
Pop up a directory dialog box.
@param data_type: string used to filter the files
@param title: string to use as title
@param multi: multiselection is enabled if True
"""
dirname = QFileDialog.getExistingDirectory(self, "Select Directory")
if isinstance(dirname, tuple):
dirname = dirname[0]
return dirname
示例8: move_to_folder
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def move_to_folder(self):
_new_folder = QFileDialog.getExistingDirectory(parent=self.main_window,
caption="Select working directory",
directory=self.current_folder)
if not _new_folder:
self.user_canceled = True
else:
if isinstance(_new_folder, tuple):
_new_folder = _new_folder[0]
os.chdir(_new_folder)
self.main_window.current_folder = _new_folder
self.main_window.setWindowTitle(_new_folder)
示例9: browse_folder
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def browse_folder(self):
_current_folder = self.current_folder
_caption = "Select Output Folder"
_folder = QFileDialog.getExistingDirectory(parent=self.parent,
caption=_caption,
directory=_current_folder)
if not _folder:
return
if isinstance(_folder, tuple):
_folder = _folder[0]
self.parent.ui.mantid_output_directory_value.setText(str(_folder) + self._output_ext)
示例10: source_ipts_clicked
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def source_ipts_clicked(self):
_ipts_folder = QFileDialog.getExistingDirectory(caption="Select Input IPTS Folder ...",
directory=self.ipts_folder,
options=QFileDialog.ShowDirsOnly)
if not _ipts_folder:
return
if isinstance(_ipts_folder, tuple):
_ipts_folder = _ipts_folder[0]
self.ipts_folder = _ipts_folder
_ipts_folder = os.path.basename(_ipts_folder)
_ipts_number = _ipts_folder.split('-')[1]
self.ui.source_ipts_value.setText(str(_ipts_number))
self.check_status_transfer_button()
示例11: select_working_folder
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def select_working_folder(self):
_current_folder = self.main_window.current_folder
_new_folder = QFileDialog.getExistingDirectory(parent=self.main_window,
caption="Select working directory",
directory=_current_folder)
if not _new_folder:
return
if isinstance(_new_folder, tuple):
_new_folder = _new_folder[0]
self.main_window.current_folder = _new_folder
# o_gui = Step1GuiHandler(parent=self.main_window)
# o_gui.set_main_window_title()
self.set_main_window_title()
# move to new folder specifiy
os.chdir(_new_folder)
o_auto_populate = AutoPopulateWidgets(main_window=self.main_window)
o_auto_populate.run()
示例12: do_browse_local_cache_dir
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def do_browse_local_cache_dir(self):
""" Browse local cache directory
:return:
"""
local_cache_dir = QFileDialog.getExistingDirectory(self, 'Get Local Cache Directory', self._homeSrcDir)
if isinstance(local_cache_dir, tuple):
local_cache_dir = local_cache_dir[0]
# Set local directory to control
status, error_message = self._myControl.set_local_data_dir(local_cache_dir)
if status is False:
self.pop_one_button_dialog(error_message)
return
# Synchronize to local data/spice directory and local cache directory
# if str(self.ui.lineEdit_localSpiceDir.text()) != '':
# prev_dir = str(self.ui.lineEdit_localSrcDir.text())
# self.pop_one_button_dialog('Local data directory was set up as %s' %
# prev_dir)
self.ui.lineEdit_localSrcDir.setText(local_cache_dir)
示例13: getexistingdirectory
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def getexistingdirectory(parent=None, caption='', basedir='',
options=QFileDialog.ShowDirsOnly):
"""Wrapper around QtGui.QFileDialog.getExistingDirectory static method
Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0"""
# Calling QFileDialog static method
if sys.platform == "win32":
# On Windows platforms: redirect standard outputs
_temp1, _temp2 = sys.stdout, sys.stderr
sys.stdout, sys.stderr = None, None
try:
result = QFileDialog.getExistingDirectory(parent, caption, basedir,
options)
finally:
if sys.platform == "win32":
# On Windows platforms: restore standard outputs
sys.stdout, sys.stderr = _temp1, _temp2
if not is_text_string(result):
# PyQt API #1
result = to_text_string(result)
return result
示例14: do_browse_output_dir
# 需要导入模块: from qtpy.QtWidgets import QFileDialog [as 别名]
# 或者: from qtpy.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def do_browse_output_dir(self):
"""
browse the output directory
:return:
"""
# get scan number or numbers
try:
exp_number = self.get_exp_number()
except RuntimeError as run_err:
gui_util.show_message(self, '[ERROR] {0}'.format(run_err))
return
default_dir = os.path.join('/HFIR/HB3A/Exp{0}/shared/'.format(exp_number))
# get output directory
output_dir = QFileDialog.getExistingDirectory(self, 'Outputs for pre-processed scans', default_dir)
if not output_dir:
return
if isinstance(output_dir, tuple):
output_dir = output_dir[0]
self.ui.lineEdit_outputDir.setText(output_dir)