YouTubeDownloader v1.1.2
YouTube content downloader
Loading...
Searching...
No Matches
MonitorScale Class Reference

Class to scale text and item positions. More...

Public Member Functions

 __init__ (self, "MainWindow" ui)
 
None check_for_style_change (self, Optional[ETheme] e_style=None)
 Check for style change.
 
bool is_light_theme (self)
 get status for active light theme (or classic -> not dark).
 
None set_dialog_style (self)
 Set dialog theme style.
 
None update_darkmode_status (self, ETheme e_style)
 Update dark mode status.
 

Public Attributes

 e_actual_theme = ETheme.LIGHT
 
 e_style = ETheme.SYSTEM
 
 ui = ui
 

Detailed Description

Class to scale text and item positions.

Parameters
ui: main window object

Definition at line 22 of file monitor.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
"MainWindow" ui )

Definition at line 28 of file monitor.py.

28 def __init__(self, ui: "MainWindow"):
29 self.ui = ui
30 self.e_style = ETheme.SYSTEM # set theme here
31 self.e_actual_theme = ETheme.LIGHT
32 self.check_for_style_change(self.e_style)
33

Member Function Documentation

◆ check_for_style_change()

None check_for_style_change ( self,
Optional[ETheme] e_style = None )

Check for style change.

Parameters
e_style: style to set

Definition at line 34 of file monitor.py.

34 def check_for_style_change(self, e_style: Optional[ETheme] = None) -> None:
35 """!
36 @brief Check for style change
37 @param e_style : style to set
38 """
39 if e_style is None:
40 e_style = self.e_style
41 old_style = self.e_actual_theme
42 match e_style:
43 case ETheme.LIGHT:
44 self.e_actual_theme = ETheme.LIGHT
45 case ETheme.DARK:
46 self.e_actual_theme = ETheme.DARK
47 case ETheme.SYSTEM:
48 self.e_actual_theme = ETheme.LIGHT if darkdetect.isLight() else ETheme.DARK
49 case _:
50 log.warning("Invalid theme change: %s", e_style)
51 if old_style != self.e_actual_theme:
52 self.set_dialog_style()
53

◆ is_light_theme()

bool is_light_theme ( self)

get status for active light theme (or classic -> not dark).

Returns
status if theme is light

Definition at line 75 of file monitor.py.

75 def is_light_theme(self) -> bool:
76 """!
77 @brief get status for active light theme (or classic -> not dark).
78 @return status if theme is light
79 """
80 light_status = bool(self.e_actual_theme != ETheme.DARK)
81 return light_status

◆ set_dialog_style()

None set_dialog_style ( self)

Set dialog theme style.

Definition at line 63 of file monitor.py.

63 def set_dialog_style(self) -> None:
64 """!
65 @brief Set dialog theme style.
66 """
67 match self.e_actual_theme:
68 case ETheme.LIGHT:
69 customtkinter.set_appearance_mode("light")
70 case ETheme.DARK:
71 customtkinter.set_appearance_mode("dark")
72 case _:
73 log.warning("Invalid actual theme: %s", self.e_actual_theme)
74

◆ update_darkmode_status()

None update_darkmode_status ( self,
ETheme e_style )

Update dark mode status.

Parameters
e_style: select theme mode

Definition at line 54 of file monitor.py.

54 def update_darkmode_status(self, e_style: ETheme) -> None:
55 """!
56 @brief Update dark mode status.
57 @param e_style : select theme mode
58 """
59 self.e_style = e_style
60 self.check_for_style_change(self.e_style)
61 self.set_dialog_style()
62

Member Data Documentation

◆ e_actual_theme

e_actual_theme = ETheme.LIGHT

Definition at line 31 of file monitor.py.

◆ e_style

e_style = ETheme.SYSTEM

Definition at line 30 of file monitor.py.

◆ ui

ui = ui

Definition at line 29 of file monitor.py.


The documentation for this class was generated from the following file: