当前位置: 首页>>代码示例>>Python>>正文


Python QFileDialog.getExistingDirectory方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QFileDialog.getExistingDirectory方法的典型用法代码示例。如果您正苦于以下问题:Python QFileDialog.getExistingDirectory方法的具体用法?Python QFileDialog.getExistingDirectory怎么用?Python QFileDialog.getExistingDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QFileDialog的用法示例。


在下文中一共展示了QFileDialog.getExistingDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_saveoutput_corr_released

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def on_saveoutput_corr_released(self):

        selected_directory8 = QFileDialog.getExistingDirectory()

        if not selected_directory8:
            return

        if os.path.isdir(str(selected_directory8) + '/output_corr'):

        	QMessageBox.critical(None, "Message", "This directory already exists in this directory")
        else:
            shutil.copytree(DIR2 + '/output_files_corr', str(selected_directory8) + '/output_corr')
            path = DIR2 + '/output_files_corr'
            dirs = os.listdir(path)
            os.chdir(DIR2 + '/output_files_corr')
            for i in range(len(dirs)):
                os.remove(dirs[i])
            os.chdir(DIR)

################################################################
#                         UPDATES
################################################################ 
开发者ID:stephaniedurand,项目名称:SeisTomoPy_V3,代码行数:24,代码来源:seistomopy_gui.py

示例2: changeFolder

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def changeFolder(self, button):
        # get download_path from lineEdit
        download_path = self.download_folder_lineEdit.text()

        # open select folder dialog
        fname = QFileDialog.getExistingDirectory(
            self, 'Select a directory', download_path)

        if fname:
            # Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.
            # On Windows, toNativeSeparators("c:/winnt/system32") returns
            # "c:\winnt\system32".
            fname = QDir.toNativeSeparators(fname)

        if os.path.isdir(fname):
            self.download_folder_lineEdit.setText(fname)

# enable when link_lineEdit is not empty and find size of file. 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:20,代码来源:addlink.py

示例3: on_saveoutput_spec_released

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def on_saveoutput_spec_released(self):

        dep_spec = int(self.ui.depth_spec.value())

        selected_directory7 = QFileDialog.getExistingDirectory()

        if not selected_directory7:
            return

        if os.path.isdir(str(selected_directory7) + '/output_spectre_' + \
             str(dep_spec) + 'km'):
            QMessageBox.critical(None, "Message", "This directory already exists")
        else:
            shutil.copytree(DIR2 + '/output_files_spectre', str(selected_directory7) + '/output_spectre_' + \
             str(dep_spec) + 'km')

            path = DIR2 + "/output_files_spectre"
            dirs = os.listdir(path)
            os.chdir(DIR2 + '/output_files_spectre')
            for i in range(len(dirs)):
                os.remove(dirs[i])
            os.chdir(DIR) 
开发者ID:stephaniedurand,项目名称:SeisTomoPy_V3,代码行数:24,代码来源:seistomopy_gui.py

示例4: show_file_dialog

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def show_file_dialog(self):
        selected_dir = QFileDialog.getExistingDirectory(self, caption='Choose Directory', directory=os.getcwd())
        self.lineEdit_save_location.setText(selected_dir) 
开发者ID:XIAZY,项目名称:DriveIt,代码行数:5,代码来源:driveit-gui.py

示例5: changeFolder

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def changeFolder(self, button):
        fname = QFileDialog.getExistingDirectory(self, 'Open f', '/home')

        if fname:
            # Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.
            # On Windows, toNativeSeparators("c:/winnt/system32") returns
            # "c:\winnt\system32".
            fname = QDir.toNativeSeparators(fname)

        if os.path.isdir(fname):
            self.download_folder_lineEdit.setText(fname) 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:13,代码来源:properties.py

示例6: changeFolder

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def changeFolder(self, button):
        fname = QFileDialog.getExistingDirectory(
            self, 'Select a directory', download_path)

        if fname:
            # Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.
            # On Windows, toNativeSeparators("c:/winnt/system32") returns
            # "c:\winnt\system32".
            fname = QDir.toNativeSeparators(fname)

        if os.path.isdir(fname):
            self.download_folder_lineEdit.setText(fname) 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:14,代码来源:browser_plugin_queue.py

示例7: downloadFolderPushButtonClicked

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def downloadFolderPushButtonClicked(self, button):

        download_path = str(
            self.persepolis_setting.value('settings/download_path'))
        fname = QFileDialog.getExistingDirectory(
            self, 'Select a directory', download_path)

        if fname:
            # Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.
            # On Windows, toNativeSeparators("c:/winnt/system32") returns
            # "c:\winnt\system32".
            fname = QDir.toNativeSeparators(fname)
            self.download_folder_lineEdit.setText(fname)
            self.persepolis_setting.setValue(
                'settings/download_path', str(fname)) 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:17,代码来源:setting.py

示例8: tempDownloadPushButtonClicked

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def tempDownloadPushButtonClicked(self, button):

        download_path_temp = str(
            self.persepolis_setting.value('settings/download_path_temp'))
        fname = QFileDialog.getExistingDirectory(
            self, 'Open f', download_path_temp)

        if fname:
            self.temp_download_lineEdit.setText(fname)
            self.persepolis_setting.setValue(
                'settings/download_path_temp', str(fname)) 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:13,代码来源:setting.py

