Skip to content

Commit

Permalink
Further kivy improvements: disable screen buttons on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
DocGarbanzo committed Nov 3, 2023
1 parent 294bc28 commit 5a42dcf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion donkeycar/management/ui/tub_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def select(underlying):
else:
msg = f'No records in tub {self.file_path}'
tub_screen.status(msg)
get_app_screen('start').ids.status.text = 'Donkey ready'
return True


Expand Down
12 changes: 11 additions & 1 deletion donkeycar/management/ui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def disable_only(self, bar_name):
for button_name, button in self.ids.items():
button.disabled = button_name == this_button_name

def enable_disable_all(self, enable=True):
for button_name, button in self.ids.items():
button.disabled = not enable


class StartScreen(Screen):
img_path = os.path.realpath(os.path.join(
Expand All @@ -44,13 +48,19 @@ class DonkeyScreenManager(ScreenManager):
class DonkeyApp(App):
title = 'Donkey Manager'

def after_init(self, obj):
self.root.ids.tub_screen.ids.tub_loader.update_tub()
self.root.ids.start_screen.ids.tab_bar.enable_disable_all(True)
self.root.ids.start_screen.ids.status.text = 'Donkey ready'

def initialise(self, event):
self.root.ids.start_screen.ids.tab_bar.enable_disable_all(False)
self.root.ids.tub_screen.ids.config_manager.load_action()
self.root.ids.pilot_screen.initialise(event)
self.root.ids.car_screen.initialise()
# This builds the graph which can only happen after everything else
# has run, therefore delay until the next round.
Clock.schedule_once(self.root.ids.tub_screen.ids.tub_loader.update_tub)
Clock.schedule_once(self.after_init)

def build(self):
dm = DonkeyScreenManager()
Expand Down

0 comments on commit 5a42dcf

Please sign in to comment.