updated view
This commit is contained in:
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")
|
||||
|
||||
Reference in New Issue
Block a user