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 #1 #2 #3 #4 #5 #7, Ritankar Das, fixed given issues #18

Open
wants to merge 1 commit into
base: Participant
Choose a base branch
from
Open
Show file tree
Hide file tree
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
27 changes: 14 additions & 13 deletions screenLayout/sitea_screen.kv
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
size_hint: None,None
size: dp(80), dp(80)
pos: dp(261), dp(347)
disabled: True

disabled: True if splash_bg_after.opacity == 1 else False
on_press:
root.change_img(self, 2)
root.check_product(self, 2)



Expand Down Expand Up @@ -100,26 +102,25 @@
center_y: self.parent.top - 10

Button:
id: 5
id: 5 # Corrected button ID
text: "Ω"
font_size: "65sp"
color: 255,255,255
color: 255, 255, 255
halign: 'center'
valign: 'bottom'
background_color: 255,255,255
size_hint: None,None
background_color: 255, 255, 255
size_hint: None, None
size: dp(80), dp(80)
pos: dp(261), dp(242)
disabled: True if splash_bg_after.opacity == 1 else False
on_press:
root.change_img(self, 4)
root.check_product(self, 4)

root.change_img(self, 5) # Corrected button ID
root.check_product(self, 5) # Corrected button ID
Image:
id: 5
id: 5 # Corrected button ID
source: 'assets/img/symbols/off.png'
center_x: self.parent.center_x
center_y: self.parent.top - 10
center_y: self.parent.top - 10

Button:
id: 6
Expand Down Expand Up @@ -222,10 +223,10 @@

# Initialize return button to map window
Button:
size_hint: None,None
size_hint: None, None
size: dp(60), dp(60)
pos: dp(12), dp(523)
background_color: 0,0,0,0
background_color: 0, 0, 0, 0
on_press: root.manager.current = 'map'

Image:
Expand Down
25 changes: 22 additions & 3 deletions screens/doors.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,52 @@
# Import necessary modules and classes
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen
from kivy.core.audio import SoundLoader

# Import functions from another module
from .screen_check import passcode, set_doors

# Load the Kivy layout file for the DoorsScreen
Builder.load_file('screenLayout/doors_screen.kv')

# Load a sound file for later use
sound = SoundLoader.load('assets/audio/doors_roger.wav')

# Define a class named DoorsScreen that inherits from the Screen class
class DoorsScreen(Screen):
# Initialize a class variable 'verified' to False
verified = False

# Function to increment the value of a label
def increment_value(self, label_index):
if(int(label_index.text) == 5):
if int(label_index.text) == 9:
label_index.text = "0"
else:
label_index.text = f"{int(label_index.text) + 1}"
# Call the 'verify' method to check if the passcode is correct
DoorsScreen.verify(self)

# Function to decrement the value of a label
def decrement_value(self, label_index):
if(int(label_index.text) == 0):
if int(label_index.text) == 0:
label_index.text = "5"
else:
label_index.text = f"{int(label_index.text) - 1}"
# Call the 'verify' method to check if the passcode is correct
DoorsScreen.verify(self)

# Function to verify the passcode
def verify(self):
# Concatenate the values of four labels to form a passcode and compare it with the stored passcode
code = passcode == int(self.ids.label_1.text + self.ids.label_2.text + self.ids.label_3.text + self.ids.label_4.text)
# Check if the passcode is correct and the screen hasn't been verified yet
if not DoorsScreen.verified and code:
# Mark the screen as verified
DoorsScreen.verified = True
# Make changes to the UI by changing the opacity of certain elements
self.ids.splash_bg.opacity = 0
self.ids.splash_bg_after.opacity = 1
# Call the 'set_doors' function to perform additional actions
set_doors()
sound.play()
# Play the loaded sound
sound.play()
8 changes: 6 additions & 2 deletions screens/siteA.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ def show_overlay(self): # Updating the window state after correct combination
self.ids.splash_bg_after.opacity = 1
self.pressed_buttons = []

def change_img(self, button, idOG): # Toggle the button states to on(green)/off(grey) on press
def change_img(self, button, idOG):
idOG_dynamic = f"{idOG}"
widget = getattr(self.ids, idOG_dynamic, None)
widget.source = "assets/img/symbols/off.png" if widget.source == "assets/img/symbols/off.png" else "assets/img/symbols/off.png"

if widget.source == "assets/img/symbols/off.png":
widget.source = "assets/img/symbols/on.png" # Change to the green button image
else:
widget.source = "assets/img/symbols/off.png" # Change to the grey button image

def check_product(self, instance, id): # Check for correct code combination
button_id = id
Expand Down
2 changes: 1 addition & 1 deletion screens/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SpawnScreen(Screen):
verified = False

def slider_val_change(self):
if not SpawnScreen.verified and ((self.ids.slide1.value < slider[0]+5) and (self.ids.slide1.value > slider[0]-5 )) and ((self.ids.slide2.value < slider[2]+5)and ( self.ids.slide2.value > slider[2]-5 )) and ((self.ids.slide3.value < slider[2]+5) and (self.ids.slide3.value > slider[2]-5 )):
if not SpawnScreen.verified and ((self.ids.slide1.value < slider[0]+5) and (self.ids.slide1.value > slider[0]-5 )) and ((self.ids.slide2.value < slider[1]+5)and ( self.ids.slide2.value > slider[1]-5 )) and ((self.ids.slide3.value < slider[2]+5) and (self.ids.slide3.value > slider[2]-5 )):
SpawnScreen.verified = True
self.ids.splash_bg.opacity = 0
self.ids.splash_bg_after.opacity = 1
Expand Down
Loading