Skip to content

Commit

Permalink
Edit helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol committed Dec 12, 2024
1 parent 426e457 commit 58be135
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spinetoolbox/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,20 +954,22 @@ def select_certificate_directory(parent, line_edit):
line_edit.setText(answer)


def select_root_directory(parent, line_edit):
def select_root_directory(parent, line_edit, project_path):
"""Shows file browser and inserts selected root directory to given line edit.
Used in Tool Properties.
Args:
parent (QWidget, optional): Parent of QFileDialog
line_edit (QLineEdit): Line edit where the selected path will be inserted
project_path (str): Project path
"""
current_path = get_current_path(line_edit)
initial_path = current_path if current_path is not None else home_dir()
initial_path = current_path if current_path is not None else project_path
answer = QFileDialog.getExistingDirectory(parent, "Select root directory", initial_path)
if not answer:
return
line_edit.setText(answer)
return


def get_current_path(le):
Expand Down

0 comments on commit 58be135

Please sign in to comment.