"""
This module contains the ControlStyleSheet class, which provides methods for changing style sheets
of various UI elements based on user interactions and theme settings.
"""
from PyQt6 import QtWidgets
[docs]
class ControlStyleSheet:
"""
Class for controlling the style sheets of UI elements.
Attributes:
_controller: The controller object.
_model: The model object.
_ui_object: The UI object.
Methods:
__init__(self, controller): Initializes the ControlStyleSheet object.
change_stylesheet_selected_menu(self): Change the stylesheet of a selected menu button.
set_style_selected_menu(self): Returns the CSS stylesheet for the currently selected menu item.
set_style_deselect_menu(self, get_style): Replaces the selected menu style with an unselected style.
reset_style(self, widget): Resets the stylesheet of all push buttons in the frame_button_view.
stylesheet_selected_menu_dark_theme(cls): Return the CSS stylesheet for a selected menu button in dark theme.
stylesheet_selected_menu_light_theme(cls): Returns the light theme stylesheet for the selected menu.
"""
[docs]
def __init__(self, controller):
super().__init__()
self._controller = controller
self._model = controller.model
self._ui_object = self._controller.ui_object
# selected menu button
# deselected menu button
# reset selection button
[docs]
def reset_style(self, widget):
"""
Reset the stylesheet of all push buttons in the frame_button_view except for the one with the given
object name.
Arg:
widget (str): The object name of the push button to exclude.
Return:
None
"""
if self._model.debug_mode:
self._model.activity_logger.info("ControlStyleSheet: reset_style(), "
"Reset active stylesheet menu")
for w in self._ui_object.frame_button_view.findChildren(QtWidgets.QPushButton):
if w.objectName() != widget:
w.setStyleSheet(self.set_style_deselect_menu(w.styleSheet()))