Controller Package

Main Controller

This module contains the Controller class, which serves as the main controller for the Moilapps application. The Controller class initializes the user interface, connects signals to their corresponding slots, handles keyboard and mouse events, and manages the application’s view modes and settings.

The Controller class imports several other modules and classes to fulfill its functionality, including UI elements, control classes for various features, and models for data management.

class controllers.control_main.Controller(*args: Any, **kwargs: Any)[source]

Bases: QMainWindow

The Controller class serves as the main controller for the Moilapps application. It initializes the user interface, connects signals to their corresponding slots, handles keyboard and mouse events, and manages the application’s view modes and settings.

ui_object

An instance of the user interface object.

Type:

object

model

An instance of the ModelApps class for data management.

Type:

object

_stylesheet

An instance of the ControlStyleSheet class for managing stylesheets.

Type:

object

cap

Video capture object for handling media files.

Type:

object

image_original

Original image object.

Type:

object

ctrl_panel_page

Instance of the ControlPanelPage class for managing panel pages.

Type:

object

ctrl_stylesheet

Instance of the ControlStyleSheet class for managing stylesheets.

Type:

object

ctrl_fullscreen

Instance of the ControlViewFullscreen class for managing fullscreen mode.

Type:

object

ctrl_screen_record

Instance of the ScreenRecord class for managing screen recording.

Type:

object

ctrl_icon

Instance of the ConfigIconUI class for configuring icons.

Type:

object

ctrl_theme

Instance of the ControlThemeApps class for managing application themes.

Type:

object

ctrl_message_box

Instance of the ControlMessageBox class for managing message boxes.

Type:

object

ctrl_main_config

Instance of the AppConfigManager class for managing application configurations.

Type:

object

ctrl_plugin

Instance of the PluginManager class for managing plugins.

Type:

object

ctrl_github

Instance of the ControllerGitHub class for managing GitHub integration.

Type:

object

ctrl_save_media

Instance of the SaveMedia class for managing saved media.

Type:

object

ctrl_mouse_event

Instance of the MouseEvent class for managing mouse events.

Type:

object

view_recenter

Instance of the RecenterConfig class for managing view recentering.

Type:

object

view_fisheye

Instance of the ControlImageFisheye class for managing fisheye view.

Type:

object

view_anypoint

Instance of the AnypointConfig class for managing anypoint view.

Type:

object

view_panorama

Instance of the PanoramaConfig class for managing panorama view.

Type:

object

view_zoom

Instance of the ControlViewZoom class for managing zoom view.

Type:

object

view_rotate

Instance of the ControlViewRotate class for managing rotate view.

Type:

object

ctrl_img_result

Instance of the ControlImageResult class for managing image results.

Type:

object

ctrl_img_ori

Instance of the ControlImageOriginal class for managing original images.

Type:

object

timer

QTimer object for managing timing events.

Type:

object

ctrl_media_player

Instance of the VideoController class for managing media playback.

Type:

object

ctrl_recent_project

Instance of the RecentOpen class for managing recent projects.

Type:

object

__init__()[source]

Initializes the Controller object.

connect_signals()[source]

Connects signals to their corresponding slots in the user interface.

moveEvent()[source]

Moves the screen image worker to the position specified by the given event.

onclick_change_state_debug()[source]

Toggles the debug mode state when the debug button is clicked.

keyPressEvent()[source]

Handles key press events for keyboard shortcuts and special keys.

escape_event()[source]

Handles the escape button keyboard event, returning the application to its default state.

initial_setup_view()[source]

Sets up the initial view mode based on the moilapp’s mode_view attribute.

connect_signals()[source]

Connects signals to their corresponding slots in the user interface.

Signals include button clicks, key shortcuts, checkbox state changes, and menu toggling. Each signal is connected to a specific method or action to be performed in response.

Returns:

None

moveEvent(event)[source]

Moves the screen image worker to the position specified by the given event.

Parameters:

event – A PyQt event containing information about the new position of the screen image worker.

Returns:

The return value of the super() method for the same event.

Raises:

N/A

onclick_change_state_debug()[source]

Toggles the debug mode state when the debug button is clicked.

If the debug mode is active, debug logging is enabled, and the button text is set to “Debug ON”. If the debug mode is inactive, debug logging is disabled, and the button text is set to “Debug OFF”.

Returns:

None

keyPressEvent(event)[source]

Handles key press events for keyboard shortcuts and special keys.

Activates different actions based on the key pressed and any modifiers. Supported shortcuts include toggling fullscreen with F11, handling escape events, and displaying message boxes for saving images or accessibility information.

Arg:

event: The key press event object.

Returns:

None

escape_event()[source]

Handles the escape button keyboard event, returning the application to its default state.

When the escape button is pressed, this method closes any open menus, resets the panel page, and exits the rubber band zoom mode if active.

Returns:

None

initial_setup_view()[source]

Sets up the initial view mode based on the moilapp’s mode_view attribute.

Depending on the mode_view attribute, this method styles the corresponding button in the user interface to indicate the selected view mode. It then triggers the appropriate method to initialize the view settings and display the image accordingly.

Returns:

None

onclick_handle_open_media_button()[source]

Prompts the user to select a media source and loads it into the app. If a file is selected, updates the model with the media source and parameter name, and updates the UI accordingly. If there is an existing result image, prompts the user for confirmation before changing the media source.

prompt_change_media_source()[source]

Prompts the user to confirm changing the media source.

Displays a confirmation message to the user asking if they want to change the media source. If the user confirms, the method proceeds to load the new media source.

Returns:

None

load_media_source()[source]

Prompt the user to confirm changing the media source.

Display a confirmation message to the user asking if they want to change the media source. If the user confirms, the method proceeds to load the new media source.

Returns:

None

update_model_and_create_original_image(source_type, cam_type, source_media, parameter_name)[source]

Updates the model configuration and creates the original image.

Update the main configuration attributes with the provided parameters, saves the updated configuration, processes the data configuration, and retrieves the list of recent projects.

Arg:

source_type (str): The type of media source. cam_type (str): The type of camera. source_media (str): The path to the media source. parameter_name (str): The name of the parameter.

Returns:

None

processing_data_config()[source]
adding_resolution_option()[source]

Add resolution options to the user interface.

Retrieves resolution options from the Moildev instance and populates the resolution combo box in the user interface with the available options.

Returns:

None

change_resolution_sources()[source]

Change the resolution sources based on the selected option from the combo box.

Updates the current resolution index in the Moildev instance, changes the resolution of the original image, recalculates label ratios, and updates the main configuration with the new resolution settings. It then performs the initial setup of the view.

Returns:

None

media_next_frame_signal()[source]

Proces the next frame for video processing.

Reads the next frame from the video capture device, calculates frame information, updates the video player, creates the image result, and displays the image to the user interface. If recording is enabled, writes the frame to the output video file.

Returns:

None

display_image_to_ui()[source]

Display the image to the user interface.

Create and display either the original image or the result image, depending on the current state of the application.

Returns:

None

showing_new_window_full_screen()[source]

Display a new window in full-screen mode.

Hide the current window, shows a new window maximized to full screen, sets the full-screen mode flag, and creates the image result.

Returns:

None

onclick_button_setting_menu(index)[source]

Handle the click event of the setting menu button.

If the setting menu is inactive, it displays the setting menu and switches the current index of the stacked widget to either the side view setting or recent project view. If the setting menu is active, it toggles between the current index of the stacked widget.

Arg:

index (int): The index of the stacked widget to switch to.

Returns:

None

onclick_open_about_us()[source]

Handle the click event of the ‘About Us’ button.

Display the ‘About Us’ page in the setting menu.

Returns:

None

back_to_home()[source]

Switch the content view to home screen and hides plugin buttons and sets the plugin index to None.

