6363hw_lib_map = {"AUTO" : "Automatic" , "LHM" : "LibreHardwareMonitor (admin.)" , "PYTHON" : "Python libraries" ,
6464 "STUB" : "Fake random data" , "STATIC" : "Fake static data" }
6565reverse_map = {False : "classic" , True : "reverse" }
66+ revision_size = {'A' : '3.5"' , 'B' : '3.5"' , 'C' : '5"' , 'SIMU' : '3.5"' , 'SIMU5' : '5"' }
6667
6768
68- def get_themes (is5inch : bool = False ):
69+ def get_themes (revision : str ):
6970 themes = []
7071 directory = 'res/themes/'
7172 for filename in os .listdir ('res/themes' ):
@@ -78,9 +79,7 @@ def get_themes(is5inch: bool = False):
7879 # Get display size from theme.yaml
7980 with open (theme , "rt" , encoding = 'utf8' ) as stream :
8081 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 ]:
8483 themes .append (filename )
8584 return sorted (themes , key = str .casefold )
8685
@@ -307,8 +306,8 @@ def on_brightness_change(self, e=None):
307306
308307 def on_model_change (self , e = None ):
309308 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" :
312311 self .com_cb .configure (state = "disabled" , foreground = "#C0C0C0" )
313312 self .orient_cb .configure (state = "disabled" , foreground = "#C0C0C0" )
314313 self .brightness_slider .configure (state = "disabled" )
@@ -319,11 +318,7 @@ def on_model_change(self, e=None):
319318 self .brightness_slider .configure (state = "normal" )
320319 self .brightness_val_label .configure (foreground = "#000" )
321320
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 )
327322 self .theme_cb .config (values = themes )
328323
329324 if not self .theme_cb .get () in themes :
0 commit comments