Skip to content

Commit

Permalink
version info
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushKun committed Apr 10, 2024
1 parent e5918bc commit 9ec5be3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cam-py/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from pygame_gui import UIManager
from pygame_gui.elements import UIButton
from globals import state
import globals
import os
import sys


class SettingsScreen:
Expand All @@ -28,10 +30,19 @@ def setup(self):
wallet_rect.center = (state["res"][0]//2, state["res"][1]//2 + 50)
self.wallet_settings = UIButton(wallet_rect, "Wallet", self.manager)

exit_rect = pygame.Rect((0, 0), (100, 50))
exit_rect.center = (state["res"][0]//2, state["res"][1]//2 + 100)
self.exit_btn = UIButton(exit_rect, "Exit", self.manager)

shutdown_rect = pygame.Rect((0, 0), (100, 50))
shutdown_rect.center = (state["res"][0]//2, state["res"][1]//2 + 100)
shutdown_rect.center = (state["res"][0]//2, state["res"][1]//2 + 150)
self.shutdown_btn = UIButton(shutdown_rect, "Shutdown", self.manager)

version_rect = pygame.Rect((0, 0), (100, 50))
version_rect.topleft = (0, 0)
self.version_label = UIButton(
version_rect, globals.get_version(), self.manager)

# Runs inside the event loop
def run(self, event: pygame.event.EventType):
if event.type == pygame_gui.UI_BUTTON_PRESSED:
Expand All @@ -42,6 +53,9 @@ def run(self, event: pygame.event.EventType):
self.set_screen("Wifi")
elif btn == self.wallet_settings:
self.set_screen("Wallet")
elif btn == self.exit_btn:
pygame.quit()
sys.exit()
elif btn == self.shutdown_btn:
os.system("sudo shutdown now")

Expand Down

0 comments on commit 9ec5be3

Please sign in to comment.