updated card check

This commit is contained in:
Kiwy Signage Player
2025-12-13 19:39:00 +02:00
parent 5843bb5215
commit db796e4d66
2 changed files with 22 additions and 12 deletions

View File

@@ -1 +0,0 @@
User requested exit via password

View File

@@ -276,6 +276,7 @@ class CardSwipePopup(Popup):
def __init__(self, callback, resources_path, **kwargs):
super(CardSwipePopup, self).__init__(**kwargs)
self.callback = callback
self.resources_path = resources_path
self.timeout_event = None
# Popup settings
@@ -287,15 +288,15 @@ class CardSwipePopup(Popup):
# Main layout
layout = BoxLayout(orientation='vertical', padding=20, spacing=20)
# Card swipe icon (using image)
# Card swipe icon (using async image to prevent "X" during load)
icon_path = os.path.join(resources_path, 'access-card.png')
icon_image = Image(
self.icon_image = AsyncImage(
source=icon_path,
size_hint=(1, 0.4),
allow_stretch=True,
keep_ratio=True
)
layout.add_widget(icon_image)
layout.add_widget(self.icon_image)
# Message
self.message_label = Label(
@@ -348,10 +349,24 @@ class CardSwipePopup(Popup):
def card_received(self, card_data):
"""Called when card data is received"""
Logger.info(f"CardSwipePopup: Card received: {card_data}")
self.message_label.text = '✓ Card detected'
# Change icon to card-checked.png
checked_icon_path = os.path.join(self.resources_path, 'card-checked.png')
Logger.info(f"CardSwipePopup: Loading checked icon from {checked_icon_path}")
# Verify file exists
if os.path.exists(checked_icon_path):
self.icon_image.source = checked_icon_path
self.icon_image.reload() # Force reload the image
Logger.info("CardSwipePopup: Card-checked icon loaded")
else:
Logger.warning(f"CardSwipePopup: card-checked.png not found at {checked_icon_path}")
self.message_label.text = 'Card detected'
self.countdown_label.text = ''
self.countdown_label.color = (0.2, 0.9, 0.3, 1)
Clock.schedule_once(lambda dt: self.finish(card_data), 0.5)
# Increase delay to 1 second to give time for image to display
Clock.schedule_once(lambda dt: self.finish(card_data), 1.0)
def cancel(self, instance):
"""Cancel button pressed"""
@@ -1722,10 +1737,8 @@ class SignagePlayer(Widget):
source=intro_path,
state='play',
options={'eos': 'stop'},
allow_stretch=True,
keep_ratio=True,
size=self.size,
pos=(0, 0)
size_hint=(1, 1),
pos_hint={'center_x': 0.5, 'center_y': 0.5}
)
# Bind to video end event
@@ -1903,8 +1916,6 @@ class SignagePlayer(Widget):
options={
'eos': 'stop', # Stop at end of stream
},
allow_stretch=True,
keep_ratio=True, # Maintain aspect ratio
size_hint=(1, 1),
pos_hint={'center_x': 0.5, 'center_y': 0.5}
)