API References

Controller Package

Main Controller

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

Bases: QMainWindow

Initialize the MoilApp GUI.

Parameters:
  • ui – The user interface for the MoilApp.

  • model – The model representing the MoilApp.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

None

connect_event()[source]

Connects all the events and signals to their respective functions.

Args: self: An instance of the class.

Returns:

None

add_full_screen_window_show_result()[source]
label_full_screen_double_click_event(event)[source]
control_fov_full_screen()[source]
back_to_moil_apps()[source]
showing_new_window_full_screen()[source]
resize_event_new_window(a0: PyQt6.QtGui.QResizeEvent) None[source]
show_general_information()[source]

Show general information on the user interface

Parameters:

None

Returns:

None

onclick_show_moilapp_plugin_store()[source]
get_list_plugins()[source]
clear_item_layout()[source]
clicked_test()[source]
download_plugins_from_github(plugin)[source]
onclick_close_plugin_store()[source]
show_config_view_in_information(config)

Updates the information labels in the UI with the given configuration data.

Parameters:

config (dict) –

A dictionary containing the configuration data to be displayed. It should have the following keys:

  • ”Media_path”: A string representing the path to the media being used.

  • ”Cam_type”: A string representing the type of camera being used.

  • ”Parameter_name”: A string representing the name of the parameter being used.

Returns:

None

Side effects:
  • Updates the “Media path” label in the UI with the value of “Media_path” in config.

  • Updates the “Media type” label in the UI with the value of “Cam_type” in config.

  • Updates the “Parameter used” label in the UI with the value of “Parameter_name” in config.

reset_view_back_to_original()[source]

Resets the UI to its original state.

Unlocks the menu state view, enables the mode view widget, and hides it. If the image result is not None, resets its width and angle to default values, sets the state of the rubberband tool to False, and re-runs the image processing pipeline after loading a saved image. Finally, updates the UI to display the new rotation value.

Parameters:

None

Returns:

None

change_polygon_state()[source]

Sets the drawing state of the polygon based on the checked state of the UI element.

If the ‘check_draw_polygon’ UI element is checked, the drawing state of the polygon will be set to True. Otherwise, it will be set to False.

Parameters:

None

Returns:

None

label_recenter_mouse_leave_event(event)[source]
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.

Parameters:

event (QEvent) – The event object representing the mouse leave event.

Returns:

None

label_original_mouse_double_click_event(event)[source]

Handles 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 anypoint_config UI widget.

Parameters:

event – A QMouseEvent object representing the mouse double-click event.

Returns:

None.

label_recenter_mouse_press_event(event)[source]
label_original_mouse_press_event(event)[source]

Handles mouse press events on the original label.

Parameters:

event (QtGui.QMouseEvent) – The mouse press event.

Returns:

None

label_recenter_mouse_move_event(event)[source]
label_original_mouse_move_event(event)[source]

Handles mouse move events on the original label.

Parameters:

event

Returns:

None

label_result_mouse_double_click(event)[source]

Handles mouse double-click events on the original label.

Parameters:

event (QtGui.QMouseEvent) – The mouse press event.

Returns:

None

label_result_mouse_press_event(event)[source]

Handles the mouse press event on the result image label.

Parameters:

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.

Parameters:

event – A QMouseEvent instance representing the mouse move event.

Returns:

None.

label_result_mouse_release_event(event)[source]

Handles the mouse release event on the label_result widget.

Parameters:

event – A QMouseEvent object representing the mouse event.

Returns:

None.

Behavior:

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.

label_original_mouse_release_event(event)[source]

Handle the mouse release event on the original image label.

Parameters:

event (QMouseEvent) – The mouse release event that triggered the function.

Returns:

None.

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”.

Returns:

None

show_information_of_image(label)[source]

Displays information about the current image view.

Displays 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.

Parameters:

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

Returns:

None

save_image(image_result=True)[source]

Saves the current or resulting image to a selected folder.

Parameters:

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.

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.

Parameters:

None.

Returns:

None.

load_saved_image_list(load=False)[source]

Loads saved images into the GUI’s list widget.

Parameters:

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

Returns:

None

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

Adds 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.

Returns:

None

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.

Parameters:

None.

Returns:

None.

lock_menu_state_view()[source]

Locks the state of the view menu by disabling all view mode buttons and resetting their style to default.

Parameters:

None

Returns:

None

unlock_menu_state_view()[source]

Unlocks the state of the menu for viewing modes, enabling the FishEye, AnyPoint, and Panorama buttons.

Parameters:

None

Returns:

None

reset_style_button_menu()[source]

Resets the style of the fish-eye, anypoint, and panorama buttons to their default state.

Parameters:

None

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.

Parameters:

None

Returns:

None

change_properties_crop_panorama()[source]

Changes 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.

Parameters:

None

Returns:

None

change_mode_panorama()[source]

Changes 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.

Raises:

None

Returns:

None

activate_change_optical_point()[source]
set_value_coordinate(coordinate)
change_coordinate_optical_point()[source]
show_recenter_image(image)
change_mode_anypoint()[source]

Change the current anypoint mode.

Changes 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]

Changes 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()[source]

Handle anypoint buttons click event.

If radio_mode_1 is checked, the method sets the alpha and beta values of the model_apps object based on which button was clicked and then calls the showing_config_mode_1 and create_maps_anypoint_mode_1 methods. If radio_mode_1 is not checked, the method sets the alpha and beta values of the model_apps object based on which button was clicked and then calls the showing_config_mode_2 and create_maps_anypoint_mode_2 methods. It also sets the state_rubberband attribute of the model_apps object to False and updates the file config.

Raises:

None

