diff --git a/GuiApp/main.py b/GuiApp/main.py index ef7241d..32aed6b 100644 --- a/GuiApp/main.py +++ b/GuiApp/main.py @@ -1,3 +1,4 @@ +import argparse from kivy.app import App from kivy.core.window import Window from kivy.modules import inspector @@ -27,14 +28,12 @@ # pylint: enable=unused-import -# Size of Raspberry pi touchscreen -Window.size = (800, 480) - class snackAttackTrackApp(App): - def __init__(self): + def __init__(self, use_inspector=True): self.title = "Snack Attack Track" self.sm = None + self.use_inspector = use_inspector Window.bind(on_key_down=self._on_keyboard_down) super().__init__() @@ -65,7 +64,8 @@ def build(self): self.sm.add_widget(HistoryScreen(name="historyScreen")) self.sm.add_widget(EditSnackScreen(name="editSnackScreen")) - inspector.create_inspector(Window, self.sm) + if self.use_inspector: + inspector.create_inspector(Window, self.sm) return self.sm def on_stop(self): @@ -73,5 +73,24 @@ def on_stop(self): return super().on_stop() +def main(): + parser = argparse.ArgumentParser(description="Snack Attack Track Application") + parser.add_argument("--no-inspector", action="store_true", help="Run the app without the inspector") + parser.add_argument("--rotate-screen", type=int, choices=range(0, 361), default=0, help="Rotate the screen by an angle between 0 and 360 degrees") + args = parser.parse_args() + + # Size of Raspberry pi touchscreen + Window.size = (800, 480) + Window.rotation = args.rotate_screen + Window.show_cursor = False + + if args.no_inspector: + app = snackAttackTrackApp(use_inspector=False) + else: + app = snackAttackTrackApp(use_inspector=True) + + app.run() + + if __name__ == "__main__": - snackAttackTrackApp().run() + main() diff --git a/launch.sh b/launch.sh new file mode 100644 index 0000000..c2bed20 --- /dev/null +++ b/launch.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Activate virtual environment +source /home/pi/venv/bin/activate + +# Launch main.py with arguments +python /home/pi/GuiApp/main.py --no-cursor --no-inspector --rotate-screen 180