Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions hexrdgui/llnl_import_tool_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class LLNLImportToolDialog(QObject):

cancel_workflow = Signal()

complete_workflow = Signal()
# The boolean flag indicates whether this is a FIDDLE instrument or not
complete_workflow = Signal(bool)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave a comment above this line as well that indicates what the bool is for?


def __init__(self, cmap=None, parent=None):
super().__init__(parent)
Expand Down Expand Up @@ -925,14 +926,12 @@ def import_complete(self):
HexrdConfig().enable_canvas_toolbar.emit(True)
self.cmap.block_updates(False)

if self.instrument == 'FIDDLE':
# Allow user to change kernel before applying median filter
d = MedianFilterDialog(self.ui.parent())
d.ui.finished.connect(lambda: self.complete_workflow.emit())
HexrdConfig().apply_median_filter_correction = d.exec()
else:
if self.instrument != 'FIDDLE':
# Re-enable median filter correction if it was set
HexrdConfig().apply_median_filter_correction = self.median_setting
self.complete_workflow.emit()
# If this is a FIDDLE instrument users will be prompted to set (or not)
# the median filter after the import is complete
self.complete_workflow.emit(self.instrument == 'FIDDLE')

def show(self):
self.ui.show()
Expand Down
15 changes: 12 additions & 3 deletions hexrdgui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,8 @@ def setup_connections(self):
HexrdConfig().enable_canvas_focus_mode.connect(
self.enable_canvas_focus_mode)

# Always assume Physics Package is needed for LLNL import
self.llnl_import_tool_dialog.complete_workflow.connect(
lambda: self.on_action_include_physics_package_toggled(True)
)
self.on_llnl_import_completed)

def on_state_loaded(self):
self.update_action_check_states()
Expand Down Expand Up @@ -1556,6 +1554,17 @@ def apply_lorentz_correction_toggled(self, b):
def on_action_hedm_import_tool_triggered(self):
self.simple_image_series_dialog.show()

def on_llnl_import_completed(self, is_fiddle_instrument):
if is_fiddle_instrument:
if self.ui.action_apply_median_filter.isChecked():
# Un-check the median filter if already checked - this ensures we
# always trigger the callback for the FIDDLE instrument and the
# kernel setting dialog is always shown
self.ui.action_apply_median_filter.setChecked(False)
self.ui.action_apply_median_filter.setChecked(True)
# Always assume Physics Package is needed for LLNL import
self.on_action_include_physics_package_toggled(True)

def on_action_llnl_import_tool_triggered(self):
dialog = self.llnl_import_tool_dialog
dialog.show()
Expand Down
Loading