@@ -33,15 +33,19 @@ def __init__(self, parent=None):
3333 def init_widgets (self ):
3434 _idl_status = False
3535 _mantid_status = False
36- if self .parent .post_processing == 'idl' :
36+ if self .parent .post_processing in self . parent . idl_modes :
3737 _idl_status = True
3838 else :
3939 _mantid_status = True
4040
41- self .ui .idl_groupbox .setVisible (self .parent .advanced_window_idl_groupbox_visible )
41+ self .ui .idl_config_group_box .setVisible (self .parent .advanced_window_idl_groupbox_visible )
4242
4343 self .ui .idl_post_processing_button .setChecked (_idl_status )
4444 self .ui .mantid_post_processing_button .setChecked (_mantid_status )
45+ # When 'idl' or 'idl_dev' model is enabled from CLI, this should enable
46+ # the setting box, etc. by default without the need for explicitly
47+ # clicking on the 'IDL' radio button.
48+ self .post_processing_clicked ()
4549
4650 instrument = self .parent .instrument ["full_name" ]
4751 list_instrument_full_name = self .parent .list_instrument ["full_name" ]
@@ -58,6 +62,12 @@ def init_widgets(self):
5862 self .ui .cache_dir_label .setText (self .parent .cache_folder )
5963 self .ui .output_dir_label .setText (self .parent .output_folder )
6064
65+ # IDL config
66+ self .ui .autonom_path_line_edit .setText (self .parent ._autonom_script )
67+ self .ui .sum_scans_path_line_edit .setText (self .parent ._sum_scans_script )
68+ self .ui .ndabs_path_line_edit .setText (self .parent ._ndabs_script )
69+ self .ui .idl_config_browse_button_dialog = None
70+
6171 self .ui .centralwidget .setContentsMargins (10 , 10 , 10 , 10 )
6272
6373 def is_idl_selected (self ):
@@ -71,7 +81,7 @@ def post_processing_clicked(self):
7181 _post = 'mantid'
7282 _idl_groupbox_visible = False
7383
74- self .ui .idl_groupbox .setVisible (_idl_groupbox_visible )
84+ self .ui .idl_config_group_box .setVisible (_idl_groupbox_visible )
7585 self .parent .post_processing = _post
7686 self .parent .activate_reduction_tabs () # hide or show right tabs
7787 self .parent .advanced_window_idl_groupbox_visible = _idl_groupbox_visible
@@ -97,5 +107,71 @@ def output_dir_button_clicked(self):
97107 self .ui .output_dir_label .setText (str (_output_folder ))
98108 self .parent .output_folder = str (_output_folder )
99109
110+ # IDL Config - Line Edits
111+ def autonom_path_line_edited (self ):
112+ """ update autonom script in top-level after line editing """
113+ _script = str (self .ui .autonom_path_line_edit .text ())
114+ self .parent ._autonom_script = _script
115+
116+ def sum_scans_path_line_edited (self ):
117+ """ update sum scans script in top-level after line editing """
118+ _script = str (self .ui .sum_scans_path_line_edit .text ())
119+ self .parent ._sum_scans_script = _script
120+
121+ def ndabs_path_line_edited (self ):
122+ """ update ndabs script in top-level after line editing """
123+ _script = str (self .ui .ndabs_path_line_edit .text ())
124+ self .parent ._ndabs_script = _script
125+
126+ # IDL Config - Browse Buttons
127+ def _idl_button_clicked (self , line_edit ):
128+ """ Utility function to handle IDL script path browse buttons """
129+
130+ # Initialize with current script in line edit
131+ script = str (line_edit .text ())
132+
133+ # Get current working directory to open file dialog in
134+ _current_folder = self .parent .current_folder
135+
136+ # Launch file dialog
137+ self .ui .idl_config_browse_button_dialog = QFileDialog (
138+ parent = self .ui ,
139+ directory = _current_folder ,
140+ caption = "Select File" ,
141+ filter = ("Python (*.py);; All Files (*.*)" ))
142+
143+ # Handle if we select a file or cancel
144+ if self .ui .idl_config_browse_button_dialog .exec_ ():
145+ files = self .ui .idl_config_browse_button_dialog .selectedFiles ()
146+
147+ if files [0 ] != '' :
148+ script = str (files [0 ])
149+ line_edit .setText (script )
150+
151+ # Set the class attribute back to None for monitoring / testing
152+ self .ui .idl_config_browse_button_dialog = None
153+
154+ return script
155+
156+ def autonom_path_browse_button_clicked (self ):
157+ """ Handle browse button clicked for autonom script path """
158+ line_edit = self .ui .autonom_path_line_edit
159+ self .parent ._autonom_script = self ._idl_button_clicked (line_edit )
160+
161+ def sum_scans_path_browse_button_clicked (self ):
162+ """ Handle browse button clicked for sum scans script path """
163+ line_edit = self .ui .sum_scans_path_line_edit
164+ self .parent ._sum_scans_script = self ._idl_button_clicked (line_edit )
165+
166+ def ndabs_path_browse_button_clicked (self ):
167+ """ Handle browse button clicked for ndabs script path """
168+ line_edit = self .ui .ndabs_path_line_edit
169+ self .parent ._ndabs_script = self ._idl_button_clicked (line_edit )
170+
171+ def sum_scans_python_version_checkbox_toggled (self ):
172+ """ Handle the sum scans checkbox for using the python version """
173+ _is_checked = self .ui .sum_scans_python_version_checkbox .isChecked ()
174+ self .parent ._is_sum_scans_python_checked = _is_checked
175+
100176 def closeEvent (self , c ):
101177 self .parent .advanced_window_ui = None
0 commit comments