onclick_help_button()[source]

Handle the click event of the help button.

Display an informational message box indicating that the help menu is still under development.

Returns:

None

onclick_clear_user_interface()[source]

Reset the user interface to its default state.

This method stop the timer, resets various model and UI attributes to their default values, and hides certain UI elements. It also clears the saved image list and resets the styles of specific UI buttons.

reset_view_back_to_original()[source]

Reset the view back to the original state.

This method reset the view back to its original state, particularly when the user clicks on the “Back to Original” button. It hides certain UI elements and resets various attributes related to the view.

read_the_documentation()[source]

Open the HTML documentation for this project in a new browser tab.

Returns:

None

closeEvent(event)[source]
resizeEvent(event: PyQt6.QtGui.QResizeEvent) None[source]

Handle the resize event of the main window.

Adjust the size of the image according to the window size.

Arg:

None

Returns:

None

classmethod round_to_nearest_100(num)[source]

Round the given number to the nearest multiple of 20.

Arg:

num (int or float): The number to be rounded.

Returns:

The rounded number.

Return type:

int

GitHub Controller

This module contains the ControllerGitHub class responsible for handling GitHub-related functionalities in the MoilApp application.

Class:
ControllerGitHub: Handles GitHub-related functionalities such as refreshing repository information,

changing branches, committing changes, checking for updates, etc.

class controllers.control_github.ControllerGitHub(controller)[source]

Bases: object

This class handles GitHub-related functionalities in the MoilApp application.

_controller

The controller instance.

_model

The model instance.

_ui_object

The UI object instance.

_ctrl_main_config

The main configuration controller instance.

_github_config

The GitHub configuration from the main configuration.

_github_repo

The GitHub repository associated with the application’s model.

_show_message_box

A method to display message boxes.

__init__(self, controller)[source]

Initializes the ControllerGitHub instance.

_connect_event(self)[source]

Connects UI events to their respective methods.

_init_setting(self)[source]

Initializes UI settings.

_onclick_refresh_github_repository(self)[source]

Handles refreshing GitHub repository information.

_showing_github_repository_information(self)[source]

Updates the UI with information about the GitHub repository.

_show_info_update_in_github_repository(self)[source]

Fetches and displays information about commits behind the active branch.

open_dialog_for_input_token(self)[source]

Displays a dialog box to prompt the user for a GitHub token.

_onclick_btn_change_branch(self)[source]

Handles the click event of the “Change branch” button.

_combo_box_change_branch(self)[source]

Event handler for when the value of the combo box changes.

_onclick_commit_now(self)[source]

Commits changes to the Git repository.

_check_for_update(self)[source]

Checks for updates in the Git repository.

_check_for_new_update(self)[source]

Checks if a new software update is available and installs it if the user approves.

open_dialog_for_input_token()[source]

Display a dialog box to prompt the user for a GitHub token, and then validate and store the token in the application’s model.

Returns:

True if the token was successfully validated and stored in the model, False otherwise.

Return type:

bool

Image Original Controller

This module contains the ControlImageOriginal class, which provides methods for creating and displaying original images in a user interface, along with applying optional modifications based on different view modes and checkbox states. It facilitates functionalities such as adding crosshairs, drawing polygons, and displaying recentered images based on user interactions.

class controllers.control_image_original.ControlImageOriginal(controller)[source]

Bases: object

This class provides methods for creating and displaying original images in a user interface, along with applying optional modifications based on different view modes and checkbox states. It facilitates functionalities such as adding crosshairs, drawing polygons, and displaying recentered images based on user interactions.

_controller

The controller object responsible for managing the application flow.

_model

The model object containing application data and logic.

_main_config

Configuration settings for the main application.

_icx

X-coordinate of the image center.

_icy

Y-coordinate of the image center.

_ui_object

User interface object containing UI elements.

create_image_original()[source]

Creates and displays the original image in the user interface with optional modifications.

_get_image_for_original()[source]

Retrieves the image for the original view.

_apply_recenter_view(image)[source]

Applies recenter view modifications to the image.

_apply_normal_image(image)[source]

Applies normal view modifications to the image.

_state_fisheye_view(image)[source]

Applies modifications for fisheye view.

_state_anypoint_view(image)[source]

Applies modifications for anypoint view.

_state_panorama_view(image)[source]

Applies modifications for panorama view.

_display_image_in_label_original(image)[source]

Displays the image in the original label with optional modifications.

create_image_original()[source]

Create and display the original image in the user interface, with optional modifications.

Modifies the original image based on the view mode and checkbox states, such as adding a crosshair or drawing polygons. If ‘Reverse View’ is checked, additional adjustments are made, including displaying a recentered image and drawing polygons for specific view modes.

Returns:

None

Image Result Controller

This module contains the ControlImageResult class, which provides methods for applying the current view mode to an image and displaying the resulting image in the UI. It handles functionalities such as applying remapping for ‘AnypointView’ and ‘PanoramaView’, as well as zooming and cropping based on user interaction.

class controllers.control_image_result.ControlImageResult(controller)[source]

Bases: object

This class provides methods for applying the current view mode to an image and displaying the resulting image in the UI. It handles functionalities such as applying remapping for ‘AnypointView’ and ‘PanoramaView’, as well as zooming and cropping based on user interaction.

_controller

The controller object responsible for managing the application flow.

_ui_object

User interface object containing UI elements.

_model

The model object containing application data and logic.

_display_image

Function for displaying an image to a label in the UI.

_apply_view_mode(image)[source]

Apply the current view mode to the image.

_display_result_image(image_result)[source]

Display the resulting image in the UI.

create_image_result()[source]

Creates and displays the resulting image in the user interface.

create_image_result()[source]

Create and display the resulting image in the user interface.

Modifies the image based on the view mode and checkbox states, such as applying remapping for ‘AnypointView’ and ‘PanoramaView’. Handles zooming and cropping based on user interaction.

Returns:

None

Media Player Controller

This module provides a VideoController class responsible for controlling video playback in a PyQt6 application. It handles events such as play/pause, stop, rewind, and forward, as well as updating the video timer and slider position. The VideoController interacts with the PyQt6 GUI elements and the underlying video model to manage video playback functionalities.

class controllers.control_media_player.VideoController(controller)[source]

Bases: object

This class manages the control logic for video playback in a PyQt6 application. It handles events such as play/pause, stop, rewind, and forward, as well as updating the video timer and slider position. The VideoController interacts with the PyQt6 GUI elements and the underlying video model to coordinate video playback functionalities.

_controller

The controller object managing the application.

_model

The model object containing application data and settings.

_model_video_control

The video configuration model containing video-specific settings.

_ui_object

The user interface object containing PyQt6 elements.

check_active_play_pause_button()[source]

Checks the state of the play/pause button and updates its icon accordingly.

show_timer_video_info()[source]

Update the video timer labels with the given time values.

This method takes a list parameter, list_timer, that contains four values representing the current and total times of the video in minutes and seconds. The current time is displayed in the label_current_time label, and the total time is displayed in the label_total_time label.

set_slider_video_time_position()[source]

Set the value of a slider widget based on the current position of a video.

If a video is loaded, this function calculates the current time position as a percentage of the total duration and emits a signal with the corresponding value to update a slider widget. If no video is loaded, the function does nothing.

set_slider_position(value)[source]

Set the position of the video slider.

This method takes a float parameter, value, that represents the position of the video slider. The slider is updated to the given value, and the blockSignals method is used to prevent signals from being emitted during the update.

Message Box Controller

This module contains the ControlMessageBox class which provides functionality for displaying various types of message boxes in the MoilApp application.

class controllers.control_message_box.ControlMessageBox(main_controller)[source]

Bases: object

ControlMessageBox class provides functionality for displaying various types of message boxes in the MoilApp application.

