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.