Returns:

None

classmethod read_the_documentation()[source]

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

If the ../docs/build/html directory doesn’t exist, this method runs the command make -C ../docs html to generate the documentation. Then, it opens the index.html file in the ../docs/build/html directory in a new browser tab.

Parameters:

cls – The class object itself.

Returns:

None

classmethod show_message(title, message)[source]

Show an information message box with a title and a message for 5 seconds.

Parameters:
  • title – A string with the title of the message box.

  • message – A string with the message to be displayed.

Returns:

None

classmethod onclick_btn_github()[source]

Open the link to the project’s GitHub page in a new browser window.

Parameters:

None

Returns:

None

onclick_button_menu()[source]

Handles the click event for the menu button.

This method calls the button_menu method of the ctrl_apps object to show the menu with a width of 220 pixels and sets the flag to True to indicate that the menu is open.

Parameters:

self – The instance of the current object.

Returns:

None.

onclick_button_about_us()[source]

Handles the click event for the “About Us” button.

This method calls the button_about_us method of the ctrl_apps object to show the “About Us” page and sets the flag to True to indicate that the page is open. The current theme of the app is also passed as a parameter to the button_about_us method.

Parameters:

self – The instance of the current object.

Returns:

None.

onclick_button_setting_menu()[source]

Handles the click event for the “Settings” button.

This method calls the setting_menu method of the ctrl_apps object to show the “Settings” menu and sets the flag to True to indicate that the menu is open. The current theme of the app is also passed as a parameter to the setting_menu method.

Parameters:

self – The instance of the current object.

Returns:

None.

onclick_record_screen()[source]

Handles 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.

Parameters:

None

Returns:

None

Raises:

None

resizeEvent(a0: PyQt6.QtGui.QResizeEvent) None[source]
classmethod round_to_nearest_100(num)[source]
closeEvent(event)[source]
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_btn_open_media()[source]

Handles the click event for the “Open Media” button.

This method prompts the user to select a media source and loads the selected media into the app. If the user selects a file, it sets the media source and parameter name in the model_apps object and calls the load_saved_image_list and show_rotation_value methods to update the UI. It also updates the view mode and hides some UI elements. If there is a result image, it sets the recent view state in the model_apps object to “FisheyeView” and loads the saved image list.

If the user does not select a file, this method displays an information message box.

Parameters:

self – The instance of the current object.

Returns:

None.

control_video_controller(source_media_type)

Controls the visibility of the video controller frame based on the type of media source.

This method takes a string parameter, source_media_type, that specifies the type of media source. If the source is an image, the video controller frame is hidden. Otherwise, it is shown.

Parameters:
  • self – The instance of the current object.

  • source_media_type – A string that specifies the type of media source.

Returns:

None.

onclick_play_pause_video(status)

Handles the play/pause button click event for the video player.

This method takes a boolean parameter, status, that indicates whether the video should be played or paused. If the status is True, the play/pause button is updated to show the pause icon. Otherwise, it is updated to show the play icon.

Parameters:
  • self – The instance of the current object.

  • status – A boolean that indicates whether the video should be played (True) or paused (False).

Returns:

None.

set_slider_position(value)

Sets 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.

Parameters:
  • self – The instance of the current object.

  • value – A float that represents the new position of the video slider.

Returns:

None.

show_timer_video_info(list_timer)

Updates 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.

Parameters:
  • self – The instance of the current object.

  • list_timer – A list of four integers representing the current and total times of the video in minutes and seconds.

Returns:

None.

alpha_beta_from_coordinate(alpha_beta)

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

This method takes a list parameter, alpha_beta, that contains two values representing the alpha and beta angles of a spherical coordinate. If either value is None, then the alpha and beta labels are set to 0.0. Otherwise, the alpha and beta labels are set to the rounded values of alpha_beta[0] and alpha_beta[1], respectively.

Parameters:
  • self – The instance of the current object.

  • alpha_beta – A list of two floating-point numbers representing the alpha and beta angles of a spherical coordinate.

Returns:

None.

show_image_original(image)

Displays the original image in the designated label.

This method takes an image object and displays it in the label_image_original widget. The image is scaled to fit within the dimensions of the label while maintaining its aspect ratio.

Parameters:
  • self – The instance of the current object.

  • image – An image object to display in the label.

Returns:

None.

get_image_result(image)

Sets the image result and displays it.

This method takes an image object and sets it as the current image result. It then calls the show_image_result method to display the image in the label. If no image is provided, the method does nothing.

Parameters:
  • self – The instance of the current object.

  • image – An image object to set as the current image result.

Returns:

None.

control_change_zooming()[source]

Controls the change of zooming in the displayed image. Updates the displayed image’s width according to the zoom level set by the user through the spinBox_zooming input. The updated width is chosen from a predefined list of possible values to ensure the closest match to the desired width.

Parameters:

None.

Returns:

None.

Raises:

None.

zoom_image(operation)[source]

Zooms in or out on the result image.

Parameters:

operation (str) – The zoom operation to perform. Must be one of “zoom_in” or “zoom_out”.

show_percentage_zoom()[source]

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

Calculates 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.

Parameters:

None

Returns:

None

show_image_result()[source]

Displays the image result with the specified width and angle to the result label.

Parameters:

image – The image result to be displayed on the label.

Returns:

None

rotate_image(direction)[source]

Rotates the result image in the specified direction.

Parameters:

direction (str) – The direction to rotate the image. Must be either “left” or “right”.

Returns:

None.

show_rotation_value()[source]

Sets the value of the rotation angle in the GUI.

Disables the signals of the GUI double spin box widget, sets its value to the current rotation angle and enables the signals back again.

