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
- show_general_information()[source]
Show general information on the user interface
- Parameters:
None
- Returns:
None
- 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_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_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_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.
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.
Locks the state of the view menu by disabling all view mode buttons and resetting their style to default.
- Parameters:
None
- Returns:
None
Unlocks the state of the menu for viewing modes, enabling the FishEye, AnyPoint, and Panorama buttons.
- Parameters:
None
- Returns:
None
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
- set_value_coordinate(coordinate)
- 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
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.
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 –
- 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.
- escape_event()[source]
Escape button keyboard event. Will return to the default state of application.
Returns:
- mouse_event_in_moil_logo(event)[source]
Handle mouse events in the MOIL logo.
- Parameters:
event – The mouse event to handle.
- Returns:
None
- 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. –
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
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
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
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
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
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.
- 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.
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_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 –
- refresh_theme_widget()[source]
Refreshes the theme of the currently selected plugin widget, if any.
- Parameters:
None
- Returns:
None
- 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.
- 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.
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
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
Main Ui Apps Controller
- class controllers.control_main_ui_apps.ControlApps(main_ui)[source]
Bases:
object
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
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”.