Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #7 , Arman Pani (2228103), document door.py #13

Open
wants to merge 1 commit into
base: Participant
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion screens/doors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from kivy.core.audio import SoundLoader
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen
from kivy.core.audio import SoundLoader

from .screen_check import passcode, set_doors

Expand All @@ -10,24 +10,33 @@ class DoorsScreen(Screen):
verified = False

def increment_value(self, label_index):
# Increment the value of the label by 1
if(int(label_index.text) == 5):
label_index.text = "0"
else:
label_index.text = f"{int(label_index.text) + 1}"
# Verify the code entered by the user
DoorsScreen.verify(self)

def decrement_value(self, label_index):
# Decrement the value of the label by 1
if(int(label_index.text) == 0):
label_index.text = "5"
else:
label_index.text = f"{int(label_index.text) - 1}"
# Verify the code entered by the user
DoorsScreen.verify(self)

def verify(self):
# Check if the code entered by the user matches the passcode
code = passcode == int(self.ids.label_1.text + self.ids.label_2.text + self.ids.label_3.text + self.ids.label_4.text)
if not DoorsScreen.verified and code:
# Set the verified status to True
DoorsScreen.verified = True
# Update the splash screen
self.ids.splash_bg.opacity = 0
self.ids.splash_bg_after.opacity = 1
# Set the doors
set_doors()
# Play the sound
sound.play()