當前位置: 首頁>>代碼示例>>Python>>正文


Python QFileDialog.getExistingDirectory方法代碼示例

本文整理匯總了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)
開發者ID:neutrons,項目名稱:FastGR,代碼行數:9,代碼來源:advanced_file_window.py

示例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)
開發者ID:neutrons,項目名稱:FastGR,代碼行數:9,代碼來源:advanced_file_window.py

示例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
開發者ID:mantidproject,項目名稱:mantid,代碼行數:12,代碼來源:view.py

示例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)
開發者ID:samueljackson92,項目名稱:mantid,代碼行數:12,代碼來源:dgs_sample_setup.py

示例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)
開發者ID:mantidproject,項目名稱:mantid,代碼行數:13,代碼來源:eqsans_instrument.py

示例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()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:13,代碼來源:ipts_file_transfer_dialog.py

示例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
開發者ID:mantidproject,項目名稱:mantid,代碼行數:14,代碼來源:base_widget.py

示例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)
開發者ID:neutrons,項目名稱:FastGR,代碼行數:14,代碼來源:step2_gui_handler.py

示例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)
開發者ID:neutrons,項目名稱:FastGR,代碼行數:15,代碼來源:browse_file_folder_handler.py

示例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()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:15,代碼來源:ipts_file_transfer_dialog.py

示例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()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:21,代碼來源:step1_gui_handler.py

示例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)
開發者ID:mantidproject,項目名稱:mantid,代碼行數:22,代碼來源:downloaddialog.py

示例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
開發者ID:astrofrog,項目名稱:specviz,代碼行數:22,代碼來源:compat.py

示例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)
開發者ID:mantidproject,項目名稱:mantid,代碼行數:23,代碼來源:PreprocessWindow.py


注:本文中的qtpy.QtWidgets.QFileDialog.getExistingDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。