Parameters:

None

Returns:

None

rotation_change_value()[source]

Updates the rotation angle when the user changes its value.

Sets the new value of the rotation angle to the private attribute and also to the model of the application. If the rubber band tool is active, it updates the result image and the percentage of zoom. Otherwise, it creates a new result image.

Parameters:

None

Returns:

None

onclick_btn_fisheye()[source]

Changes 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.

Parameters:

None

Returns:

None

onclick_btn_anypoint()[source]

Handles the button click event for the Anypoint mode.

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

Returns:

None

onclick_btn_panorama()[source]

Handles click event for the ‘panorama’ button.

Changes 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

onclick_clear_user_interface()[source]

Clears the user interface and resets the app state to its default state.

This function resets the app’s state to its default state, clears the displayed images, and resets the style of the mode buttons.

Parameters:

None.

Returns:

None.

onclick_clear_button_list_saved_image()[source]

Clear the saved image list and the UI list widget.

Returns:

None.

close_setting_window()[source]

Closes the settings window if it is open.

Returns:

None

escape_event()[source]

Escape button keyboard event. Will return to the default state of application.

Returns:

onclick_play_pause_video_button()[source]

Handle mouse events in the MOIL logo.

Parameters:

event – The mouse event to handle.

Returns:

None

classmethod onclick_help_button()[source]
back_to_home()[source]

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

Returns:

None

showing_git_repository_information(data=None)

Updates the UI with information about a Git repository.

Parameters:

data (dict) – A dictionary containing information about the Git repository.

Returns:

None

onclick_refresh_github_repository()[source]
Updates the Github repository information by refreshing the repository and showing the updated information if there

are any changes.

Returns:

None

check_for_update()[source]

Checks for updates in the Git repository.

If Git is not installed, does nothing. If a token is not set, asks the user to input one. Otherwise, calls show_info_of_github_repository and check_for_new_update.

Returns:

None

check_for_new_update()[source]

Check if a new software update is available and install it if user approves.

Returns:

None

show_update_dialog(message)[source]

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

Parameters:

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. The value will be one of the following constants from the QMessageBox.StandardButton enum: QMessageBox.Yes, QMessageBox.No.

show_update_successful_message(message)[source]

Shows a message box to indicate that the software has been updated successfully.

Parameters:

message – A string containing the release note for the software update.

Returns:

None

Raises:

None

show_info_of_github_repository()[source]

Fetches and displays information about the GitHub repository associated with the application’s model. Specifically, it retrieves a list of commits behind the currently active branch, and displays their commit message and hex SHA in the application’s text browser.

Returns:

None

open_dialog_for_input_token()[source]

Displays a dialog box to prompt the user for a GitHub token, and then validates and stores 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

onclick_btn_change_branch()[source]

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

If the button is checked, shows a frame containing a list of available branches for the user to choose from. If the button is unchecked, hides the frame.

Parameters:

self – An instance of the class.

Returns:

None.

combo_box_change_branch()[source]

Event handler for when the value of the combo box changes. It checks if the selected branch name is different from the currently active branch of the GitHub repository. If it is different and a valid GitHub token exists, it attempts to change the active branch to the selected branch, and then updates the configuration and GitHub information in the application’s model. It also checks if the ‘docs/build/html’ directory exists and removes it if it does. Finally, it displays an information message to the user, and then closes the application after a delay of 3 seconds.

If the selected branch cannot be checked out, or if no valid GitHub token exists, it shows an error message to the user, and resets the combo box to the currently active branch.

Returns:

None

onclick_commit_now()[source]

Commit changes to the Git repository.

This method commits changes to the Git repository and displays a success or error message depending on the result.

Parameters:

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

Returns:

None.

Raises:

None.

onclick_change_theme_apps()[source]

Change the theme between light and dark modes.

Returns:

None

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.

Parameters:

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

Returns:

None

set_style_selected_menu()[source]

Returns 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(getStyle)[source]

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

Parameters:

getStyle (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

resetStyle(widget)[source]

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

Parameters:

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]

Returns the light theme stylesheet for the selected menu.

Returns:

The stylesheet for the selected menu in the light theme.

Return type:

str

Anypoint Controller

class controllers.control_anypoint.AnypointConfig(main_ui)[source]

Bases: object

Loads an Anypoint configuration file.

Parameters:

main_ui – An instance of the main user interface.

ui

An instance of the main user interface.

Raises:

FileNotFoundError – If the Anypoint configuration file cannot be found.

showing_config_mode_1()[source]

Reads 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]

Reads 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]

Updates 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]

Updates 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

Config Controller

class controllers.control_config_file.ConfigFileApps(main_ui)[source]

Bases: object

Initializes a new instance of the class.

Parameters:

main_ui – The main user interface instance.

ui

The main user interface instance.

__cached_file

The path to the configuration file.

Returns:

None

Panorama Controller

class controllers.control_panorama.PanoramaConfig(main_ui)[source]

Bases: object

Initializes a new instance of the PanoramaConfig class.

Parameters:

main_ui (object) – Main UI object.

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.spinBox_pano_tube_alpha_min - self.ui.spinBox_pano_tube_alpha_max - self.ui.doubleSpinBox_pano_tube_crop_top - self.ui.doubleSpinBox_pano_tube_crop_buttom

This method is intended to be used to avoid emitting signals when changing the values of the panoptic tube spin boxes and double spin boxes programmatically.

Parameters:

self – An instance of the class containing this method.

Returns:

None

unblock_signal_pano_tube()[source]

Unblocks 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.

Args:

None.

Returns:

None.

Raises:

None.

block_signal_pano_car()[source]

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

Parameters:

