Python PyQt5.QtWidgets.QFileDialog 模块,getExistingDirectory() 实例源码

我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用PyQt5.QtWidgets.QFileDialog.getExistingDirectory()

项目:BingNiceWallpapers    作者:redstoneleo    | 项目源码 | 文件源码
def on_browseButton_clicked(self):

        pathToWallpaperDir = os.path.normpath(
            QFileDialog.getExistingDirectory(self))

        print('pathToWallpaperDir--------', pathToWallpaperDir)  # ??? ??  ? .   bugggggg

        # ????QFileDialog.getExistingDirectory??????????  ‘’
        # ???????wallpaperDir????????
        if pathToWallpaperDir != '':
            self.storePathEdit.setText(
                os.path.join(pathToWallpaperDir, '????????'))
            self.pathToWallpaperDir = pathToWallpaperDir

        # else:
        #     self.tipsLabel.setText(
        #         '{}   ????????????'.format(pathToWallpaperDir))
项目:ComicSpider    作者:QuantumLiu    | 项目源码 | 文件源码
def select_dir(self):
        '''
        ?????????????
        '''
        self.dir=QFileDialog.getExistingDirectory(self,'??????',(self.dirname if self.dirname else './'))
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def choose_dir(self):
        self.dir_name = QFileDialog.getExistingDirectory(self, 'Select Directory')

        if self.dir_name:
            self.btn_file.setText(self.dir_name)
项目:TextStageProcessor    作者:mhyhre    | 项目源码 | 文件源码
def getDirFromUserSelection(path):
    dir_name = QFileDialog.getExistingDirectory(None, "??????? ???????", path)
    if (len(dir_name) > 0):
        return dir_name
    else:
        return None


# ??????????? ?????? ???? /home/user/files/file.txt /home/user/files
# ? ???: files/file.txt
项目:climate    作者:FIDS-UWO    | 项目源码 | 文件源码
def idw_set_input_folder(self):
        path = QFileDialog.getExistingDirectory(None, "Select Directory")
        self.ui.pathLineEdit.setText(path)
项目:climate    作者:FIDS-UWO    | 项目源码 | 文件源码
def idw_set_output_folder(self):
        path = QFileDialog.getExistingDirectory(None, "Select Directory")
        self.ui.outputLineEdit.setText(path)
项目:climate    作者:FIDS-UWO    | 项目源码 | 文件源码
def cfm_get_out_path(self):
        fl = QFileDialog.getExistingDirectory(self, "Select Output Folder")
        self.ui.outLineEdit.setText(fl)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def input_search_path(self):
        """
        ????????, ???????????
        """
        root_dir = QFileDialog.getExistingDirectory(self, "????????")
        self.root_path_edit.setText(root_dir)
项目:solar-sails    作者:metrasynth    | 项目源码 | 文件源码
def on_add_button_clicked(self):
        path = QFileDialog.getExistingDirectory(
            parent=self,
            caption='Select directory containing SunVox app',
        )
        if path:
            self.item_model.add_path(path)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def get_directory():
    directory = QFileDialog.getExistingDirectory(None, "Choose Directory", QDir.homePath(),
                                                 QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)
    return directory
项目:ClassifyHub    作者:Top-Ranger    | 项目源码 | 文件源码
def get_dir_path(self, title):
        return QFileDialog.getExistingDirectory(None, title)

    ##
    # \brief Returns the path of an existing file
    #
    # If no file is chosen by the user an empty string will be returned
    #
    # \param title Title of the selection window
    # \return String containing file path or empty string if no file is chosen
项目:amazfit_exporter    作者:botmakerdvd    | 项目源码 | 文件源码
def but_select_dest_clicked(self):
        self.text_path_dest.setText(QFileDialog.getExistingDirectory())
项目:persepolis    作者:persepolisdm    | 项目源码 | 文件源码
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))
项目:persepolis    作者:persepolisdm    | 项目源码 | 文件源码
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))
项目:persepolis    作者:persepolisdm    | 项目源码 | 文件源码
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)
项目:persepolis    作者:persepolisdm    | 项目源码 | 文件源码
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.
项目:persepolis    作者:persepolisdm    | 项目源码 | 文件源码
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)
项目:BingNiceWallpapers    作者:redstoneleo    | 项目源码 | 文件源码
def on_browseButton_2_clicked(self):

        pathToLikedWallpaperDir = os.path.normpath(
            QFileDialog.getExistingDirectory(self))

        # ????QFileDialog.getExistingDirectory??????????  ‘’    and if
        if pathToLikedWallpaperDir != '':
            self.storePathEdit_2.setText(
                os.path.join(pathToLikedWallpaperDir, '???????'))
            self.pathToLikedWallpaperDir = pathToLikedWallpaperDir

        # else:
        #     self.tipsLabel.setText(
        #         '{}   ????????????'.format(pathToWallpaperDir))
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def savefile(self):
        tempfilename = 'TemperatureData.csv'
        filepath = QFileDialog.getExistingDirectory(self, 'Choose Directory', os.sep.join((os.path.expanduser('~'), 'Desktop')))
        self.y_variablename = 'TemperatureSensor'
        MultiPlot.SaveToCsv(self.tf, tempfilename, filepath, len(self.ids), self.y_variablename)
        mb = QMessageBox()
        mb.setIcon(QMessageBox.Information)
        mb.setWindowTitle('Information')
        mb.setText('File saved to directory.')
        mb.setStandardButtons(QMessageBox.Ok)
        mb.show()
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def saveAllThread(self):
        self.statusbar = 'Saving Files..'
        self.directory = QFileDialog.getExistingDirectory(self, 'Choose Directory', os.path.expanduser('~'))
        saveThread = threading.Thread(target=self.saveAll)
        saveThread.start()
项目:continuum    作者:zyantific    | 项目源码 | 文件源码
def _browse_project_path(self):
        path = QFileDialog.getExistingDirectory()
        path = os.path.realpath(path)
        self._ui.project_path.setText(path)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def show_design_connection(self):

        config = ConfigParser.ConfigParser()
        config.readfp(open(r'Osdag.config'))
        default_workspace_path = config.get('default_workspace', 'path1')
        folder = QFileDialog.getExistingDirectory(self,'Select Folder', default_workspace_path)
        folder = str(folder)
        if not os.path.exists(folder):
            if folder == '':
                pass
            else:
                os.mkdir(folder, 0755)

        root_path = folder
        images_html_folder = ['images_html']
        flag = True
        for create_folder in images_html_folder:
            if root_path == '':
                flag = False
                return flag
            else:
                try:
                    os.mkdir(os.path.join(root_path, create_folder))
                except OSError:
                    shutil.rmtree(os.path.join(folder, create_folder))
                    os.mkdir(os.path.join(root_path, create_folder))

        if self.ui.rdbtn_finplate.isChecked():
            launchFinPlateController(self, folder)
            self.ui.myStackedWidget.setCurrentIndex(0)

        elif self.ui.rdbtn_cleat.isChecked():
            launch_cleatangle_controller(self, folder)
            self.ui.myStackedWidget.setCurrentIndex(0)

        elif self.ui.rdbtn_endplate.isChecked():
            launch_endplate_controller(self, folder)
            self.ui.myStackedWidget.setCurrentIndex(0)
            # QMessageBox.about(self,"INFO","End plate connection design is coming soon!")

        elif self.ui.rdbtn_seat.isChecked():
            launchSeatedAngleController(self, folder)
            self.ui.myStackedWidget.setCurrentIndex(0)

        else:
            QMessageBox.about(self, "INFO", "Please select appropriate connection")

    # ********************************* Help Action *********************************************************************************************