Skip to content
Snippets Groups Projects
Commit 6b1282b4 authored by Conor Finn's avatar Conor Finn
Browse files

RE #27188 Add cropping controls to view and presenter

Adds basic controls to presenter for showing and hiding.
parent ec1a03d5
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ from __future__ import (absolute_import, division, print_function)
from Engineering.gui.engineering_diffraction.tabs.common import INSTRUMENT_DICT, create_error_message
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.cropping.cropping_widget import CroppingWidget
from mantidqt.utils.asynchronous import AsyncTask
from mantidqt.utils.observer_pattern import Observer
from mantid.simpleapi import logger
......@@ -25,12 +26,17 @@ class FocusPresenter(object):
# Connect view signals to local methods.
self.view.set_on_focus_clicked(self.on_focus_clicked)
self.view.set_enable_controls_connection(self.set_focus_controls_enabled)
self.view.set_on_check_cropping_state_changed(self.show_cropping)
# Variables from other GUI tabs.
self.current_calibration = CalibrationInfo()
self.instrument = "ENGINX"
self.rb_num = None
# Cropping Options
self.cropping_widget = CroppingWidget(self.view, view=self.view.get_cropping_widget())
self.view.set_cropping_widget_hidden()
def on_focus_clicked(self):
banks = self._get_banks()
if not self._validate(banks):
......@@ -115,6 +121,12 @@ class FocusPresenter(object):
"""
self.current_calibration = calibration
def show_cropping(self, visible):
if visible:
self.view.set_cropping_widget_visible()
else:
self.view.set_cropping_widget_hidden()
# -----------------------
# Observers / Observables
# -----------------------
......
......@@ -33,6 +33,9 @@ class FocusView(QtWidgets.QWidget, Ui_focus):
def set_enable_controls_connection(self, slot):
self.sig_enable_controls.connect(slot)
def set_on_check_cropping_state_changed(self, slot):
self.check_cropFocus.stateChanged.connect(slot)
# =================
# Component Setters
# =================
......@@ -46,6 +49,18 @@ class FocusView(QtWidgets.QWidget, Ui_focus):
def set_plot_output_enabled(self, enabled):
self.check_plotOutput.setEnabled(enabled)
def set_cropping_widget_hidden(self):
self.widget_cropping.hide()
def set_cropping_widget_visible(self):
self.widget_cropping.show()
def set_check_cropping_enabled(self, enabled):
self.check_cropFocus.setEnabled(enabled)
def set_check_cropping_state(self, state):
self.check_cropFocus.setCheckState(state)
# =================
# Component Getters
# =================
......@@ -65,6 +80,12 @@ class FocusView(QtWidgets.QWidget, Ui_focus):
def get_plot_output(self):
return self.check_plotOutput.isChecked()
def get_crop_checked(self):
return self.check_cropFocus.isChecked()
def get_cropping_widget(self):
return self.widget_cropping
# =================
# State Getters
# =================
......
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