display_ask_confirmation(message)[source]

Display a confirmation message box with the given message.

Arg:

message (str): The message to display in the confirmation box.

Returns:

True if the user clicks Yes, False if the user clicks No.

Return type:

bool

display_message_box(message='Default Message!', type_mode='information')[source]

Display a message box with the given message and type.

Parameters:
  • message (str) – The message to display in the message box. Defaults to “Default Message!”.

  • type_mode (str) – The type of message box to display. Should be either “information” or “warning”. Defaults to “information”.

show_update_dialog(message)[source]

Display a message box with options for the user to choose.

Arg:

message: A string containing the message to be displayed in the message box.

Returns:

An integer representing the user’s response to the message box.

show_message_box_record()[source]

Display a message box for selecting the recording option (Original or Processed Video).

Returns:

None

show_message_box_save_image()[source]

Display a message box for selecting the save option (Original or Processed Video).

Returns:

None

record_original_video()[source]

Set the recording option to “Original” and logs the action if debug mode is enabled.

Returns:

None

record_processed_video()[source]

Set the recording option to “Processed” and logs the action if debug mode is enabled.

Returns:

None

record_cancel()[source]

Cancel the recording process by setting the recording option to None and logs the action if debug mode is enabled.

Returns:

None

show_information_of_image(label)[source]

Display information about the current image view.

Display a message box with information about the current image view, including whether it is a fisheye, anypoint, or panorama view. If the current view has a polygon drawn on it, the message box will indicate that the polygon is being shown and the user can change the ROI by clicking on the image.

If the application is in zooming mode to view a specific ROI, a message box will be displayed indicating that the user should close the preview or press ‘Esc’ on the keyboard to return.

Arg:

label (str): The label of the current image view.

show_accessibility()[source]

Open a prompt displaying accessibility shortcuts for MoilApp.

Returns:

None

Mouse Event Controller

class controllers.control_mouse_event.MouseEvent(controller)[source]

Bases: object

calculate_ratio_label_ori()[source]

Calculate the ratio of label to original image dimensions.

Handle mouse events in the Moil logo.

Parameters:

event – The mouse event.

label_original_mouse_release_event(event)[source]

Handle mouse release events on the original image label.

Arg:

event: The mouse event.

label_original_mouse_move_event(event)[source]

Handle mouse move events on the original image label.

Arg:

event: The mouse event.

label_original_mouse_press_event(event)[source]

Handle mouse press events on the original image label.

Arg:

event: The mouse event.

label_original_mouse_leave_event(event)[source]

Handle the mouse leave event on the original image label.

This method is called when the mouse leaves the original image label in the UI. It delegates the handling of the event to the model_apps instance of the Model class.

label_original_mouse_double_click_event(event)[source]

Handle the mouse double-click event for the label_original widget, which displays the original fisheye image.

If the current view mode is AnypointView, calls the corresponding model_apps method and displays the corresponding view_anypoint UI widget.

label_result_mouse_double_click(event)[source]

Handle mouse double-click events on the result label.

Arg:

event: The mouse event.

label_result_mouse_press_event(event)[source]

Handle the mouse press event on the result image label.

Arg:

event: A QMouseEvent object representing the mouse press event.

Returns:

None.

Note

This function is responsible for creating and showing a rubberband when the left mouse button is pressed on the result image label. The rubberband is used to select a specific region of interest (ROI) in the image.

label_result_mouse_move_event(event)[source]

Handle mouse move events on the result label.

Arg:

event: A QMouseEvent instance representing the mouse move event.

Returns:

None.

label_result_mouse_release_event(event)[source]

Handle the mouse release event on the label_result widget.

If the left mouse button was released and an image is loaded, the size of the rubberband is checked. If it has a width and height greater than 20 pixels and the state of the rubberband is False, the size of the rubberband is stored in the model’s size_rubberband attribute, the state of the rubberband is set to True, and a new image result is created. The rubberband is then hidden. If the right mouse button is released, the menu_mouse_event method is called with the event object and the string “label_result” as arguments.

menu_mouse_event(event, label)[source]

Show a context menu on the mouse event with options for the specified label.

Parameters:
  • event – A QMouseEvent object containing information about the mouse event.

  • label – A string indicating the label type, either “label_result” or “label_original”.

label_recenter_mouse_press_event(event)[source]

Handle mouse press events on the recenter label.

Arg:

event: The mouse event.

label_recenter_mouse_move_event(event)[source]

Handle mouse move events on the recenter label.

Arg:

event: The mouse event.

update_label_recenter_mouse_move_event(label, event)[source]

Update the mouse move event for the recenter label.

Parameters:
  • label – The label to update.

  • event – The mouse event.

label_recenter_mouse_leave_event(event)[source]

Handle the mouse leave event for the recenter label.

Arg:

event: The mouse event.

update_label_recenter_mouse_leave_event()[source]

Update the mouse leave event for the label recenter.

This method updates the mouse leave event for the label recenter based on the current mode view.

label_recenter_mouse_release_event(event)[source]

Handle the mouse release event for the label recenter.

This method handles the mouse release event for the label recenter and triggers a menu mouse event if the right mouse button is clicked.

Arg:

event (QMouseEvent): The mouse event object.

set_value_coordinate_image_original(cor_x, cor_y)[source]

Set the coordinate values for the original image label in the user interface.

This method sets the coordinate values for the original image label in the user interface based on the given x and y coordinates.

Parameters:
  • cor_x (int) – The x-coordinate value.

  • cor_y (int) – The y-coordinate value.

set_value_coordinate_image_recenter(cor_x, cor_y)[source]

Set the coordinate values for the recenter image label in the user interface.

This method sets the coordinate values for the recenter image label in the user interface based on the given x and y coordinates.

Parameters:
  • cor_x (int) – The x-coordinate value.

  • cor_y (int) – The y-coordinate value.

show_alpha_beta_label_original(alpha, beta)[source]

Set the alpha and beta values based on the given coordinate.

This method sets the alpha and beta values for the original image label in the user interface based on the given coordinates. If either value is None, then both alpha and beta are set to 0.0. Otherwise, the alpha and beta values are rounded to two decimal places before being set.

Parameters:
  • alpha (float) – The alpha value.

  • beta (float) – The beta value.

show_alpha_beta_label_recenter(alpha, beta)[source]

Set the alpha and beta values for recentered image label in the user interface.

This method sets the alpha and beta values for the recentered image label in the user interface based on the given coordinates. If either value is None, then both alpha and beta are set to 0.0. Otherwise, the alpha and beta values are rounded to two decimal places before being displayed.

Parameters:
  • alpha (float) – The alpha value.

  • beta (float) – The beta value.

Plugin Collection Controller

This module defines the PluginCollection class responsible for managing a collection of plugins within a PyQt6 application.

class controllers.control_plugin_collection.PluginCollection(plugin_package)[source]

Bases: object

A class for managing a collection of plugins within a PyQt6 application.

_plugins

A list to store instances of plugin classes.

Type:

list

name_application

A list to store names of plugins.

Type:

list

_seen_paths

A list to keep track of paths already visited during package scanning.

Type:

list

path_folder

A list to store the module paths of plugins.

Type:

list

plugin_package

The name of the package containing plugins.

Type:

str

reload_plugins()[source]

Reload the plugins from the specified package.

This function clears the existing plugin list, name list, and folder path list, then walks through the plugin package and appends any valid plugins to the plugin list.

get_widget(index, model)[source]

Return the widget associated with a plugin at the specified index.

Parameters:
  • index – The index of the plugin to get the widget for.

  • model – The model to use when initializing the plugin’s widget.

Returns:

The widget associated with the plugin at the specified index, or None if there was an error.

set_always_pop_up(index)[source]

Set the “always popup” property of the plugin at the specified index.

Arg:

