Skip to content

Commit 38942de

Browse files
author
James Brown
committed
Manual recon log button goes to input directory (if it exists) by default
1 parent 3a8676a commit 38942de

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

harp.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ def __init__(self, app):
8888
self.ui.setupUi(self)
8989
self.app = app
9090

91-
9291
# Store app-specific data such as last directory browsed
9392
self.app_data = AppData()
9493
self.opttab_populate_patterns()
@@ -103,6 +102,7 @@ def __init__(self, app):
103102
self.current_row = 0
104103
# Set to "" or NA so that HARP can record in the log and GUI there is no data for these parameters. Will be
105104
# updated later if parameters are identified.
105+
self.input_folder = None
106106
self.scan_folder = "NA"
107107
self.recon_log_path = "NA"
108108
self.f_size_out_gb = ""
@@ -660,16 +660,18 @@ def get_recon_man(self):
660660
:func:`autofill.get_pixel()`,
661661
"""
662662
# Get the information from the dialog box
663-
file_dialog = QtGui.QFileDialog(self)
664-
file = file_dialog.getOpenFileName()
663+
if self.input_folder:
664+
recon_log_path = QtGui.QFileDialog.getOpenFileName(self, 'Select recon log', self.input_folder)
665+
else:
666+
recon_log_path = QtGui.QFileDialog.getOpenFileName(self, 'Select recon log')
665667

666668
# If a file was chosen get pixel size and update paramaters
667-
if file:
669+
if recon_log_path:
668670
try:
669671
# Set the text on the recon file box on the GUI
670-
self.ui.lineEditCTRecon.setText(file)
672+
self.ui.lineEditCTRecon.setText(recon_log_path)
671673
# Check it is an actual path (prob not required)
672-
self.recon_log_path = os.path.abspath(str(file))
674+
self.recon_log_path = os.path.abspath(str(recon_log_path))
673675
# Open the log file as read only
674676
recon_log_file = open(self.recon_log_path, 'r')
675677
# Get pixel size from log file

0 commit comments

Comments
 (0)