我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用PyQt5.QtWidgets.QFileDialog.getExistingDirectory()。
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))
def select_dir(self): ''' ????????????? ''' self.dir=QFileDialog.getExistingDirectory(self,'??????',(self.dirname if self.dirname else './'))
def choose_dir(self): self.dir_name = QFileDialog.getExistingDirectory(self, 'Select Directory') if self.dir_name: self.btn_file.setText(self.dir_name)
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
def idw_set_input_folder(self): path = QFileDialog.getExistingDirectory(None, "Select Directory") self.ui.pathLineEdit.setText(path)
def idw_set_output_folder(self): path = QFileDialog.getExistingDirectory(None, "Select Directory") self.ui.outputLineEdit.setText(path)
def cfm_get_out_path(self): fl = QFileDialog.getExistingDirectory(self, "Select Output Folder") self.ui.outLineEdit.setText(fl)
def input_search_path(self): """ ????????, ??????????? """ root_dir = QFileDialog.getExistingDirectory(self, "????????") self.root_path_edit.setText(root_dir)
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)
def get_directory(): directory = QFileDialog.getExistingDirectory(None, "Choose Directory", QDir.homePath(), QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks) return directory
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
def but_select_dest_clicked(self): self.text_path_dest.setText(QFileDialog.getExistingDirectory())
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))
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))
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)
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.
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))
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()
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()
def _browse_project_path(self): path = QFileDialog.getExistingDirectory() path = os.path.realpath(path) self._ui.project_path.setText(path)
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 *********************************************************************************************