index (int): The index of the plugin.

Returns:

The value of the “always popup” property for the plugin.

get_icon_(index)[source]

Return the path of the icon for a given plugin index.

Arg:

index (int): The index of the plugin.

Returns:

The path to the icon file, or None if the plugin has no icon.

Return type:

str or None

change_theme(index)[source]

Change the stylesheet of the plugin at the given index to the current theme.

Arg:

index (int): The index of the plugin to update.

Returns:

None

get_description(index)[source]

Get the description of the plugin at the specified index.

Arg:

index (int): The index of the plugin.

Returns:

The description of the plugin.

Return type:

str

walk_package(package)[source]

Walk through the specified package and its sub-packages to find all classes that are a subclass of PluginInterface and add them to the list of plugins.

Arg:

package (str): The name of the package to search for plugins in.

Plugin Manager Controller

This module provides functionality for managing plugins within the application.

The PluginManager class defined in this module handles the installation, removal, and management of plugins within the application. It interacts with the PluginCollection class to load, install, and uninstall plugins. Additionally, it provides methods for opening plugins, displaying help information, and managing plugin-related UI elements.

Class:

PluginManager: Manages the plugins in the application.

class controllers.control_plugin_manager.PluginManager(*args: Any, **kwargs: Any)[source]

Bases: QMainWindow

Manages the plugins in the application.

The PluginManager class handles the installation, removal, and management of plugins within the application. It provides methods for installing new plugins from a plugin store, opening installed plugins, removing plugins, and displaying help information for plugins.

_controller

The main control object of the application.

Type:

object

_model

The model object of the application.

Type:

object

_stylesheet

The stylesheet object used for styling UI elements.

Type:

object

plugin

An instance of the PluginCollection class for managing plugins.

Type:

PluginCollection

_message_box

An instance of the MessageBoxHandler class for displaying messages.

Type:

object

_plugin_list

A list of available plugins retrieved from the plugin store.

Type:

list

apps_activated

The name of the currently activated plugin.

Type:

str

index

The index of the currently activated plugin.

Type:

int

widget

The widget associated with the currently activated plugin.

Type:

QWidget

text_title

The title of the currently activated plugin.

Type:

str

_main_config

The main configuration settings of the application.

Type:

dict

_github_config

The GitHub configuration settings for accessing the plugin store.

Type:

dict

_access_token

The access token for accessing the GitHub repository.

Type:

str

connect_to_event()[source]

Connects the main window buttons to their corresponding actions.

This method is responsible for setting up event connections between the buttons in the main window and their corresponding actions.

onclick_close_plugin_store()[source]

Closes the plugin store.

clicked_plugin_remove()[source]

Delete a plugin application from the system.

The function prompts the user with a confirmation message, and if the user confirms, deletes the plugin application from the system. The function then reloads the list of available plugins, initializes the available plugin UI, and displays a success message.

download_plugins_from_github(plugin)[source]

Download a plugin from GitHub.

Arg:

plugin (str): The name of the plugin to download.

get_list_plugins()[source]

Get the list of plugins from the plugin store on GitHub.

Retrieve the list of plugins from the GitHub repository and displays them in the plugin store UI.

clicked_install_plugins()[source]

Handle the installation of a plugin.

This method is triggered when the user clicks the install button for a plugin. It retrieves the name of the selected plugin and initiates the download process.

init_available_plugin()[source]

Initialize the available plugins by adding buttons for each one to the UI.

Clear any existing buttons from the UI layout, then iterates over the list of available plugins and adds a button for each one. The icon for each plugin is retrieved using the get_icon_ method of the PluginCollection object.

Returns:

None

install_new_plugin()[source]

Open a file dialog for selecting a new plugin folder and installs it into the plugin store.

refresh_the_plugin_available()[source]

Refresh the list of available plugins and adds new ones to the UI.

Retrieve the list of available plugins, compares it with the previous list, and adds any newly available plugins to the UI. Also displays a message box to inform the user about the successful addition of plugins.

Returns:

None

refresh_plugin_available(list_app)[source]

Refresh the list of available plugins.

Arg:

list_app (list): The previous list of available plugins.

Returns:

None

refresh_theme_widget()[source]

Refresh the theme of the currently selected plugin widget, if any.

Returns:

None

open_pinned_plugin(index)[source]

Open the pinned plugin with the specified index.

Arg:

index (int): The index of the pinned plugin to be opened.

Returns:

None

show_plugins_after_installation(widget)[source]

Show the installed plugin in the UI after installation.

Arg:

widget: The widget representing the installed plugin.

Returns:

None

open_plugin_apps()[source]

Open the selected plugin application and displays its widget in the plugin layout.

Raises:

IndexError – If the selected plugin index is not found in self.plugin.name_application.

Side Effects:
  • Sets self.index to the index of the selected plugin.

  • Shows the “Delete Plugins” and “Close Plugin” buttons in the main control UI.

  • Closes all widgets in the plugin layout before adding the selected plugin’s widget.

  • Changes the current widget container to the plugin layout.

  • Hides the “MOIL App” and “View” buttons in the main control UI.

  • Sets self.apps_activated to the selected plugin’s name.

open_plugins_in_new_window()[source]

Open the plugin application in a new window.

Returns:

None

add_btn_apps_plugin(icon_, name)[source]

Create and return a QPushButton widget with an icon and a name.

Parameters:
  • icon – A string specifying the path of the icon file.

  • name – A string specifying the name of the plugin.

Returns:

A QPushButton widget with the specified icon and name.

clear_item_layout()[source]

Clear the items from the layout.

Remove all items from the vertical layout ‘verticalLayout_plugin_store’ in the UI.

Returns:

None

delete_plugin_apps()[source]

Delete a plugin application from the system.

The function prompts the user with a confirmation message, and if the user confirms, deletes the plugin application from the system. The function then reloads the list of available plugins, initializes the available plugin UI, and displays a success message.

remove_plugin_folder(path)[source]

Remove a plugin folder from the directory.

Arg:

path (str): The path to the plugin folder.

Returns:

None

classmethod handle_remove_readonly(func, path, _)[source]

Handle the removal of read-only files or directories.

This method is used as an error handler when attempting to remove read-only files or directories. It clears the read-only attribute of the file or directory and attempts to delete it again.

Parameters:
  • func (callable) – The function used to remove the file or directory.

  • path (str) – The path to the read-only file or directory.

  • _ (object) – Ignored parameter required by the shutil.rmtree function.

Returns:

None

help_menu_plugin()[source]

Display a help message for the currently selected plugin in a pop-up box.

If the currently selected widget is the home screen, displays a generic message. Otherwise, displays a message that includes the plugin’s description.

Returns:

None

Recent Project Controller

This module defines the RecentOpen class, which represents a PyQt6-based GUI application for managing recent projects and directories.

The RecentOpen class provides functionality for opening recent projects, displaying files in selected directories, and managing recent projects in the UI.

It includes methods for handling click events, processing directories, managing recent projects in the UI, and opening recent project images.

Classes: - RecentOpen: Represents the main application window for managing recent projects and directories.

class controllers.control_recent_project.RecentOpen(*args: Any, **kwargs: Any)[source]

Bases: QMainWindow

The RecentOpen class represents a PyQt6-based GUI application for managing recent projects and directories.

Attributes: - controller: The controller object responsible for managing the application. - _model: The model object containing the application’s data and logic. - _stylesheet: The stylesheet object for defining the visual appearance of the UI. - directory_open_list: A list to store the paths of files in the selected directory.

