"""
This module contains the ControlImageFisheye class, which is responsible for managing the
interactions related to fisheye images in the application.
"""
[docs]
class ControlImageFisheye:
"""
Class for controlling fisheye images.
Attributes:
_controller: The controller object.
_model: The model object.
_ui_object: The UI object.
Methods:
__init__(self, controller): Initializes the ControlImageFisheye object.
onclick_btn_fisheye(self): Changes the current view mode to fisheye.
set_initial_value_to_ui(self): Set initial values to the user interface elements.
"""
[docs]
def __init__(self, controller):
"""
Initialize the ControlImageFisheye object.
Arg:
controller: The controller object.
Return:
None
"""
self._controller = controller
self._model = controller.model
self._ui_object = controller.ui_object
self._ui_object.btn_fisheye_view.clicked.connect(self.onclick_btn_fisheye)
self._ui_object.btn_fisheye_view.setShortcut("Ctrl+F")
[docs]
def onclick_btn_fisheye(self):
"""
Change the current view mode to fisheye.
The function changes the current view mode to "FisheyeView" and hides the anypoint pointer frame and
mode view widget.
Return:
None
"""
if self._model.debug_mode:
self._model.activity_logger.info("ControlImageFisheye: onclick_btn_fisheye(), "
"Click push button fisheye image")
self._controller.ctrl_stylesheet.change_stylesheet_selected_menu()
if self._model.image_original is not None:
self._model.mode_view = "FisheyeView"
self._model.view_zoom_area.state_rubberband = False
self._ui_object.widget_mode_view.hide()
self._controller.display_image_to_ui()
self.set_initial_value_to_ui()
if not self._model.recenter_mode_view:
self._ui_object.frame_pointer_in_recenter_frame.hide()
self._model.save_main_config_update()
else:
message = "No media found, please select the file \nbefore you perform the operation!"
self._controller.ctrl_message_box.display_message_box(message, "information")
[docs]
def set_initial_value_to_ui(self):
"""
Set initial values to the user interface elements.
This method sets the initial values of spin boxes and double spin boxes in the user interface
based on the configuration.
Return:
None
"""
self._ui_object.spinBox_icx.blockSignals(True)
self._ui_object.spinBox_icy.blockSignals(True)
self._ui_object.doubleSpinBox_alpha_rec.blockSignals(True)
self._ui_object.doubleSpinBox_beta_rec.blockSignals(True)
x = self._model.main_config["Image_original"]["center_coord"][0]
y = self._model.main_config["Image_original"]["center_coord"][1]
self._ui_object.spinBox_icx.setValue(x)
self._ui_object.spinBox_icy.setValue(y)
self._ui_object.doubleSpinBox_alpha_rec.setValue(0)
self._ui_object.doubleSpinBox_beta_rec.setValue(0)
self._ui_object.spinBox_icx.blockSignals(False)
self._ui_object.spinBox_icy.blockSignals(False)
self._ui_object.doubleSpinBox_alpha_rec.blockSignals(False)
self._ui_object.doubleSpinBox_beta_rec.blockSignals(False)