@@ -40,6 +40,35 @@ class TrackSystemTheme:
4040 _object : Optional ["TrackSystemTheme" ] = None
4141 _system : str = "System"
4242
43+ #
44+ # Private methods
45+ #
46+
47+ def __init__ (self , parent : Optional [QObject ], * , _caller = None ):
48+ """
49+ This method is not public
50+ """
51+ if _caller != self .create : # pylint: disable=comparison-with-callable
52+ raise RuntimeError ("Use .create(parent) or .get(); this is a singleton" )
53+ # Init
54+ self ._lock = Lock ()
55+ self ._parent = parent
56+ self ._underlying : str = darkdetect .theme ()
57+ self ._enabled : bool = False
58+ self ._listener : Optional [_QListener ] = None
59+ self ._thread : Optional [QThread ] = None
60+
61+ def _set_theme (self , theme : str , * , force : bool = False ):
62+ """
63+ Set the underlying theme according to the system theme if needed
64+ """
65+ if force or theme != self ._underlying :
66+ self ._underlying = theme
67+ Conf .theme_name = self ._underlying
68+ for prop , value in COLOR_SCHEMES [theme ].items ():
69+ setattr (Conf , prop , value )
70+ gui_thread_schedule_async (refresh_theme )
71+
4372 #
4473 # Public methods
4574 #
@@ -99,32 +128,3 @@ def refresh_theme(self):
99128 self ._set_theme (darkdetect .theme (), force = True )
100129 else :
101130 gui_thread_schedule_async (refresh_theme )
102-
103- #
104- # Private methods
105- #
106-
107- def __init__ (self , parent : Optional [QObject ], * , _caller = None ):
108- """
109- This method is not public
110- """
111- if _caller != self .create : # pylint: disable=comparison-with-callable
112- raise RuntimeError ("Use .create(parent) or .get(); this is a singleton" )
113- # Init
114- self ._lock = Lock ()
115- self ._parent = parent
116- self ._underlying : str = darkdetect .theme ()
117- self ._enabled : bool = False
118- self ._listener : Optional [_QListener ] = None
119- self ._thread : Optional [QThread ] = None
120-
121- def _set_theme (self , theme : str , * , force : bool = False ):
122- """
123- Set the underlying theme according to the system theme if needed
124- """
125- if force or theme != self ._underlying :
126- self ._underlying = theme
127- Conf .theme_name = self ._underlying
128- for prop , value in COLOR_SCHEMES [theme ].items ():
129- setattr (Conf , prop , value )
130- gui_thread_schedule_async (refresh_theme )
0 commit comments