Methods: - __init__: Initializes the RecentOpen instance. - click_open_directory: Handles the click event of the open directory button. - process_open_directory: Processes the selected directory and displays the files in the UI. - combo_box_selected: Handles the selection of options from the combo box. - detect_available_on_recent: Detects if a given path is available in the recent project list. - click_push_button_open_file_directory: Handles the click event of the push button to open a project. - clear_item_layout_directory_open: Clears the directory item projects in the user interface. - get_list_recent_project: Retrieves the list of recent projects and displays them in the UI. - add_list_recent_project_to_ui: Adds recent projects to the user interface. - click_push_button_open: Handles the click event of the push button to open a recent project. - click_push_button_delete: Handles the click event of the push button to delete a recent project. - clear_item_layout: Clears the items from the layout. - open_image_from_directory: Opens an image from the selected directory. - open_recent_image: Opens a recent project image. - remove_recent_image: Removes a recent project image.

click_open_directory()[source]

Handle the click event of the open directory button.

process_open_directory()[source]

Process the selected directory and display the files in the UI.

This method retrieves files with specific extensions from the selected directory, creates UI elements for each file, and adds them to the layout.

Returns:

None

combo_box_selected()[source]

Handle the selection of options from the combo box.

Retrieves the index of the selected combo box and performs further actions based on the selection.

Returns:

None

detect_available_on_recent(path)[source]

Detects if the given path is available in the recent project list.

Checks if the provided path matches any of the paths stored in the recent project list.

Arg:

path (str): The path to be checked.

Returns:

  • status (bool): True if the path is found in the recent project list, False otherwise.
    • index_recent_list (int or None): The index of the matching path in the recent project list, or None if not found.

    • theme (str): The theme of the detected path (‘install’ if found, ‘None’ otherwise).

Return type:

tuple

click_push_button_open_file_directory()[source]

Handle the click event of the push button to open a project.

Retrieve the index of the clicked push button and opens the corresponding project.

Returns:

None

clear_item_layout_directory_open()[source]

Clear the directory item projects in the user interface.

Remove all widgets from the vertical layout containing directory item projects.

Returns:

None

get_list_recent_project()[source]

Retrieve the list of recent projects and displays them in the UI.

add_list_recent_project_to_ui()[source]

Add recent projects to the user interface.

click_push_button_open()[source]

Handle the click event of the push button to open a recent project.

Retrieve the index of the clicked button and opens the corresponding recent project.

click_push_button_delete()[source]

Handle the click event of the push button to delete a recent project.

Retrieve the index of the clicked button and removes the corresponding recent project.

clear_item_layout()[source]

Clear the items from the layout.

Remove all items from the recent projects layout in the user interface.

open_image_from_directory(index)[source]

Open an image from the selected directory.

If the image is already part of the recent projects, it opens that project. Otherwise, it sets the selected image as the main project, updates the model configuration accordingly, and displays the image in the user interface.

Arg:

index (int): The index of the selected image in the directory.

Returns:

True if the operation is successful, False otherwise.

Return type:

bool

open_recent_image(index)[source]

Open a recent project image.

Arg:

index (int): The index of the recent project to open.

remove_recent_image(index)[source]

Remove a recent project image.

Arg:

index (int): The index of the recent project to remove.

Saving Media Controller

This module contains the SaveMedia class, which provides methods for saving images to a selected folder, loading saved images into the GUI’s list widget, recording videos, and other related functionalities.

class controllers.control_saving_media.SaveMedia(main_control)[source]

Bases: object

Class to handle saving images and recording videos in the application.

_controller

The main controller object.

_ui_object

The UI object.

_model

The model object.

__dir_save

The directory path for saving images.

__base_dir_save

The base directory path for saving images.

_record_option

The recording option.

_video_writer

The video writer object.

__init__(self, main_control)[source]

Initializes the SaveMedia object.

_connect_event(self)[source]

Connects event signals to their respective slots.

save_image_ori_result(self, image_result=True)[source]

Saves an image to a selected folder.

load_saved_image_list(self, load=False)[source]

Loads saved images into the GUI’s list widget.

add_widget_save_image(self, image, name_file, load=False)[source]

Adds a widget for a saved image to the list widget.

list_widget_saved_image_activated(self)[source]

Handles the activation of a saved image in the list widget.

onclick_clear_button_list_saved_image(self)[source]

Clears the saved image list.

onclick_record_video_button(self)[source]

Handles the click event on the Record Video button.

_enable_action_while_record(self, status=True)[source]

Enables or disables actions while recording video.

_check_status_record(self)[source]

Checks the status of Anypoint or Panorama recording.

set_position_frame_save_image(self, config, file_name, original=False)[source]

Sets the position of a saved frame in the configuration view.

property record_option

Get the recording option.

Returns:

The recording option.

Return type:

str

property video_writer

Get the video writer.

Returns:

The video writer object.

Return type:

Any

save_image_ori_result(image_result=True)[source]

Save the current or resulting image to a selected folder.

Arg:
image_result (bool, optional): Determines whether to save the resulting image

(True) or the original image (False). Defaults to True.

Raises:

FileNotFoundError – If the base directory for saving images is not found.

load_saved_image_list(load=False)[source]

Load saved images into the GUI’s list widget.

Arg:

load (bool, optional): Whether to load the images into the list widget. Defaults to False.

add_widget_save_image(image, name_file, load=False)[source]

Add a new widget to the saved image list with the given image and file name.

Parameters:
  • image (numpy.ndarray) – The image to be displayed in the widget.

  • name_file (str) – The name of the image file.

  • load (bool, optional) – Whether the widget is being added during load or not. Defaults to False.

list_widget_saved_image_activated()[source]

Handle the activation of a saved image in the list widget.

The function sets the appropriate image view mode and opens the saved image.

onclick_clear_button_list_saved_image()[source]

Clear the saved image list and the UI list widget.

onclick_record_video_button()[source]

Handle the click event on the Record Video button.

This function displays an information message indicating that video recording is currently under development, and unchecks the Record Video button.

set_position_frame_save_image(config, file_name, original=False)[source]

This function sets the position of a saved frame from the Image_saved list in the configuration view. If the timer is active, it will be stopped and the status will be emitted. If the parent path of the saved image is the same as the media source, the position of the frame will be set and the next frame signal will be emitted. If the parent path is different, the saved image will be reopened.

Parameters:
  • config

  • file_name (str) – The name of the saved file.

  • original (bool, optional) – Flag to indicate if the view is in original or not. Defaults to False.

Screen Record Controller

Module for handling screen recording functionality in the application.

This module contains the ScreenRecord class, which provides methods for recording the screen and managing the recording state.

class controllers.control_screen_record.ScreenRecord(controller)[source]

Bases: object

Class for handling screen recording functionality.

_controller

The main controller object.

_model

The model object.

_ui_object

The UI object.

__init__(self, controller)[source]

Initializes the ScreenRecord object.

onclick_record_screen(self)[source]

Handles the click event of the record screen button.

onclick_record_screen()[source]

Handle the click event of the record screen button.

If the button is checked, the screen recording is started and the button icon is changed to the “record” icon. If the button is unchecked, the screen recording is stopped and the button icon is changed to the “stop” icon.

Setup Icon Controller

Module for configuring the icon theme and setting icons for various UI elements.

This module contains the ConfigIconUI class, which provides methods for setting up the icon theme and configuring icons for different UI elements in the application.

Classes:

ConfigIconUI: A class for configuring the icon theme and setting icons for UI elements.

class controllers.control_setup_icon.ConfigIconUI(ui_main_window)[source]

Bases: object

Class for configuring the icon theme and setting icons for UI elements.

_ui_object

The main user interface object of the application.

__init__(self, ui_main_window)[source]

Initializes the ConfigIconUI object with the given main_ui object.

setup_icon_theme(self, theme)[source]

Sets the color theme for the main window of the application.

_set_icon_for_dark_mode_theme(self)[source]

Sets the UI to dark mode by changing the icons and logo to dark mode.

_set_icon_for_light_mode_theme(self)[source]

