Add edit feature enable/disable setting
- Added checkbox in Settings screen to enable/disable edit feature - Setting stored in app_config.json as 'edit_feature_enabled' - Edit workflow now validates: player setting, media type, server permission, card auth - Shows appropriate error message when edit is blocked at any validation step - Defaults to enabled (true) if not set - All conditions must be met for edit interface to open
This commit is contained in:
@@ -5,5 +5,6 @@
|
|||||||
"quickconnect_key": "8887779",
|
"quickconnect_key": "8887779",
|
||||||
"orientation": "Landscape",
|
"orientation": "Landscape",
|
||||||
"touch": "True",
|
"touch": "True",
|
||||||
"max_resolution": "1920x1080"
|
"max_resolution": "1920x1080",
|
||||||
|
"edit_feature_enabled": true
|
||||||
}
|
}
|
||||||
29
src/main.py
29
src/main.py
@@ -1078,6 +1078,7 @@ class SettingsPopup(Popup):
|
|||||||
self.ids.orientation_input.text = self.player.config.get('orientation', 'Landscape')
|
self.ids.orientation_input.text = self.player.config.get('orientation', 'Landscape')
|
||||||
self.ids.touch_input.text = self.player.config.get('touch', 'True')
|
self.ids.touch_input.text = self.player.config.get('touch', 'True')
|
||||||
self.ids.resolution_input.text = self.player.config.get('max_resolution', 'auto')
|
self.ids.resolution_input.text = self.player.config.get('max_resolution', 'auto')
|
||||||
|
self.ids.edit_enabled_checkbox.active = self.player.config.get('edit_feature_enabled', True)
|
||||||
|
|
||||||
# Update status info
|
# Update status info
|
||||||
self.ids.playlist_info.text = f'Playlist Version: {self.player.playlist_version}'
|
self.ids.playlist_info.text = f'Playlist Version: {self.player.playlist_version}'
|
||||||
@@ -1118,6 +1119,12 @@ class SettingsPopup(Popup):
|
|||||||
Window.remove_widget(self.keyboard_widget)
|
Window.remove_widget(self.keyboard_widget)
|
||||||
self.keyboard_widget = None
|
self.keyboard_widget = None
|
||||||
|
|
||||||
|
def on_edit_feature_toggle(self, is_active):
|
||||||
|
"""Handle edit feature checkbox toggle"""
|
||||||
|
Logger.info(f"SettingsPopup: Edit feature {'enabled' if is_active else 'disabled'}")
|
||||||
|
# Update config immediately so it's available
|
||||||
|
self.player.config['edit_feature_enabled'] = is_active
|
||||||
|
|
||||||
def on_popup_dismiss(self, *args):
|
def on_popup_dismiss(self, *args):
|
||||||
"""Handle popup dismissal - resume playback and restart cursor hide timer"""
|
"""Handle popup dismissal - resume playback and restart cursor hide timer"""
|
||||||
# Hide and remove keyboard
|
# Hide and remove keyboard
|
||||||
@@ -1224,6 +1231,7 @@ class SettingsPopup(Popup):
|
|||||||
self.player.config['orientation'] = self.ids.orientation_input.text
|
self.player.config['orientation'] = self.ids.orientation_input.text
|
||||||
self.player.config['touch'] = self.ids.touch_input.text
|
self.player.config['touch'] = self.ids.touch_input.text
|
||||||
self.player.config['max_resolution'] = self.ids.resolution_input.text
|
self.player.config['max_resolution'] = self.ids.resolution_input.text
|
||||||
|
self.player.config['edit_feature_enabled'] = self.ids.edit_enabled_checkbox.active
|
||||||
|
|
||||||
# Save to file
|
# Save to file
|
||||||
self.player.save_config()
|
self.player.save_config()
|
||||||
@@ -1838,12 +1846,23 @@ class SignagePlayer(Widget):
|
|||||||
Show edit interface for current image
|
Show edit interface for current image
|
||||||
|
|
||||||
Workflow:
|
Workflow:
|
||||||
1. Validate media type (must be image)
|
1. Check if edit feature is enabled in settings
|
||||||
2. Check edit_on_player permission from server
|
2. Validate media type (must be image)
|
||||||
3. Prompt for card swipe (5 second timeout)
|
3. Check edit_on_player permission from server
|
||||||
4. Open edit interface with card data stored
|
4. Prompt for card swipe (5 second timeout)
|
||||||
5. When saved, card data is included in metadata and sent to server
|
5. Open edit interface with card data stored
|
||||||
|
6. When saved, card data is included in metadata and sent to server
|
||||||
"""
|
"""
|
||||||
|
# Check 0: Verify edit feature is enabled in player settings
|
||||||
|
edit_feature_enabled = self.config.get('edit_feature_enabled', True)
|
||||||
|
if not edit_feature_enabled:
|
||||||
|
Logger.warning("SignagePlayer: Edit feature is disabled in settings")
|
||||||
|
# Show error message briefly
|
||||||
|
self.ids.status_label.text = 'Edit feature disabled - Enable in settings'
|
||||||
|
self.ids.status_label.opacity = 1
|
||||||
|
Clock.schedule_once(lambda dt: setattr(self.ids.status_label, 'opacity', 0), 2)
|
||||||
|
return
|
||||||
|
|
||||||
# Check if current media is an image
|
# Check if current media is an image
|
||||||
if not self.playlist or self.current_index >= len(self.playlist):
|
if not self.playlist or self.current_index >= len(self.playlist):
|
||||||
Logger.warning("SignagePlayer: No media to edit")
|
Logger.warning("SignagePlayer: No media to edit")
|
||||||
|
|||||||
@@ -493,6 +493,36 @@
|
|||||||
write_tab: False
|
write_tab: False
|
||||||
on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None
|
on_touch_down: root.on_input_touch(self, args[1]) if self.collide_point(*args[1].pos) else None
|
||||||
|
|
||||||
|
# Edit Feature Enable/Disable
|
||||||
|
BoxLayout:
|
||||||
|
orientation: 'horizontal'
|
||||||
|
size_hint_y: None
|
||||||
|
height: dp(40)
|
||||||
|
spacing: dp(10)
|
||||||
|
|
||||||
|
Label:
|
||||||
|
text: 'Enable Edit Feature:'
|
||||||
|
size_hint_x: 0.3
|
||||||
|
text_size: self.size
|
||||||
|
halign: 'left'
|
||||||
|
valign: 'middle'
|
||||||
|
|
||||||
|
CheckBox:
|
||||||
|
id: edit_enabled_checkbox
|
||||||
|
size_hint_x: None
|
||||||
|
width: dp(40)
|
||||||
|
active: True
|
||||||
|
on_active: root.on_edit_feature_toggle(self.active)
|
||||||
|
|
||||||
|
Label:
|
||||||
|
text: '(Allow editing images on this player)'
|
||||||
|
size_hint_x: 0.4
|
||||||
|
font_size: sp(12)
|
||||||
|
text_size: self.size
|
||||||
|
halign: 'left'
|
||||||
|
valign: 'middle'
|
||||||
|
color: 0.7, 0.7, 0.7, 1
|
||||||
|
|
||||||
Widget:
|
Widget:
|
||||||
size_hint_y: 0.05
|
size_hint_y: 0.05
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user