63
63
hw_lib_map = {"AUTO" : "Automatic" , "LHM" : "LibreHardwareMonitor (admin.)" , "PYTHON" : "Python libraries" ,
64
64
"STUB" : "Fake random data" , "STATIC" : "Fake static data" }
65
65
reverse_map = {False : "classic" , True : "reverse" }
66
+ revision_size = {'A' : '3.5"' , 'B' : '3.5"' , 'C' : '5"' , 'SIMU' : '3.5"' , 'SIMU5' : '5"' }
66
67
67
68
68
- def get_themes (is5inch : bool = False ):
69
+ def get_themes (revision : str ):
69
70
themes = []
70
71
directory = 'res/themes/'
71
72
for filename in os .listdir ('res/themes' ):
@@ -78,9 +79,7 @@ def get_themes(is5inch: bool = False):
78
79
# Get display size from theme.yaml
79
80
with open (theme , "rt" , encoding = 'utf8' ) as stream :
80
81
theme_data , ind , bsi = ruamel .yaml .util .load_yaml_guess_indent (stream )
81
- if theme_data ['display' ].get ("DISPLAY_SIZE" , '3.5"' ) == '5"' and is5inch :
82
- themes .append (filename )
83
- elif theme_data ['display' ].get ("DISPLAY_SIZE" , '3.5"' ) == '3.5"' and not is5inch :
82
+ if theme_data ['display' ].get ("DISPLAY_SIZE" , '3.5"' ) == revision_size [revision ]:
84
83
themes .append (filename )
85
84
return sorted (themes , key = str .casefold )
86
85
@@ -307,8 +306,8 @@ def on_brightness_change(self, e=None):
307
306
308
307
def on_model_change (self , e = None ):
309
308
self .show_hide_brightness_warning ()
310
- model_code = [k for k , v in revision_map .items () if v == self .model_cb .get ()][0 ]
311
- if model_code == "SIMU" or model_code == "SIMU5" :
309
+ revision = [k for k , v in revision_map .items () if v == self .model_cb .get ()][0 ]
310
+ if revision == "SIMU" or revision == "SIMU5" :
312
311
self .com_cb .configure (state = "disabled" , foreground = "#C0C0C0" )
313
312
self .orient_cb .configure (state = "disabled" , foreground = "#C0C0C0" )
314
313
self .brightness_slider .configure (state = "disabled" )
@@ -319,11 +318,7 @@ def on_model_change(self, e=None):
319
318
self .brightness_slider .configure (state = "normal" )
320
319
self .brightness_val_label .configure (foreground = "#000" )
321
320
322
- if model_code == "C" or model_code == "SIMU5" :
323
- themes = get_themes (is5inch = True )
324
- else :
325
- themes = get_themes (is5inch = False )
326
-
321
+ themes = get_themes (revision )
327
322
self .theme_cb .config (values = themes )
328
323
329
324
if not self .theme_cb .get () in themes :
0 commit comments