Changes the application’s icons to a light theme.

Initialize the MoilApp object with the given main_ui object.

Arg:

main_ui: A reference to the main user interface object of the application.

Returns:

None.

setup_icon_theme(theme)[source]

Set the color theme for the main window of the application.

Arg:

theme (str): The color theme to apply. Should be either “dark” or “light”.

Stylesheet Controller

This module contains the ControlStyleSheet class, which provides methods for changing style sheets of various UI elements based on user interactions and theme settings.

class controllers.control_stylesheet.ControlStyleSheet(controller)[source]

Bases: object

Class for controlling the style sheets of UI elements.

_controller

The controller object.

_model

The model object.

_ui_object

The UI object.

__init__(self, controller)[source]

Initializes the ControlStyleSheet object.

change_stylesheet_selected_menu(self)[source]

Change the stylesheet of a selected menu button.

set_style_selected_menu(self)[source]

Returns the CSS stylesheet for the currently selected menu item.

set_style_deselect_menu(self, get_style)[source]

Replaces the selected menu style with an unselected style.

reset_style(self, widget)[source]

Resets the stylesheet of all push buttons in the frame_button_view.

stylesheet_selected_menu_dark_theme(cls)[source]

Return the CSS stylesheet for a selected menu button in dark theme.

stylesheet_selected_menu_light_theme(cls)[source]

Returns the light theme stylesheet for the selected menu.

change_stylesheet_selected_menu()[source]

Change the stylesheet of a selected menu button.

If an image is available, this function updates the style of a selected menu button by applying a new stylesheet that highlights it. The old stylesheet is reset for all other buttons.

Arg:

self: An instance of the class that this method belongs to.

Returns:

None

set_style_selected_menu()[source]

Return the CSS stylesheet for the currently selected menu item.

The returned stylesheet is based on the current theme set in the model attribute.

Returns:

The CSS stylesheet for the selected menu item.

Return type:

str

set_style_deselect_menu(get_style)[source]

Replace the selected menu style with an unselected style in the current theme.

Arg:

get_style (str): The current style of the menu to be deselected.

Returns:

The updated style of the menu with the selected style replaced with the unselected style.

Return type:

str

reset_style(widget)[source]

Reset the stylesheet of all push buttons in the frame_button_view except for the one with the given object name.

Arg:

widget (str): The object name of the push button to exclude.

Returns:

None

classmethod stylesheet_selected_menu_dark_theme()[source]

Return the CSS stylesheet for a selected menu button in dark theme.

Returns:

The CSS stylesheet for a selected menu button in dark theme.

Return type:

str

classmethod stylesheet_selected_menu_light_theme()[source]

Return the light theme stylesheet for the selected menu.

Returns:

The stylesheet for the selected menu in the light theme.

Return type:

str

Theme Apps Controller

Module for controlling the theme of the application.

This module contains the ControlThemeApps class, which provides methods for initializing the UI with the current theme and for changing the theme between light and dark modes.

Class:

ControlThemeApps: A class for controlling the theme of the application.

class controllers.control_theme_apps.ControlThemeApps(controller)[source]

Bases: object

Class for controlling the theme of the application.

_controller

The controller object.

_ui_object

The UI object.

_model

The model object.

__init__(self, controller)[source]

Initializes the ControlThemeApps object.

init_ui(self)[source]

Initializes the UI with the current theme.

onclick_change_theme_apps(self)[source]

Changes the theme between light and dark modes.

Initialize the ControlThemeApps object.

Arg:

controller: The controller object.

Returns:

None

init_ui()[source]

Initialize the UI with the current theme.

Returns:

None

onclick_change_theme_apps()[source]

Change the theme between light and dark modes.

UI Animation Controller

This module contains the ControlPanelPage class, which provides methods for handling UI elements and animations related to the panel page.

class controllers.control_ui_animation.ControlPanelPage(controller)[source]

Bases: object

Class for controlling the panel page of the application.

_ui_object

The UI object.

_theme_mode

The current theme mode of the application.

_active_left

A flag indicating whether the left panel is active.

_animation

Animation object for controlling panel animations.

_group

Group animation object for coordinating multiple animations.

__init__(self, controller)[source]

Initializes the ControlPanelPage object.

close_setting_window(self)[source]

Closes the settings window if it is open.

button_menu(self, max_width, enable)[source]

Animates the left-side menu of the application.

button_about_us(self)[source]

Animates the “About Us” button and expands the right-hand additional frame.

setting_menu(self)[source]

Toggles the visibility of the additional left frame and updates the theme of the settings button.

_start_box_animation(self, left_box_width, right_box_width, direction)[source]

Animates the left and right boxes to slide in or out.

property active_left

Get the status of the left panel.

Returns:

True if the left panel is active, False otherwise.

Return type:

bool

close_setting_window()[source]

Close the settings window if it is open.

Returns:

None

button_menu(max_width, enable)[source]

Animate the left-side menu of the application.

Parameters:
  • max_width (int) – The maximum width the menu should extend to.

  • enable (bool) – Whether to enable or disable the animation.

Returns:

None.

button_about_us()[source]

Animate the “About Us” button and expand the right-hand additional frame.

Arg:

theme (str): The current theme (“light” or “dark”).

Returns:

None

setting_menu()[source]

Toggle the visibility of the additional left frame and update the theme of the settings button.

Arg:

theme: A string specifying the theme of the application. It can be “light” or “dark”.

Returns:

None.

View Anypoint Controller

Module for managing Anypoint configuration.

This module contains the AnypointConfig class, which is responsible for handling the configuration and user interface interactions related to the Anypoint mode.

class controllers.control_view_anypoint.AnypointConfig(controller)[source]

Bases: object

Class for managing Anypoint configuration.

_controller

The controller object.

_ui_object

The UI object.

_model

The model object.

__init__(self, controller)[source]

Initializes the AnypointConfig object.

_connect_event(self)[source]

Connects UI signals to their respective slots.

onclick_btn_anypoint(self)[source]

Handles the button click event for the Anypoint mode.

change_mode_anypoint(self)[source]

Change the current Anypoint mode.

change_properties_anypoint(self)[source]

Changes the properties of the Anypoint view mode.

onclick_anypoint_navigator(self)[source]

Handles anypoint buttons click event.

set_initial_value_to_ui_anypoint(self)[source]

Sets initial values to UI elements for Anypoint View.

showing_config_mode_1(self)[source]

Reads the cached file to load the configuration data for Mode 1.

showing_config_mode_2(self)[source]

Reads the cached file to load the configuration data for Mode 2.

change_properties_mode_1(self)[source]

Updates the configuration data for Mode 1 and writes it to the cached file.

change_properties_mode_2(self)[source]

Updates the configuration data for Mode 2 and writes it to the cached file.

check_box_active_mode_anypoint(self)[source]

Checks and sets the active mode for Anypoint View.

_get_alpha_beta_for_radio_mode(cls, button_name)[source]

Get alpha and beta angles for Anypoint View in radio mode.

_get_pitch_yaw_for_non_radio_mode(cls, button_name)[source]

Get pitch and yaw angles for Anypoint View in non-radio mode.

__block_signal(self)

Blocks signals for alpha, beta, roll, and zoom double spin boxes.

__unblock_signal(self)

Unblock the signals of the alpha, beta, roll, and zoom double spin boxes in the GUI.

onclick_btn_anypoint()[source]

Handle the button click event for the Anypoint mode.

Change the application state to the Anypoint mode, shows the Anypoint widget, and sets the current index of the widget to 0.

Returns:

None

change_mode_anypoint()[source]

Change the current anypoint mode.

Change the anypoint mode based on the selected radio button in the user interface. Shows or hides certain configuration options depending on the selected mode. Updates the anypoint maps and the anypoint mode in the model.

Returns:

None

change_properties_anypoint()[source]

Change the properties of the AnyPoint view mode.

If an image result is available, this method changes the properties of the AnyPoint view mode according to the values set in the GUI. The changes are applied to the configuration object, and new maps are created. The configuration file is updated accordingly.

Raises:

None.

Returns:

None.

onclick_anypoint_navigator()[source]

Handle anypoint buttons click event.

If radio_mode_1 is checked, set alpha and beta values based on the button clicked, then call showing_config_mode_1 and create_maps_anypoint_mode_1 methods. If radio_mode_1 is not checked, set alpha and beta values based on the button clicked, then call showing_config_mode_2 and create_maps_anypoint_mode_2 methods. Set state_rubberband attribute to False and update the file config.

set_initial_value_to_ui_anypoint()[source]

Set the initial values to UI elements for Anypoint View.

This method sets initial values to spin boxes and double spin boxes for Anypoint View coordinates and angles. It first blocks signals of the UI elements to prevent emitting unnecessary signals while setting values. Then, it retrieves the initial values from the main configuration based on the active mode view. After setting the values, it unblocks signals of the UI elements.

Returns:

None

showing_config_mode_1()[source]

Read the cached file to load the configuration data for Mode 1.

This function reads the YAML data from the cached file and loads it into the self.__anypoint_config attribute. It then sets the values of the zoom, alpha, and beta parameters for Mode 1 in the UI double spin boxes. The function blocks signals while updating the spin box values to prevent recursive updates. Once the values are set, the function unblocks signals.

Returns:

None

showing_config_mode_2()[source]

Read the cached file to load the configuration data for Mode 2.

This function reads the YAML data from the cached file and loads it into the self.__anypoint_config attribute. It then sets the values of the pitch, yaw, roll, and zoom parameters for Mode 2 in the UI double spin boxes. The function blocks signals while updating the spin box values to prevent recursive updates. Once the values are set, the function unblocks signals.

Returns:

None

change_properties_mode_1()[source]

Update the configuration data for Mode 1 and writes it to the cached file.

This function updates the alpha, beta, and zoom parameters for Mode 1 using the values in the UI double spin boxes. It rounds the zoom value to three decimal places before updating the configuration data. The updated configuration data is then written to the cached file using YAML format.

Returns:

None

change_properties_mode_2()[source]

Update the configuration data for Mode 2 and writes it to the cached file.

This function updates the pitch, yaw, roll, and zoom parameters for Mode 2 using the values in the UI double spin boxes. It creates a list of tuples to store the control names and their corresponding values, and then iterates through the list to update the configuration data for each control. The zoom value is rounded to three decimal places before updating the configuration data. The updated configuration data is then written to the cached file using YAML format.

Returns:

None

check_box_active_mode_anypoint()[source]

Check and set the active mode for Anypoint View.

If the current mode view is “AnypointView”, this method blocks the signals of radio buttons to prevent emitting unnecessary signals while updating their states. It then sets the checked state of radio buttons based on the active view stored in the main configuration. Finally, it unblocks the signals of the radio buttons.

Returns:

None

View Fisheye Controller

This module contains the ControlImageFisheye class, which is responsible for managing the interactions related to fisheye images in the application.

class controllers.control_view_fisheye.ControlImageFisheye(controller)[source]

Bases: object

Class for controlling fisheye images.

_controller

The controller object.

_model

The model object.

_ui_object

The UI object.

__init__(self, controller)[source]

Initializes the ControlImageFisheye object.

onclick_btn_fisheye(self)[source]

Changes the current view mode to fisheye.

set_initial_value_to_ui(self)[source]

Set initial values to the user interface elements.

Initialize the ControlImageFisheye object.

Arg:

controller: The controller object.

Returns:

None

onclick_btn_fisheye()[source]

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.

Returns:

None

set_initial_value_to_ui()[source]

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.

Returns:

None

View Fullscreen Controller

This module contains the ControlViewFullscreen class, which is responsible for managing the interactions related to the full-screen view in the application.

class controllers.control_view_fullscreen.ControlViewFullscreen(controller)[source]

Bases: object

Class for controlling full-screen view.

_controller

The controller object.

_model

The model object.

_new_window

The new window object for full-screen view.

_full_screen_mode

A boolean indicating whether full-screen mode is active.

__init__(self, controller)[source]

Initializes the ControlViewFullscreen object.

resize_event_new_window(self, a0

QtGui.QResizeEvent) -> None: Handles resize events for the new window.

label_full_screen_double_click_event(self, event)[source]

Handles double-click event on the full-screen label.

control_fov_full_screen(self)[source]

Controls field of view for the original image in full-screen mode.

_add_full_screen_window(self)[source]

Adds components to create the full-screen window.

Initialize the ControlViewFullscreen object.

Arg:

controller: The controller object.

Returns:

None

resize_event_new_window(a0: PyQt6.QtGui.QResizeEvent) None[source]

Handle the resize event for the new window.

This method is triggered when the new window is resized. If the original image exists in the model, it updates the UI to display the image accordingly.

Arg:

a0 (QtGui.QResizeEvent): The resize event.

Returns:

None

property new_window

Getter property for the new window.

Returns:

The new window.

Return type:

QtWidgets.QWidget

property full_screen_mode

Getter property for the full screen mode.

Returns:

The current full screen mode.

Return type:

bool

label_full_screen_double_click_event(event)[source]

Handle the double-click event on the full-screen label.

Arg:

event: The event object.

control_fov_full_screen()[source]

Control field of view for the original image in full-screen mode.

View Panorama Controller

This module defines the PanoramaConfig class, which handles the configuration of panorama views in an application

class controllers.control_view_panorama.PanoramaConfig(controller)[source]

Bases: object

This class provides methods to handle user interactions related to configuring panorama views, including changing modes between car and tube, setting initial values for UI elements, updating properties based on user input, and managing signals between UI elements and the underlying model.

__init__()[source]

Initializes a new instance of the PanoramaConfig class.

_connect_event()[source]

Connects UI signals to corresponding slots.

onclick_btn_panorama()[source]

Handles click event for the ‘panorama’ button.

change_mode_panorama()[source]

Changes the panorama mode between ‘car’ and ‘tube’.

set_initial_value_to_ui_panorama()[source]

Sets initial values for UI elements in panorama view configuration.

change_properties_panorama()[source]

Changes properties of the panorama view configuration based on user input.

change_properties_crop_panorama()[source]

Changes the properties of the panorama crop based on user input.

block_signal_pano_tube()[source]

Blocks signals for UI elements related to the tube panorama view.

unblock_signal_pano_tube()[source]

Unblocks signals for UI elements related to the tube panorama view.

block_signal_pano_car()[source]

Blocks signals for UI elements related to the car panorama view.

unblock_signal_pano_car()[source]

Unblocks signals for UI elements related to the car panorama view.

showing_config_panorama_tube()[source]

Updates UI elements with panorama tube configuration values.

showing_config_panorama_car()[source]

Updates UI elements with panorama car configuration values.

change_properties_panorama_tube()[source]

Changes properties of the panorama tube view configuration.

change_properties_panorama_car()[source]

Changes properties of the panorama car view configuration.

check_box_active_mode_panorama()[source]

Checks and sets the active mode in the panorama view.

onclick_btn_panorama()[source]

Handle click event for the ‘panorama’ button.

Change the app’s recent view state to ‘PanoramaView’, shows the widget mode view and frame pointer anypoint, sets the current index of the widget mode view to 1, and sets the state rubberband to False if an image has been loaded.

Returns:

None

change_mode_panorama()[source]

Change the panorama mode to either ‘car’ or ‘tube’.

