def path_button_clicked(self):
"""
Called when the user clicks the button next to the line edit - the path choosing button.
First checks if there is text in the line edit and uses that for the initial search directory. If not, then it
defaults to the user $HOME directory.
Once a directory is chosen and the user has not clicked cancel (cancel returns an empty path) it directly sets
the line edit text.
"""
open_dialog = QFileDialog()
if not self.path_text.text():
button_path = expanduser("~")
else:
button_path = self.path_text.text()
temp_path = open_dialog.getExistingDirectory(self, "Package directory:", button_path)
if temp_path:
self.path_text.setText(temp_path)
评论列表
文章目录