updated view
This commit is contained in:
@@ -2,5 +2,7 @@
|
||||
"server_ip": "digiserver",
|
||||
"port": "80",
|
||||
"screen_name": "rpi-tvholba1",
|
||||
"quickconnect_key": "8887779"
|
||||
"quickconnect_key": "8887779",
|
||||
"orientation": "Landscape",
|
||||
"touch": "True"
|
||||
}
|
||||
30
src/main.py
30
src/main.py
@@ -32,6 +32,27 @@ from get_playlists import (
|
||||
# Load the KV file
|
||||
Builder.load_file('signage_player.kv')
|
||||
|
||||
class ExitPasswordPopup(Popup):
|
||||
def __init__(self, player_instance, **kwargs):
|
||||
super(ExitPasswordPopup, self).__init__(**kwargs)
|
||||
self.player = player_instance
|
||||
|
||||
def check_password(self):
|
||||
"""Check if entered password matches quickconnect key"""
|
||||
entered_password = self.ids.password_input.text
|
||||
correct_password = self.player.config.get('quickconnect_key', '1234567')
|
||||
|
||||
if entered_password == correct_password:
|
||||
# Password correct, exit app
|
||||
Logger.info("ExitPasswordPopup: Correct password, exiting app")
|
||||
self.dismiss()
|
||||
App.get_running_app().stop()
|
||||
else:
|
||||
# Password incorrect, show error and close popup
|
||||
Logger.warning("ExitPasswordPopup: Incorrect password")
|
||||
self.ids.error_label.text = 'Incorrect password!'
|
||||
Clock.schedule_once(lambda dt: self.dismiss(), 1)
|
||||
|
||||
class SettingsPopup(Popup):
|
||||
def __init__(self, player_instance, **kwargs):
|
||||
super(SettingsPopup, self).__init__(**kwargs)
|
||||
@@ -41,6 +62,8 @@ class SettingsPopup(Popup):
|
||||
self.ids.server_input.text = self.player.config.get('server_ip', 'localhost')
|
||||
self.ids.screen_input.text = self.player.config.get('screen_name', 'kivy-player')
|
||||
self.ids.quickconnect_input.text = self.player.config.get('quickconnect_key', '1234567')
|
||||
self.ids.orientation_input.text = self.player.config.get('orientation', 'Landscape')
|
||||
self.ids.touch_input.text = self.player.config.get('touch', 'True')
|
||||
|
||||
# Update status info
|
||||
self.ids.playlist_info.text = f'Playlist Version: {self.player.playlist_version}'
|
||||
@@ -53,6 +76,8 @@ class SettingsPopup(Popup):
|
||||
self.player.config['server_ip'] = self.ids.server_input.text
|
||||
self.player.config['screen_name'] = self.ids.screen_input.text
|
||||
self.player.config['quickconnect_key'] = self.ids.quickconnect_input.text
|
||||
self.player.config['orientation'] = self.ids.orientation_input.text
|
||||
self.player.config['touch'] = self.ids.touch_input.text
|
||||
|
||||
# Save to file
|
||||
self.player.save_config()
|
||||
@@ -442,6 +467,11 @@ class SignagePlayer(Widget):
|
||||
popup = SettingsPopup(player_instance=self)
|
||||
popup.open()
|
||||
|
||||
def show_exit_popup(self, instance=None):
|
||||
"""Show exit password popup"""
|
||||
popup = ExitPasswordPopup(player_instance=self)
|
||||
popup.open()
|
||||
|
||||
def exit_app(self, instance=None):
|
||||
"""Exit the application"""
|
||||
Logger.info("SignagePlayer: Exiting application")
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
background_normal: root.resources_path + '/exit.png'
|
||||
background_down: root.resources_path + '/exit.png'
|
||||
border: (0, 0, 0, 0)
|
||||
on_press: app.stop()
|
||||
on_press: root.show_exit_popup()
|
||||
Button:
|
||||
id: forward_btn
|
||||
size_hint: None, None
|
||||
@@ -103,6 +103,53 @@
|
||||
|
||||
|
||||
|
||||
# Exit password popup
|
||||
<ExitPasswordPopup@Popup>:
|
||||
title: 'Exit Application'
|
||||
size_hint: 0.4, 0.3
|
||||
auto_dismiss: False
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
padding: dp(20)
|
||||
spacing: dp(15)
|
||||
|
||||
Label:
|
||||
text: 'Enter password to exit:'
|
||||
size_hint_y: None
|
||||
height: dp(30)
|
||||
|
||||
TextInput:
|
||||
id: password_input
|
||||
multiline: False
|
||||
password: True
|
||||
font_size: sp(16)
|
||||
size_hint_y: None
|
||||
height: dp(40)
|
||||
|
||||
Label:
|
||||
id: error_label
|
||||
text: ''
|
||||
color: 1, 0, 0, 1
|
||||
size_hint_y: None
|
||||
height: dp(30)
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
size_hint_y: None
|
||||
height: dp(50)
|
||||
spacing: dp(20)
|
||||
|
||||
Button:
|
||||
text: 'Exit'
|
||||
background_color: 0.6, 0.2, 0.2, 1
|
||||
on_press: root.check_password()
|
||||
|
||||
Button:
|
||||
text: 'Cancel'
|
||||
background_color: 0.2, 0.6, 0.2, 1
|
||||
on_press: root.dismiss()
|
||||
|
||||
# Settings popup content
|
||||
<SettingsPopup@Popup>:
|
||||
title: 'Player Settings'
|
||||
@@ -174,6 +221,46 @@
|
||||
multiline: False
|
||||
font_size: sp(14)
|
||||
|
||||
# Orientation
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
size_hint_y: None
|
||||
height: dp(40)
|
||||
spacing: dp(10)
|
||||
|
||||
Label:
|
||||
text: 'Orientation:'
|
||||
size_hint_x: 0.3
|
||||
text_size: self.size
|
||||
halign: 'left'
|
||||
valign: 'middle'
|
||||
|
||||
TextInput:
|
||||
id: orientation_input
|
||||
size_hint_x: 0.7
|
||||
multiline: False
|
||||
font_size: sp(14)
|
||||
|
||||
# Touch
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
size_hint_y: None
|
||||
height: dp(40)
|
||||
spacing: dp(10)
|
||||
|
||||
Label:
|
||||
text: 'Touch:'
|
||||
size_hint_x: 0.3
|
||||
text_size: self.size
|
||||
halign: 'left'
|
||||
valign: 'middle'
|
||||
|
||||
TextInput:
|
||||
id: touch_input
|
||||
size_hint_x: 0.7
|
||||
multiline: False
|
||||
font_size: sp(14)
|
||||
|
||||
Widget:
|
||||
size_hint_y: 0.1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user