This method sets the panorama mode to either ‘car’ or ‘tube’ based on the selected radio button. If the ‘car’ radio button is selected, the car configuration frame is shown and the tube configuration frame is hidden. The opposite is true if the ‘tube’ radio button is selected. The panorama configuration object is then updated and the maps for the selected mode are created.

set_initial_value_to_ui_panorama()[source]

Set initial values to the user interface elements for the Panorama view configuration.

This method sets the initial values of spin boxes and double spin boxes in the user interface based on the Panorama view configuration.

Returns:

None

change_properties_panorama()[source]

Change the properties of the panorama configuration according to the selected options.

If there is a result image, this function updates the panorama configuration and maps based on the selected radio button, which can be “Car” or “Tube”. It then updates the file configuration. If there is no result image, this function does nothing.

change_properties_crop_panorama()[source]

Change the properties of the current panorama crop.

If there is a panorama image loaded, this function updates the properties of the crop using the settings selected in the UI. If the “car” option is selected, the panorama is cropped to a horizontal field of view of 360 degrees and a vertical field of view of 90 degrees. If the “tube” option is selected, the panorama is cropped to a horizontal field of view of 180 degrees and a vertical field of view of 360 degrees.

After updating the properties of the crop, this function updates the app’s configuration file and creates a new image result.

block_signal_pano_tube()[source]

Block signals for panoptic tube spin boxes and double spin boxes.

This method blocks signals for the following spin boxes and double spin boxes: - self.ui_object.doubleSpinBox_pano_tube_alpha_min - self.ui_object.doubleSpinBox_pano_tube_alpha_max - self.ui_object.doubleSpinBox_pano_tube_crop_top - self.ui_object.doubleSpinBox_pano_tube_crop_bottom

unblock_signal_pano_tube()[source]

Unblock the signals for the pano tube settings widgets.

This function calls the _unblock_signal method to unblock the signals for the pano tube settings widgets.

block_signal_pano_car()[source]

Block the signals of certain UI elements related to the panoramic car view.

unblock_signal_pano_car()[source]

Unblock signals for a set of widgets related to the panoramic car view.

This function unblocks signals for the following widgets: doubleSpinBox_pano_car_alpha, doubleSpinBox_pano_car_beta, doubleSpinBox_pano_car_crop_left, doubleSpinBox_pano_car_crop_right, doubleSpinBox_pano_car_crop_top, doubleSpinBox_pano_car_crop_bottom. This allows changes to these widgets to trigger the corresponding slots.

This function is called by the GUI when the user leaves a specific tab or dialog box in the panoramic car view.

showing_config_panorama_tube()[source]

Read the panorama configuration from a YAML file, and populates the relevant UI elements with the values.

Open the cached configuration file using the private attribute __cached_file as the file path, and reads its contents using PyYAML’s safe_load method. The relevant UI elements are then set to the corresponding values found in the configuration file.

Note

This function blocks signals from the UI elements while updating them with the configuration values.

Raises:

IOError – If the configuration file cannot be read.

showing_config_panorama_car()[source]

Load the panorama car configuration from a cached YAML file and updates the user interface with its values.

Read the cached file at self.__cached_file using the PyYAML library to parse the YAML content. The parsed configuration values are assigned to the instance variable self.__panorama_config. Blocks signals from all the widgets associated with the car panorama in the user interface to prevent any unintended updates during the UI update process. Then, sets the values of the panorama car configuration widgets in the UI with the parsed values from the configuration file. Finally, unblocks signals from all the widgets that were previously blocked.

Returns:

None

change_properties_panorama_tube()[source]

Change the properties of the panorama tube.

Read the new values for alpha_min, alpha_max, crop_top, and crop_bottom from the corresponding UI elements, and updates the __panorama_config dictionary with the new values if they meet certain criteria. Then writes the updated dictionary to a YAML file.

change_properties_panorama_car()[source]

Update the properties of the car panorama and saves them to a YAML file.

Update the alpha and beta properties of the car panorama from the GUI spinboxes. Update the crop_left, crop_right, crop_top, and crop_bottom properties of the car panorama from the GUI double spinboxes. Saves the updated panorama configuration to a YAML file specified in self.__cached_file.

check_box_active_mode_panorama()[source]

Check and set the active mode in the Panorama view.

This method checks the active mode in the Panorama view and sets the corresponding radio button in the user interface.

Returns:

None

View Recenter Controller

This module contains classes for configuring panorama and recentering views in the application.

Classes:
  • PanoramaConfig: Manages configuration related to panorama views, including car and tube modes.

  • RecenterConfig: Manages configuration related to recentering images in the application.

Each class provides methods to handle user interactions, update configurations, and create necessary image transformations.

class controllers.control_view_recenter.RecenterConfig(controller)[source]

Bases: object

This class provides methods to handle user interactions for changing the optical point coordinates, activating the change optical point feature, and creating recentered images based on the original image and recentering maps.

__init__()[source]

Initializes a new instance of the RecenterConfig class.

_connect_event()[source]

Connects UI signals to corresponding slots.

activate_change_optical_point()[source]

Activates the change optical point feature based on the state of a checkbox.

change_coordinate_optical_point()[source]

Changes the optical point coordinates based on user input.

create_image_recenter()[source]

Creates a recentered image based on the original image and recentering maps.

activate_change_optical_point()[source]

Activate change optical point feature.

Arg:

state (bool): The state of the checkbox.

change_coordinate_optical_point()[source]

Change optical point coordinates.

create_image_recenter()[source]

Create a recentered image.

This method generates a recentered image based on the original image and recentering maps.

Returns:

The recentered image.

Return type:

numpy.ndarray

Raises:

ValueError – If the recentering maps are not set.

View Rotate Controller

This module contains classes for managing various aspects of image processing and manipulation in the application’s user interface.

Classes:
  • PanoramaConfig: Manages panorama view configuration settings and UI interactions.

  • RecenterConfig: Handles recentering of images and related UI controls.

  • ControlViewRotate: Manages image rotation functionality and UI controls.

class controllers.control_view_rotate.ControlViewRotate(controller)[source]

Bases: object

This class manages the rotation of images in the application’s user interface.

- __init__(controller)

Initializes the ControlViewRotate instance.

- _connect_event()

Connects GUI events to their corresponding methods.

- _change_rotate_degree(direction)

Rotates the result image in the specified direction.

- _show_rotation_value()

Sets the value of the rotation angle in the GUI.

- _rotation_change_value()

Updates the rotation angle when the user changes its value.

- _rotation_image_ori_change_value()

Updates the rotation angle for the original image.

- _rotation_original_change_value()

Updates the rotation angle for the original image.

- set_initial_value_to_ui_rotate()

Sets the initial rotation values in the user interface.

set_initial_value_to_ui_rotate()[source]

Set the initial rotation values to the user interface.

This method sets the initial rotation values for the processed image and the original image to the corresponding spin boxes in the user interface.

Returns:

None

View Zoom Controller

This module contains classes for managing various view controls in the application.

Classes:
  • ControlViewRotate: Manages image rotation functionality and UI controls.

  • ControlViewZoom: Manages image zoom functionality and UI controls.

class controllers.control_view_zoom.ControlViewZoom(controller)[source]

Bases: object

Manages image zoom functionality and UI controls.

This class provides methods to handle zoom in, zoom out operations, and control the zooming level displayed in the user interface.

- __init__

Initializes the ControlViewZoom object.

- _connect_event

Connects UI events to corresponding methods.

- _onclick_zoom

Handles zoom in/out operations.

- _control_change_zooming

Controls the change of zooming in the displayed image.

- show_percentage_zoom

Displays the percentage of the current zoom level in the zoom spin box.

show_percentage_zoom()[source]

Display the percentage of the current zoom level in the zoom spin box.

Calculate the percentage of the current width of the image result with respect to the original width of the input image, and sets the value of the zoom spin box to this percentage.

Returns:

None