None

Returns:

None

unblock_signal_pano_car()[source]

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

This function unblocks signals for the following widgets: spinBox_pano_car_alpha, spinBox_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.

Parameters:

None.

Returns:

None.

Raises:

None.

showing_config_panorama_tube()[source]

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

Opens 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]

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

Reads 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.

Reads 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.

Parameters:

self – An instance of the class.

Returns:

None.

change_properties_panorama_car()[source]

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

Parameters:

None

Returns:

None

Raises:

None

Note

Updates the alpha and beta properties of the car panorama from the GUI spinboxes. Updates 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.

Plugin Collection Controller

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

Bases: object

Initialize the plugin loader with the given plugin package.

Parameters:

plugin_package (str) – The name of the plugin package.

plugins

A dictionary of loaded plugins.

Type:

dict

name_application

The name of the application.

Type:

str

seen_paths

A set of paths already seen by the loader.

Type:

set

path_folder

The path to the plugin folder.

Type:

str

plugin_package

The name of the plugin package.

Type:

str

Returns:

None

reload_plugins()[source]

Reloads 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.

Parameters:

None.

Returns:

None.

get_widget(index, model)[source]

Returns 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]
get_icon_(index)[source]

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

Parameters:

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.

Parameters:

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

Returns:

None

get_description(index)[source]

Returns the description of the plugin located at the specified index.

Parameters:

index (int) – The index of the plugin whose description is to be retrieved.

Returns:

The description of the plugin.

Return type:

str

Raises:

IndexError – If the specified index is out of range.

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.

Parameters:

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

Returns:

None.

Raises:

None.

Plugin Manager Controller

class controllers.control_plugin_manager.PluginManager(main_control)[source]

Bases: object

Initializes the PluginManager object.

Parameters:

main_control – A reference to the main control object.

main_control

A reference to the main control object.

plugin

A PluginCollection object that manages the plugins.

apps_activated

A list of booleans indicating whether each plugin is activated.

index

An integer representing the index of the currently selected plugin.

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. Specifically, the following connections are established:

  • When the “Add Plugins” button is clicked, the install_new_plugin method is called.

  • When the “Delete Plugins” button is clicked, the action_delete_apps method is called.

  • When the “Close” button is clicked, the main_control.back_to_home method is called.

  • When the “Help” button is clicked, the help_menu_plugin method is called.

Note: You should replace the description of the actions to match their actual functionality.

init_cached_file()[source]
init_available_plugin()[source]

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

Clears 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]

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

Parameters:

None

Returns:

None

Raises:

None

add_plugin_by_github(name)[source]
refresh_the_plugin_available()[source]
refresh_theme_widget()[source]

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

Parameters:

None

Returns:

None

open_pinned_plugin(index)[source]
open_plugin_apps()[source]

Opens 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]
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.

action_delete_apps()[source]

Deletes the currently activated plugin application.

Parameters:

None

Returns:

None

Raises:

None

delete_apps(index)[source]

Delete a plugin application from the system.

Parameters:

index (int) – The index of the application to be deleted in the list of available plugins.

Returns:

None

Raises:

None

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.

help_menu_plugin()[source]

Displays 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

classmethod pop_up_message_box(message='')[source]

Displays a message box with the given message.

Parameters:

message – The message to display in the message box.

Returns:

None

Raises:

None

Result Image Controller

Class to control manipulate image

class controllers.control_result_image.ControlResultImage[source]

Bases: object

static zoom_in(current_size)[source]

Increases the current size by 100 and returns the new size.

Parameters:

current_size (int) – The current size.

Returns:

The new size after increasing by 100.

Return type:

int

static zoom_out(current_size)[source]

Decreases the current_size by 100, unless it’s already below 640.

Parameters:

current_size (int) – The current size to decrease by 100.

Returns:

The new size after decreasing by 100, or the original current_size if it’s already below 640.

Return type:

int

static rotate_left(current_angle)[source]

Rotates the image to the left by 5 degrees.

Parameters:

current_angle (int) – The current angle of rotation in degrees.

Returns:

The new angle of rotation after rotating left by 5 degrees.

Return type:

int

static rotate_right(current_angle)[source]

Rotates the given angle to the right by 5 degrees.

Parameters:

current_angle (int) – The current angle in degrees to be rotated.

Returns:

The new angle after rotation to the right.

Return type:

int

Main Ui Apps Controller

class controllers.control_main_ui_apps.ControlApps(main_ui)[source]

Bases: object

button_menu(maxWidth, enable)[source]

Animates the left-side menu of the application.

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

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

Returns:

None.

button_about_us(enable, theme)[source]

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

Parameters:
  • enable (bool) – True to enable the animation and expand the frame, False to disable.

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

Returns:

None

setting_menu(enable, theme)[source]

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

Parameters:
  • enable – A boolean indicating whether the additional left frame should be shown or not.

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

Returns:

None.

start_box_animation(left_box_width, right_box_width, direction)[source]

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

Parameters:
  • left_box_width (int) – The current width of the left box.

  • right_box_width (int) – The current width of the right box.

  • direction (str) – The direction in which to animate the boxes, either “left” or “right”.

Returns:

None

Setup Icon Controller

class controllers.control_setup_icon.SetIconsUI(main_ui)[source]

Bases: object

Initialize the MoilApp object with the given main_ui object.

Parameters:

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

Returns:

None.

get_theme_main_apps(theme)[source]

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

Parameters:

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

dark_mode_there()[source]

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

This function sets the icons of the UI buttons to the dark mode icons and the logo to the dark mode logo. It is called when the user switches the UI to the dark mode.

light_mode_theme()[source]

