"""
Module for handling screen recording functionality in the application.
This module contains the ScreenRecord class, which provides methods for recording the screen and managing the recording
state.
"""
from PyQt6 import QtGui
[docs]
class ScreenRecord:
"""
Class for handling screen recording functionality.
Attributes:
_controller: The main controller object.
_model: The model object.
_ui_object: The UI object.
Methods:
__init__(self, controller): Initializes the ScreenRecord object.
onclick_record_screen(self): Handles the click event of the record screen button.
"""
[docs]
def __init__(self, controller):
self._controller = controller
self._model = controller.model
self._ui_object = controller.ui_object
self._ui_object.btn_record_screen.clicked.connect(self.onclick_record_screen)
[docs]
def onclick_record_screen(self):
"""
Handle the click event of the record screen button.
If the button is checked, the screen recording is started and the button icon is changed to the "record" icon.
If the button is unchecked, the screen recording is stopped and the button icon is changed to the "stop" icon.
"""
if self._ui_object.btn_record_screen.isChecked():
message = "recording will start!"
self._controller.ctrl_message_box.display_message_box(message, "information")
if not self._model.update_scree_image.worker.timer.isActive():
if not self._model.update_scree_image.thread.isRunning():
self._model.update_scree_image.worker.timer.start()
self._model.update_scree_image.worker.initialize_record_screen()
self._model.update_scree_image.worker.record_state = True
self._model.update_scree_image.worker.timer.start()
self._ui_object.btn_record_screen.setIcon(QtGui.QIcon("icons:Record-screen_n.svg"))
else:
message = "recording stop!"
self._controller.ctrl_message_box.display_message_box(message, "information")
self._model.update_scree_image.worker.record_state = False
self._model.update_scree_image.worker.timer.stop()
self._ui_object.btn_record_screen.setIcon(QtGui.QIcon("icons:record-screen_black.svg"))