示例9: b_define_matlib_dir

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def b_define_matlib_dir(self):
        """
        b_define_matlib_dir open a dialog to select the matlib directory 
        """
        folder = QFileDialog.getExistingDirectory(self, "Select MatLib directory")
        if folder != self.matlib.ref_path and folder:
            self.le_matlib_path.setText(folder)
        GUI_logger.info("message") 
开发者ID:Eomys,项目名称:pyleecan,代码行数:10,代码来源:WGuiOption.py

示例10: load

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def load(self):
        """Load the material library

        Parameters
        ----------
        self :
            A DMatLib object

        Returns
        -------

        """

        load_path = str(
            QFileDialog.getExistingDirectory(
                self, self.tr("Select Material Library Directory"), self.matlib_path
            )
        )

        if load_path != "":
            try:
                self.matlib.load_mat_ref(load_path)
                self.update_list_mat()
                self.nav_mat.setCurrentRow(0)
                self.update_out()
                self.matlib_path = dirname(load_path)
            except Exception as e:
                QMessageBox().critical(
                    self,
                    self.tr("Error"),
                    self.tr(
                        "The material library file is " "incorrect:\n",
                        "Please keep the \n, another " "message is following this one",
                    )
                    + type(e).__name__
                    + ": "
                    + str(e),
                )
                self.reject()
        else:
            self.reject() 
开发者ID:Eomys,项目名称:pyleecan,代码行数:43,代码来源:DMatLib.py

示例11: searchOneFolderMusic

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def searchOneFolderMusic(self):
        url = QFileDialog.getExistingDirectory()
        if url:
            self.scanFolder(url) 
开发者ID:dragondjf,项目名称:QMusic,代码行数:6,代码来源:muscimanageworker.py

示例12: macroSelectDir

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def macroSelectDir(self):

        try:

            fileName = str(QFileDialog.getExistingDirectory(self, "Select Directory"))
            self.dir = fileName.replace("/","\\")
            self.makrosavedir.setText(self.dir)

        except:
            pass 
开发者ID:azizaltuntas,项目名称:Camelishing,代码行数:12,代码来源:start.py

示例13: import_folder_clicked

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def import_folder_clicked(self):
        path = QFileDialog.getExistingDirectory(
            self, _("TEXT_FILE_IMPORT_FOLDER"), self.default_import_path
        )
        if not path:
            return
        p = pathlib.Path(path)
        files, total_size = self.get_folder(p)
        self.default_import_path = str(p)
        self.import_all(files, total_size) 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:12,代码来源:files_widget.py

示例14: export_labels_annots

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def export_labels_annots(self,dataset_vo: DatasetVO, export_format):

        selected_folder = str(QFileDialog.getExistingDirectory(None, "select the folder"))
        if selected_folder:
            @work_exception
            def do_work():
                annotations = self._annot_dao.fetch_labels(dataset_vo.id)
                return annotations, None

            @gui_exception
            def done_work(result):
                annots, err = result
                if err:
                    raise err
                if annots:
                    output_file = Path(selected_folder)\
                        .joinpath("annotations.{}".format(export_format))
                    if export_format == "csv":
                        df = pd.DataFrame(annots)
                        df.to_csv(str(output_file),
                                  index=False)
                    else:
                        def dumper(obj):
                            try:
                                return obj.toJSON()
                            except:
                                return obj.__dict__
                        with open(output_file, "w") as f:
                            f.write(json.dumps(annots, default=dumper, indent=2))

                    GUIUtilities.show_info_message("Annotations exported successfully", "Done")
                else:
                    GUIUtilities.show_info_message("Not annotations found for the dataset {}".format(dataset_vo.name),"Done")

            worker = Worker(do_work)
            worker.signals.result.connect(done_work)
            self.thread_pool.start(worker) 
开发者ID:haruiz,项目名称:CvStudio,代码行数:39,代码来源:tab_datasets.py

示例15: export_boxes_annots

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def export_boxes_annots(self, dataset_vo: DatasetVO, export_format):

        selected_folder = str(QFileDialog.getExistingDirectory(None, "select the folder"))
        if selected_folder:
            @work_exception
            def do_work():
                annotations = self._annot_dao.fetch_boxes(dataset_vo.id)
                return annotations, None

            @gui_exception
            def done_work(result):
                annots, err = result
                if err:
                    raise err
                if annots:
                    output_file = Path(selected_folder) \
                        .joinpath("annotations.{}".format(export_format))
                    if export_format == "csv":
                        df = pd.DataFrame(annots)
                        df.to_csv(str(output_file),
                                  index=False)
                    else:
                        def dumper(obj):
                            try:
                                return obj.toJSON()
                            except:
                                return obj.__dict__

                        with open(output_file, "w") as f:
                            f.write(json.dumps(annots, default=dumper, indent=2))
                    GUIUtilities.show_info_message("Annotations exported successfully", "Done")
                else:
                    GUIUtilities.show_info_message("Not annotations found for the dataset {}".format(dataset_vo.name), "Done")

            worker = Worker(do_work)
            worker.signals.result.connect(done_work)
            self.thread_pool.start(worker) 
开发者ID:haruiz,项目名称:CvStudio,代码行数:39,代码来源:tab_datasets.py


注:本文中的PyQt5.QtWidgets.QFileDialog.getExistingDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。