Changes the application’s icons to a light theme.

Parameters:

None

Returns:

None

Models Package

Main Models

class models.model_main.Model(*args: Any, **kwargs: Any)[source]

Bases: MoilUtils

The backend that contains all the data logic. The model’s job is to simply manage the data. Whether the data is from a database, API, or a JSON object, the model is responsible for managing it.

theme_light_mode()[source]

Sets the user interface theme to light mode.

Changes the theme attribute of the object to “light”, and returns the value of the STYLE_LIGHT_MODE constant.

Returns:

The value of the STYLE_LIGHT_MODE constant.

Return type:

int

theme_dark_mode()[source]

Sets the user interface theme to dark mode.

Changes the theme attribute of the object to “dark”, and returns the value of the STYLE_DARK_MODE constant.

Returns:

The value of the STYLE_DARK_MODE constant.

Return type:

int

style_pushbutton()[source]

Generates a Qt stylesheet for QPushButton widgets based on the current theme.

Returns a string representing the stylesheet to use for QPushButton widgets in the current theme. The style is different for “light” and “dark” themes. The returned string can be set as the style sheet of a QPushButton widget to apply the theme.

Returns:

A string representing the Qt stylesheet to use for QPushButton widgets in the current theme.

Return type:

str

style_pushbutton_play_pause_video()[source]

Generates a Qt stylesheet for QPushButton widgets based on the current theme.

Returns a string representing the stylesheet to use for QPushButton widgets in the current theme. The style is different for “light” and “dark” themes. The returned string can be set as the style sheet of a QPushButton widget to apply the theme.

Returns:

A string representing the Qt stylesheet to use for QPushButton widgets in the current theme.

Return type:

str

style_label()[source]

Generates a Qt stylesheet for QLabel widgets based on the current theme.

Returns a string representing the stylesheet to use for QLabel widgets in the current theme. The style is different for “light” and “dark” themes. The returned string can be set as the style sheet of a QLabel widget to apply the theme.

Returns:

A string representing the Qt stylesheet to use for QLabel widgets in the current theme.

Return type:

str

style_transparent_label()[source]

Generates a Qt stylesheet for QLabel widgets based on the current theme.

Returns a string representing the stylesheet to use for QLabel widgets in the current theme. The style is different for “light” and “dark” themes. The returned string can be set as the style sheet of a QLabel widget to apply the theme.

Returns:

A string representing the Qt stylesheet to use for QLabel widgets in the current theme.

Return type:

str

style_frame_main()[source]

Generates a Qt stylesheet for QLabel widgets based on the current theme.

Returns a string representing the stylesheet to use for QLabel widgets in the current theme. The style is different for “light” and “dark” themes. The returned string can be set as the style sheet of a QLabel widget to apply the theme.

Returns:

A string representing the Qt stylesheet to use for QLabel widgets in the current theme.

Return type:

str

style_font_12()[source]
style_font_14()[source]
style_frame_object()[source]

Generates a Qt stylesheet for QLabel widgets based on the current theme.

Returns a string representing the stylesheet to use for QLabel widgets in the current theme. The style is different for “light” and “dark” themes. The returned string can be set as the style sheet of a QLabel widget to apply the theme.

Returns:

A string representing the Qt stylesheet to use for QLabel widgets in the current theme.

Return type:

str

frame_transparent()[source]
style_line()[source]
style_combobox()[source]

Returns the Qt stylesheet for a QComboBox widget, based on the current theme.

Parameters:

self – The object that this method belongs to.

Returns:

A string containing the Qt stylesheet for the QComboBox widget, based on the current theme.

style_scroll_area()[source]
style_radio_button()[source]
style_slider()[source]
style_checkbox()[source]
style_spinbox()[source]
style_double_spin_box()[source]
style_line_edit()[source]

Apps Models

This Class is to provide model for moilapp application. to make it not make confuse on the plugin class

class models.model_apps.ModelApps(model)[source]

Bases: QObject

Initializes an instance of the class.

Parameters:

model – An instance of the Model class.

__model

An instance of the Model class.

Type:

Model

__image

The current image being displayed.

Type:

None

__moildev

An instance of the Moildev class.

Type:

None

__media_source

The path to the media source file.

Type:

None

__parameter_name

The name of the parameter used.

Type:

None

__angle_rotate

The angle to rotate the image by.

Type:

None

__map_x_anypoint

The x-coordinate of the point to display.

Type:

None

__map_y_anypoint

The y-coordinate of the point to display.

Type:

None

__map_x_pano

The x-coordinate of the panorama.

Type:

None

__map_y_pano

The y-coordinate of the panorama.

Type:

None

__configuration_view

The configuration view settings.

Type:

None

__config_file

The path to the configuration file.

Type:

None

__ratio_x

The ratio of the x-coordinate of the mouse click.

Type:

None

__ratio_y

The ratio of the y-coordinate of the mouse click.

Type:

None

__pos_x

The x-coordinate of the mouse click.

Type:

None

__pos_y

The y-coordinate of the mouse click.

Type:

None

__image_original

The original image.

Type:

None

repo_github

The URL of the GitHub repository.

Type:

None

__width_image_result

The width of the resulting image.

Type:

None

__draw_polygon

Indicates whether to draw the polygon.

Type:

True

__state_rubberband

Indicates whether the rubberband is active.

Type:

False

__state_view

The current view state.

Type:

“FisheyeView”

__pano_mode

The current panorama mode.

Type:

“car”

__anypoint_mode

The current anypoint mode.

Type:

“mode_1”

__size_rubberband

The size of the rubberband.

Type:

None

__pos_video_image_saved

The position of the video in the saved image.

Type:

[]

load_saved_image

Indicates whether to load a saved image.

Type:

False

saved_image_list

A list of saved images.

Type:

[]

cap

An instance of the OpenCV VideoCapture class.

Type:

None

video

Indicates whether the video is active.

Type:

False

fps

The frames per second of the video.

Type:

25

i_camera

The index of the camera.

Type:

0

timer

A timer for the next frame signal.

Type:

QTimer

signal_image_original

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

image_result

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

git_repository_info

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

config_view_info

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

alpha_beta

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

slider_time_value

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

timer_video_info

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

timer_status

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

recent_media_source

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

recenter_image

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

value_coordinate

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

save_image_file(image, dst_directory, type_camera=None)[source]

Save an image file to the specified directory and add metadata to the configuration view.

Parameters:
  • image – A NumPy array containing the image data to be saved.

  • dst_directory – A string representing the destination directory to save the image file.

  • type_camera – An optional string representing the type of camera used to capture the image.

Returns:

A string representing the timestamp in the format “mmdd_HHMMSS” used in the saved image file name.

Raises:

None

add_position_video_on_saved_image()[source]

Adds the current position of the video to the list of positions.

If there is an active video, this method appends the current position of the video to the list of positions stored in the __pos_video_image_saved attribute. This list can be used later to create a map of where images were saved in the video.

reopen_saved_image(file_name)[source]

Reopen saved image file

Parameters:

file_name

Returns:

set_position_frame_save_image(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:
  • 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.

Returns:

None

update_file_config()[source]

This function updates the configuration file located in the cached directory. It sets the __config_file attribute to the path of the configuration file and loads the configuration data into the __configuration_view attribute. The function also updates the parameter_name attribute with the value of “Parameter_name” in the configuration data and sets the saved_image_list attribute with a list of keys from the “Image_saved” dictionary in the configuration data.

Returns:

None

set_media_source(cam_type, media_source, parameter_name)[source]

Set up the media source for processing in this application.

Parameters:
  • cam_type – type of camera used

  • media_source – the media source such as image, video or camera

  • parameter_name – the parameter name

Returns:

None

property recenter_image_state
property image

Original fisheye image of the application

Returns:

Image

property change_panorama_mode

Get the current panorama mode.

Returns:

The current panorama mode as a string.

property change_anypoint_mode

Get the current anypoint mode.

Returns:

The current anypoint mode as a string.

property state_recent_view

Get the state of the recent view.

Returns:

True if the recent view is enabled, False otherwise.

property state_rubberband

Get the state of the rubberband.

Returns:

True if the rubberband is enabled, False otherwise.

property set_draw_polygon

Sets the state of the rubber band.

property set_angle_rotate

Sets whether to draw a polygon and creates the image result.

set_width_image_on_label_result(width)[source]

Sets the angle of rotation.

label_original_mouse_double_click_anypoint_mode_1()[source]

Handle double-click events on the original label image in Anypoint Mode 1.

This function sets the Anypoint Mode 1 configuration values to their defaults and emits the alpha_beta signal with values [0, 0]. It then saves the new configuration to the configuration file and calls create_maps_anypoint_mode_1() to update the view.

Parameters:

self – The object itself, implicitly passed.

Returns:

None

label_original_mouse_double_click_anypoint_mode_2()[source]

Resets the configuration view for Anypoint Mode 2 and emits alpha and beta values of [0, 0].

Resets the pitch, roll, yaw, and zoom values to their default values, sets the coordinates of the view to the current image center, and saves the updated configuration to a file. Additionally, emits alpha and beta values of [0, 0] to signal that the view has been reset.

label_recenter_mouse_move_event(label, event)[source]
label_original_mouse_move_event(label, event)[source]

Update the display and configuration in response to mouse movement.

Parameters:
  • label – A PyQt5.QtWidgets.QLabel object representing the label being displayed.

  • event – A PyQt5.QtGui.QMouseEvent object representing the mouse event.

Returns:

None

Raises:

None

label_recenter_mouse_leave_event()[source]
label_original_mouse_leave_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 performs different actions depending on the current view state: - If the state is “AnypointView”, it draws a crosshair on the original image

and emits an alpha_beta signal with the calculated alpha and beta values based on the mode and configuration.

  • If the state is “PanoramaView”, it draws a crosshair on the original image and emits an alpha_beta signal with the calculated alpha and beta values based on the mode and configuration.

  • Otherwise, it simply draws a crosshair on the current image.

Returns:

None

reset_coordinate_recenter_to_default()[source]
label_original_mouse_press_event_anypoint_mode_1(event)[source]

Updates the configuration view for the first mode when a mouse press event occurs.

Parameters:

event (QMouseEvent) – The mouse press event.

Returns:

None.

Raises:

None.

label_original_recenter_mode(event)[source]
label_original_mouse_press_event_anypoint_mode_2(event)[source]

Update configuration for Mode 2 when clicking on original image.

Parameters:

event – A QMouseEvent object representing the mouse press event.

Returns:

None.

Raises:

None.

label_original_mouse_press_event_panorama_car(event)[source]

Updates the configuration of the car panorama mode with the mouse press event.

Parameters:

event (QMouseEvent) – The mouse press event.

Returns:

None.

label_result_mouse_press_event()[source]

Mouse press event handler for the label displaying the image result.

Does nothing if self.image is None.

mouse_press_event_handler_recenter(event)[source]
create_recenter_image()[source]
property size_rubberband

Returns the current size of the rubber band selection area.

Returns:

The size of the rubber band selection area.

crop_image(image_ori)[source]

Crop the image according to the selected rubberband area.

Parameters:

image_ori (np.ndarray) – Original image.

Returns:

None

classmethod draw_rectangle(image, point_1, point_2, thickness=5)[source]

Draw rectangle on the image.

Parameters:
  • () (thickness) – input image

  • () – the first point

  • () – the second point to create rectangle

  • () – the thickness of rectangle line

Returns:

image with rectangle object

classmethod convert_cv2_to_q_image(image)[source]

Convert an image from OpenCV format to Qt format. The function takes an image in OpenCV format and returns the equivalent image in Qt format. The image can be grayscale, RGB or RGBA. The conversion is done by creating a QImage object and setting the image data and format accordingly.

Parameters:

image (ndarray) – The image in OpenCV format (height x width x channels)

Returns:

The image in Qt format

Return type:

QImage

classmethod convert_q_image_to_mat(q_image)[source]

Converts a QImage to a NumPy array.

Parameters:

q_image – A QImage instance to be converted.

Returns:

A NumPy array with the image data.

Raises:

TypeError – If q_image is not a QImage instance.

set_alpha_beta(alpha, beta)[source]

Set the values of alpha and beta and update the configuration file.

Parameters:
  • alpha (float) – the alpha value to set.

  • beta (float) – the beta value to set.

Returns:

None.

create_image_original()[source]

This function creates the original image based on the configuration view. The function will check the type of media source specified in the configuration view, and proceed accordingly. The function can handle different types of media sources including a camera stream, a video file, or an image file. The function sets the video and image variables based on the media source. If the media source is a camera stream, the function will start a timer to capture frames. If the media source is a video file, the function will capture frames for the duration of the video. If the media source is an image file, the function will read the image into memory.

Returns:

None

create_image_result()[source]

Create the result image based on the current view and configuration settings.

If the load_saved_image flag is True, the function crops the original image based on the state of the state_rubberband flag. If it is False, the function checks the state of the state_recent_view flag and performs the following actions: - If the state is “AnypointView”, it rotates the image by the __angle_rotate angle, and remaps the image

based on the __map_x_anypoint and __map_y_anypoint maps. If set_draw_polygon is True, it draws a polygon on the original image using the same maps. It then sets image_result to the resulting image and sets __image_original to the original image with the crosshair drawn on it.

  • If the state is “PanoramaView”, it rotates the image by the __angle_rotate angle, and remaps the image based on the __map_x_pano and __map_y_pano maps. If change_panorama_mode is “car”, it crops the resulting image using the __crop_panorama_car method. Otherwise, it crops it using the __crop_panorama_tube method. If set_draw_polygon is True, it draws a polygon on the original image using the same maps. It then sets image_result to the resulting image and sets __image_original to the original image with the crosshair drawn on it.

  • If the state is not “AnypointView” or “PanoramaView”, it rotates the image by the __angle_rotate angle and sets image_result to the resulting image. It then sets __image_original to the original image with the crosshair drawn on it.

After creating the result image, the function emits a signal with the resulting image, and sets the image_height and image_width properties of the class.

If the state_rubberband flag is True, the function calls the crop_image method on the resulting image, which will emit a signal with the cropped image.

If the load_saved_image flag is False and the state_rubberband flag is False, the function emits a signal with the resulting image.

create_maps_fov(alpha=90)[source]
draw_fov_original_image(image)[source]
static draw_polygon_fov(image, mapX, mapY)[source]

Return image with a drawn polygon on it from mapX and mapY generated by maps anypoint or panorama.

Parameters:
  • image – Original image

  • mapX – map image X from anypoint process

  • mapY – map image Y from anypoint process

Returns:

map x, map y

Return type:

image

  • Example:

image = draw_polygon(image,mapX,mapY)
re_run_after_load_saved_image()[source]

Performs necessary actions after loading a saved image, including updating the configuration file, resetting certain attributes, and creating the original and result images.

Returns:

None.

draw_crosshair_on_center_image(image)[source]

Draws a crosshair in the center of the currently stored image.

Returns:

None.

draw_crosshair_on_the_recenter_image(image)[source]
draw_crosshair_on_the_original_image(image)[source]

Draws a crosshair on the specified image at a location determined by the current state of the object.

Parameters:

image – The image on which to draw the crosshair.

Returns:

None.

property parameter_name

Gets the value of the __parameter_name attribute.

Returns:

The value of the __parameter_name attribute.

create_moildev()[source]

Creates a connection to Moildev based on the configuration view.

If the __configuration_view attribute is not None, the function checks if the Parameter_name value is not None. If this is the case, the function sets the parameter_name attribute to the value of self.__configuration_view[“Parameter_name”], and creates a connection to Moildev using the self.__model.connect_to_moildev() method and the parameter_name attribute. The function also sets the pos_x and pos_y attributes to the values of self.__moildev.icx and self.__moildev.icy, respectively.

Returns:

None.

recenter_image_process()[source]
change_coordinate_by_spinbox(icx, icy)[source]
create_maps_anypoint_mode_1()[source]

Creates maps for anypoint mode 1 based on the configuration file.

If the configuration file exists, the function loads the alpha, beta, and zoom values for mode 1 from the configuration file. It then uses the loaded values to create the maps for anypoint mode 1 using the moildev.maps_anypoint_mode1() method. If the moildev attribute is not None, the function also creates an image result using the create_image_result() method.

Returns:

None.

create_maps_anypoint_mode_2()[source]

Creates maps for anypoint mode 2 based on the configuration file.

If the configuration file exists, the function loads the pitch, yaw, roll, and zoom values for mode 2 from the configuration file. It then uses the loaded values to create the maps for anypoint mode 2 using the moildev.maps_anypoint_mode2() method. If the moildev attribute is not None, the function also creates an image result using the create_image_result() method.

Returns:

None.

reset_panorama_car()[source]
create_maps_panorama_car()[source]

Create the map images for the panorama car feature.

This method creates the map images for the panorama car feature using the MOIL SDK. If the configuration file exists, it retrieves the alpha and beta values for the car from the configuration file using the private method __load_config(). If the MOIL device object is not None, this method creates the map images for the panorama car feature using the alpha and beta values and sets the image result.

Parameters:

self – The Panorama object.

Returns:

None.

create_maps_panorama_tube()[source]

Create the map images for the panorama tube feature.

This method creates the map images for the panorama tube feature using the MOIL SDK. If the configuration file exists, it retrieves the minimum and maximum alpha values for the tube from the configuration file using the private method __load_config(). If the MOIL device object is not None, this method creates the map images for the panorama tube feature using the alpha values and sets the image result.

Parameters:

self – The Panorama object.

Returns:

None.

next_frame_signal()[source]

Read the next frame from the video or camera and update the display.

If the video capture object is not None and the video is currently playing, this method will:

  1. Read the next frame from the video.

  2. Update the position of the video player slider.

  3. Calculate the duration of the video in minutes and seconds.

  4. Calculate the current position of the video player in minutes and seconds.

  5. Emit a signal with the total duration of the video and the current position of the video player.

If the video capture object is None or the video is not playing, this method will:

  1. Read the next frame from the camera.

  2. Update the display.

  3. Emit a signal with zeros for the duration and current position of the video player.

Parameters:

self – The VideoPlayer object.

Returns:

None

play_pause_video()[source]

Toggle between playing and pausing the video.

If the video player timer is currently active, this method will pause the video. If the timer is not active, the method will resume playing the video. Additionally, if the video player was previously displaying a saved image, the method will reset the player to resume playing the video.

Parameters:

self – The VideoPlayer object.

Returns:

None

stop_video()[source]

Stop playing the video.

If the video capture object is not None and the video is currently playing, this method will:

  1. Reset the video to the first frame.

  2. Stop the video player timer.

  3. Emit a signal to display the next frame.

  4. Emit a signal to update the timer status.

Parameters:

self – The VideoPlayer object.

Returns:

None

rewind_video_5_second()[source]

Rewinds a video by 5 seconds from the current position.

If a video is loaded, this function calculates the position of the video 5 seconds before the current position, and updates the video to that position. If the calculated position is before the beginning of the video, the function sets the video to the first frame. If no video is loaded, the function does nothing.

Parameters:

self – The instance of the class that this method belongs to.

Returns:

None.

forward_video_5_second()[source]

Updates the position of a video based on the value of a slider widget.

If a video is loaded, this function calculates the frame number corresponding to the value of a slider widget as a percentage of the total duration, and updates the video to that frame. If no video is loaded, the function does nothing.

Parameters:
  • self – The instance of the class that this method belongs to.

  • value – The current value of the slider widget as an integer between 0 and 100.

Returns:

None.

slider_controller(value)[source]
set_slider_video_time_position()[source]

Sets 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.

Parameters:

self – The instance of the class that this method belongs to.

Returns:

None.

clear_saved_image()[source]

Clear the saved image data from the configuration view and save the updated configuration to a file.

This method removes all saved image data from the configuration view and updates the configuration file with the modified view.

Parameters:

self – The object instance.

Returns:

None.

Raises:

IOError – An error occurred while writing the updated configuration to the file.

reset_config()[source]

Resets the configuration view to its default values.

This function sets all the fields of the configuration view to their default values, and saves the new configuration to the config file.

Parameters:

None

Returns:

None

Raises:

None

github_information()[source]

Fetches information about the GitHub repository.

Returns:

A tuple containing the git.Repo object for the repository and a dictionary with the following keys:
  • ’origin_url’: The URL of the repository’s origin.

  • ’user_name’: The username of the repository’s owner.

  • ’active_branch’: The name of the currently active branch.

  • ’list_branch’: A list of the repository’s branch names.

  • ’token’: The personal access token (PAT) used to authenticate with the repository, or None if no PAT is specified.

Return type:

Tuple

Raises:

None.

refresh_github_information()[source]

Refreshes the GitHub repository information and emits the updated configuration.

Reads the cached GitHub configuration from the file system and updates it with the latest information from the remote repository. The list of branches is obtained from the repository, and the list_branch property in the cached configuration is updated. If a token is present in the configuration, the remote repository is fetched using the token. Finally, the updated configuration is emitted using the git_repository_info signal.

Returns:

None

change_config_github(token=None, branch=None)[source]

Change the configuration for the GitHub repository.

Parameters:
  • token (str, optional) – The access token to use when connecting to the GitHub repository. If provided, the function will update the configuration file with the new token. Defaults to None.

  • branch (str, optional) – The name of the active branch to use. If provided, the function will update the configuration file with the new branch name. Defaults to None.

Returns:

None

Raises:

None

The function loads the current configuration for the GitHub repository from a YAML file, updates it with the provided token and/or branch name, and writes it back to the file. If a token is provided and the current repository URL does not include the token, the function updates the repository URL with the new token. Finally, the function emits a signal with the updated configuration.

Views Package

Main Views

class views.main_moilapp.Ui_MainWindow[source]

Bases: object

setupUi(MainWindow)[source]
retranslateUi(MainWindow)[source]

Ui_splash_screen View

class views.ui_splash_screen.Ui_SplashScreen[source]

Bases: object

setupUi(SplashScreen)[source]
retranslateUi(SplashScreen)[source]

moilutils Package

Moilutils Models

Moildev Models