Skip to content
Snippets Groups Projects
Unverified Commit f6f955b6 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #28412 from mantidproject/28355_eng_diff_status

Improve Status Information in Eng Diff GUI
parents c8e81acb 5862be96
No related branches found
No related tags found
No related merge requests found
...@@ -39,10 +39,23 @@ Settings ...@@ -39,10 +39,23 @@ Settings
Close Close
Close the interface. Close the interface.
Other Information
^^^^^^^^^^^^^^^^^
Red Stars Red Stars
Red stars next to browse boxes and other fields indicate that the file Red stars next to browse boxes and other fields indicate that the file
could not be found. Hover over the star to see more information. could not be found. Hover over the star to see more information.
Status Bar
The status bar shows the calibration run numbers the GUI is currently using.
Saved File Outputs
The location of files saved by the GUI during processing will be shown in the mantid
messages log.
*Note*: The locations are shown at "Notice" level, so may not appear if the messages log
is on the incorrect setting.
Calibration Calibration
----------- -----------
......
...@@ -22,6 +22,8 @@ Improvements ...@@ -22,6 +22,8 @@ Improvements
^^^^^^^^^^^^ ^^^^^^^^^^^^
- TOPAS files (`.abc`) have replaced the `.dat` files generated when focusing using the GUI. - TOPAS files (`.abc`) have replaced the `.dat` files generated when focusing using the GUI.
- Focusing with the GUI will now generate a CSV containing the averaged values of all numerical sample logs. - Focusing with the GUI will now generate a CSV containing the averaged values of all numerical sample logs.
- The currently loaded calibration is now shown at the bottom of the GUI.
- The location of the saved output files from the GUI is now shown in the messages log.
Single Crystal Diffraction Single Crystal Diffraction
-------------------------- --------------------------
......
...@@ -10,6 +10,8 @@ from qtpy import QtCore, QtWidgets ...@@ -10,6 +10,8 @@ from qtpy import QtCore, QtWidgets
from .tabs.calibration.model import CalibrationModel from .tabs.calibration.model import CalibrationModel
from .tabs.calibration.view import CalibrationView from .tabs.calibration.view import CalibrationView
from .tabs.calibration.presenter import CalibrationPresenter from .tabs.calibration.presenter import CalibrationPresenter
from .tabs.common import CalibrationObserver
from .tabs.common.path_handling import get_run_number_from_path
from .tabs.focus.model import FocusModel from .tabs.focus.model import FocusModel
from .tabs.focus.view import FocusView from .tabs.focus.view import FocusView
from .tabs.focus.presenter import FocusPresenter from .tabs.focus.presenter import FocusPresenter
...@@ -42,11 +44,16 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window): ...@@ -42,11 +44,16 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window):
self.focus_presenter = None self.focus_presenter = None
self.fitting_presenter = None self.fitting_presenter = None
self.settings_presenter = None self.settings_presenter = None
self.calibration_observer = CalibrationObserver(self)
self.set_on_help_clicked(self.open_help_window) self.set_on_help_clicked(self.open_help_window)
self.set_on_settings_clicked(self.open_settings) self.set_on_settings_clicked(self.open_settings)
self.btn_settings.setIcon(get_icon("mdi.settings", "black", 1.2)) self.btn_settings.setIcon(get_icon("mdi.settings", "black", 1.2))
# Setup status bar
self.status_label = QtWidgets.QLabel()
self.setup_statusbar()
# Setup Elements # Setup Elements
self.setup_settings() self.setup_settings()
self.setup_calibration() self.setup_calibration()
...@@ -96,6 +103,11 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window): ...@@ -96,6 +103,11 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window):
def setup_calibration_notifier(self): def setup_calibration_notifier(self):
self.calibration_presenter.calibration_notifier.add_subscriber( self.calibration_presenter.calibration_notifier.add_subscriber(
self.focus_presenter.calibration_observer) self.focus_presenter.calibration_observer)
self.calibration_presenter.calibration_notifier.add_subscriber(self.calibration_observer)
def setup_statusbar(self):
self.statusbar.addWidget(self.status_label)
self.set_statusbar_text("No Calibration Loaded.")
def set_on_help_clicked(self, slot): def set_on_help_clicked(self, slot):
self.pushButton_help.clicked.connect(slot) self.pushButton_help.clicked.connect(slot)
...@@ -118,3 +130,12 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window): ...@@ -118,3 +130,12 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window):
def get_rb_no(self): def get_rb_no(self):
return self.lineEdit_RBNumber.text() return self.lineEdit_RBNumber.text()
def update_calibration(self, calibration):
instrument = calibration.get_instrument()
van_no = get_run_number_from_path(calibration.get_vanadium(), instrument)
sample_no = get_run_number_from_path(calibration.get_sample(), instrument)
self.set_statusbar_text(f"V: {van_no}, CeO2: {sample_no}, Instrument: {instrument}")
def set_statusbar_text(self, text):
self.status_label.setText(text)
...@@ -316,6 +316,7 @@ class CalibrationModel(object): ...@@ -316,6 +316,7 @@ class CalibrationModel(object):
elif bank is None: # Custom cropped files use the north bank template. elif bank is None: # Custom cropped files use the north bank template.
north_kwargs() north_kwargs()
generate_output_file([difa[0]], [difc[0]], [tzero[0]], "cropped", kwargs) generate_output_file([difa[0]], [difc[0]], [tzero[0]], "cropped", kwargs)
logger.notice(f"\n\nCalibration files saved to: \"{calibration_dir}\"\n\n")
@staticmethod @staticmethod
def get_info_from_file(file_path): def get_info_from_file(file_path):
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
Holds some common constants across all tabs. Holds some common constants across all tabs.
""" """
from qtpy.QtWidgets import QMessageBox from qtpy.QtWidgets import QMessageBox
from mantidqt.utils.observer_pattern import Observer
# Dictionary of indexes for instruments. # Dictionary of indexes for instruments.
INSTRUMENT_DICT = {0: "ENGINX", 1: "IMAT"} INSTRUMENT_DICT = {0: "ENGINX", 1: "IMAT"}
...@@ -15,3 +16,12 @@ INSTRUMENT_DICT = {0: "ENGINX", 1: "IMAT"} ...@@ -15,3 +16,12 @@ INSTRUMENT_DICT = {0: "ENGINX", 1: "IMAT"}
def create_error_message(parent, message): def create_error_message(parent, message):
QMessageBox.warning(parent, "Engineering Diffraction - Error", str(message)) QMessageBox.warning(parent, "Engineering Diffraction - Error", str(message))
class CalibrationObserver(Observer):
def __init__(self, outer):
Observer.__init__(self)
self.outer = outer
def update(self, observable, calibration):
self.outer.update_calibration(calibration)
...@@ -129,6 +129,10 @@ class FocusModel(object): ...@@ -129,6 +129,10 @@ class FocusModel(object):
rb_num) rb_num)
self._save_focused_output_files_as_topas_xye(instrument, sample_path, bank, sample_workspace, self._save_focused_output_files_as_topas_xye(instrument, sample_path, bank, sample_workspace,
rb_num) rb_num)
logger.notice(f"\n\nFocus files saved to: \"{path.join(path_handling.get_output_path(), 'Focus')}\"\n\n")
if rb_num:
output_path = path.join(path_handling.get_output_path(), 'User', rb_num, 'Focus')
logger.notice(f"\n\nFocus files saved to: \"{output_path}\"\n\n")
def _save_focused_output_files_as_gss(self, instrument, sample_path, bank, sample_workspace, def _save_focused_output_files_as_gss(self, instrument, sample_path, bank, sample_workspace,
rb_num): rb_num):
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 + # SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=invalid-name # pylint: disable=invalid-name
from Engineering.gui.engineering_diffraction.tabs.common import INSTRUMENT_DICT, create_error_message from Engineering.gui.engineering_diffraction.tabs.common import INSTRUMENT_DICT, create_error_message, \
CalibrationObserver
from Engineering.gui.engineering_diffraction.tabs.common.calibration_info import CalibrationInfo from Engineering.gui.engineering_diffraction.tabs.common.calibration_info import CalibrationInfo
from Engineering.gui.engineering_diffraction.tabs.common.vanadium_corrections import check_workspaces_exist from Engineering.gui.engineering_diffraction.tabs.common.vanadium_corrections import check_workspaces_exist
from Engineering.gui.engineering_diffraction.tabs.common.cropping.cropping_widget import CroppingWidget from Engineering.gui.engineering_diffraction.tabs.common.cropping.cropping_widget import CroppingWidget
from mantidqt.utils.asynchronous import AsyncTask from mantidqt.utils.asynchronous import AsyncTask
from mantidqt.utils.observer_pattern import Observer
from qtpy.QtWidgets import QMessageBox from qtpy.QtWidgets import QMessageBox
...@@ -20,7 +20,7 @@ class FocusPresenter(object): ...@@ -20,7 +20,7 @@ class FocusPresenter(object):
self.model = model self.model = model
self.view = view self.view = view
self.worker = None self.worker = None
self.calibration_observer = self.CalibrationObserver(self) self.calibration_observer = CalibrationObserver(self)
# Connect view signals to local methods. # Connect view signals to local methods.
self.view.set_on_focus_clicked(self.on_focus_clicked) self.view.set_on_focus_clicked(self.on_focus_clicked)
...@@ -132,14 +132,3 @@ class FocusPresenter(object): ...@@ -132,14 +132,3 @@ class FocusPresenter(object):
def show_cropping(self, visible): def show_cropping(self, visible):
self.view.set_cropping_widget_visibility(visible) self.view.set_cropping_widget_visibility(visible)
# -----------------------
# Observers / Observables
# -----------------------
class CalibrationObserver(Observer):
def __init__(self, outer):
Observer.__init__(self)
self.outer = outer
def update(self, observable, calibration):
self.outer.update_calibration(calibration)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment