1+ if __name__ == "__main__" :
2+ import ModuleUpdate
3+
4+ ModuleUpdate .update ()
5+
6+
17from kvui import (ThemedApp , ScrollBox , MainLayout , ContainerLayout , dp , Widget , MDBoxLayout , TooltipLabel , MDLabel ,
28 ToggleButton , MarkupDropdown , ResizableTextField )
39from kivy .uix .behaviors .button import ButtonBehavior
@@ -330,6 +336,11 @@ def open_dropdown(button):
330336 box .range .slider .dropdown .open ()
331337
332338 box = VisualNamedRange (option = option , name = name , range_widget = self .create_range (option , name ))
339+ if option .default in option .special_range_names :
340+ # value can get mismatched in this case
341+ box .range .slider .value = min (max (option .special_range_names [option .default ], option .range_start ),
342+ option .range_end )
343+ box .range .tag .text = str (int (box .range .slider .value ))
333344 box .range .slider .bind (on_touch_move = lambda _ , _2 : set_to_custom (box ))
334345 items = [
335346 {
@@ -365,7 +376,7 @@ def open_dropdown(button):
365376 # for some reason this fixes an issue causing some to not open
366377 dropdown .open ()
367378
368- default_random = option .default == "random"
379+ default_string = isinstance ( option .default , str )
369380 main_button = VisualChoice (option = option , name = name )
370381 main_button .bind (on_release = open_dropdown )
371382
@@ -377,7 +388,7 @@ def open_dropdown(button):
377388 for choice in option .name_lookup
378389 ]
379390 dropdown = MDDropdownMenu (caller = main_button , items = items )
380- self .options [name ] = option .name_lookup [option .default ] if not default_random else option .default
391+ self .options [name ] = option .name_lookup [option .default ] if not default_string else option .default
381392 return main_button
382393
383394 def create_text_choice (self , option : typing .Type [TextChoice ], name : str ):
@@ -560,8 +571,11 @@ def create_options_panel(self, world_button: WorldButton):
560571 groups [group ].append ((name , option ))
561572
562573 for group , options in groups .items ():
574+ options = [(name , option ) for name , option in options
575+ if name and option .visibility & Visibility .simple_ui ]
563576 if not options :
564577 continue # Game Options can be empty if every other option is in another group
578+ # Can also have an option group of options that should not render on simple ui
565579 group_item = MDExpansionPanel (size_hint_y = None )
566580 group_header = MDExpansionPanelHeader (MDListItem (MDListItemSupportingText (text = group ),
567581 TrailingPressedIconButton (icon = "chevron-right" ,
@@ -583,8 +597,7 @@ def create_options_panel(self, world_button: WorldButton):
583597 group_box .layout .orientation = "vertical"
584598 group_box .layout .spacing = dp (3 )
585599 for name , option in options :
586- if name and option is not Removed and option .visibility & Visibility .simple_ui :
587- group_content .add_widget (self .create_option (option , name , cls ))
600+ group_content .add_widget (self .create_option (option , name , cls ))
588601 expansion_box .layout .add_widget (group_item )
589602 self .option_layout .add_widget (expansion_box )
590603 self .game_label .text = f"Game: { self .current_game } "
0 commit comments