first commit

This commit is contained in:
Kivy Signage Player
2025-09-26 17:04:17 +03:00
parent 7bdc706915
commit e052f4d068
2 changed files with 152 additions and 90 deletions

View File

@@ -390,10 +390,16 @@ class SignagePlayer(Widget):
return super(SignagePlayer, self).on_touch_move(touch) return super(SignagePlayer, self).on_touch_move(touch)
def show_controls(self): def show_controls(self):
"""Show control buttons""" """Show control buttons and cursor"""
if self.controls_timer: if self.controls_timer:
self.controls_timer.cancel() self.controls_timer.cancel()
# Show cursor
try:
Window.show_cursor = True
except:
pass
# Fade in controls # Fade in controls
Animation(opacity=1, duration=0.3).start(self.ids.controls_layout) Animation(opacity=1, duration=0.3).start(self.ids.controls_layout)
@@ -408,8 +414,14 @@ class SignagePlayer(Widget):
self.controls_timer = Clock.schedule_once(self.hide_controls, 3) self.controls_timer = Clock.schedule_once(self.hide_controls, 3)
def hide_controls(self, dt=None): def hide_controls(self, dt=None):
"""Hide control buttons""" """Hide control buttons and cursor"""
Animation(opacity=0, duration=0.5).start(self.ids.controls_layout) Animation(opacity=0, duration=0.5).start(self.ids.controls_layout)
# Hide cursor after controls are hidden
try:
Window.show_cursor = False
except:
pass
def show_settings(self, instance=None): def show_settings(self, instance=None):
"""Show settings popup""" """Show settings popup"""
@@ -424,13 +436,30 @@ class SignagePlayer(Widget):
class SignagePlayerApp(App): class SignagePlayerApp(App):
def build(self): def build(self):
# Set window to fullscreen # Get screen resolution info
Logger.info(f"SignagePlayerApp: Screen size: {Window.size}")
Logger.info(f"SignagePlayerApp: Available screen size: {Window.system_size if hasattr(Window, 'system_size') else 'N/A'}")
# Set window to fullscreen and borderless
Window.fullscreen = 'auto' Window.fullscreen = 'auto'
Window.borderless = True Window.borderless = True
# Hide cursor after 3 seconds of inactivity
Clock.schedule_once(self.hide_cursor, 3)
return SignagePlayer() return SignagePlayer()
def hide_cursor(self, dt):
"""Hide the mouse cursor"""
try:
Window.show_cursor = False
except:
pass # Some platforms don't support cursor hiding
def on_start(self): def on_start(self):
# Log final window info
Logger.info(f"SignagePlayerApp: Final window size: {Window.size}")
Logger.info(f"SignagePlayerApp: Fullscreen: {Window.fullscreen}")
Logger.info("SignagePlayerApp: Application started") Logger.info("SignagePlayerApp: Application started")
def on_stop(self): def on_stop(self):

View File

@@ -8,102 +8,135 @@
size: self.size size: self.size
pos: self.pos pos: self.pos
# Main content area # Main content area - FULLSCREEN WIDGET
BoxLayout: Widget:
id: main_layout id: content_area
orientation: 'vertical'
# Content display area (will be dynamically populated)
Widget:
id: content_area
size_hint: 1, 1
# Status label (shown when no content or errors)
Label:
id: status_label
text: 'Loading...'
size_hint: 1, None
height: dp(40)
pos_hint: {'center_x': 0.5}
color: 1, 1, 1, 1
font_size: sp(16)
text_size: self.size
halign: 'center'
valign: 'middle'
# Control panel overlay
FloatLayout:
id: overlay_layout
size_hint: 1, 1 size_hint: 1, 1
pos_hint: {'x': 0, 'y': 0}
# Status label overlay (shown when no content or errors)
Label:
id: status_label
text: 'Loading...'
size_hint: None, None
size: dp(400), dp(60)
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
color: 1, 1, 1, 1
font_size: sp(18)
text_size: self.size
halign: 'center'
valign: 'middle'
canvas.before:
Color:
rgba: 0, 0, 0, 0.7
RoundedRectangle:
size: self.size
pos: self.pos
radius: [dp(15)]
# Control panel overlay (always on top)
BoxLayout:
id: controls_layout
orientation: 'horizontal'
size_hint: None, None
size: dp(450), dp(60)
pos_hint: {'right': 0.98, 'top': 0.98}
opacity: 0
spacing: dp(5)
padding: dp(10)
canvas.before:
Color:
rgba: 0.1, 0.1, 0.1, 0.9
RoundedRectangle:
size: self.size
pos: self.pos
radius: [dp(15)]
# Controls container # Control buttons
BoxLayout: Button:
id: controls_layout id: prev_btn
orientation: 'horizontal' text: '⏮'
size_hint: None, None size_hint: None, None
size: dp(450), dp(60) size: dp(60), dp(50)
pos_hint: {'right': 0.98, 'top': 0.98} font_size: sp(18)
opacity: 0 background_color: 0.2, 0.2, 0.2, 0.9
spacing: dp(5) color: 1, 1, 1, 1
padding: dp(10) on_press: root.previous_media()
canvas.before: canvas.before:
Color: Color:
rgba: 0.1, 0.1, 0.1, 0.8 rgba: self.background_color
RoundedRectangle: RoundedRectangle:
size: self.size size: self.size
pos: self.pos pos: self.pos
radius: [dp(10)] radius: [dp(8)]
# Control buttons Button:
Button: id: play_pause_btn
id: prev_btn text: '⏸'
text: '⏮' size_hint: None, None
size_hint: None, None size: dp(60), dp(50)
size: dp(60), dp(50) font_size: sp(18)
font_size: sp(18) background_color: 0.2, 0.6, 0.2, 0.9
background_color: 0.2, 0.2, 0.2, 1 color: 1, 1, 1, 1
color: 1, 1, 1, 1 on_press: root.toggle_pause()
on_press: root.previous_media() canvas.before:
Color:
Button: rgba: self.background_color
id: play_pause_btn RoundedRectangle:
text: '⏸' size: self.size
size_hint: None, None pos: self.pos
size: dp(60), dp(50) radius: [dp(8)]
font_size: sp(18)
background_color: 0.2, 0.6, 0.2, 1 Button:
color: 1, 1, 1, 1 id: next_btn
on_press: root.toggle_pause() text: '⏭'
size_hint: None, None
Button: size: dp(60), dp(50)
id: next_btn font_size: sp(18)
text: '⏭' background_color: 0.2, 0.2, 0.2, 0.9
size_hint: None, None color: 1, 1, 1, 1
size: dp(60), dp(50) on_press: root.next_media()
font_size: sp(18) canvas.before:
background_color: 0.2, 0.2, 0.2, 1 Color:
color: 1, 1, 1, 1 rgba: self.background_color
on_press: root.next_media() RoundedRectangle:
size: self.size
Button: pos: self.pos
id: settings_btn radius: [dp(8)]
text: '⚙'
size_hint: None, None Button:
size: dp(60), dp(50) id: settings_btn
font_size: sp(18) text: '⚙'
background_color: 0.4, 0.4, 0.2, 1 size_hint: None, None
color: 1, 1, 1, 1 size: dp(60), dp(50)
on_press: root.show_settings() font_size: sp(18)
background_color: 0.4, 0.4, 0.2, 0.9
Button: color: 1, 1, 1, 1
id: exit_btn on_press: root.show_settings()
text: '⏻' canvas.before:
size_hint: None, None Color:
size: dp(60), dp(50) rgba: self.background_color
font_size: sp(18) RoundedRectangle:
background_color: 0.6, 0.2, 0.2, 1 size: self.size
color: 1, 1, 1, 1 pos: self.pos
on_press: root.exit_app() radius: [dp(8)]
Button:
id: exit_btn
text: '⏻'
size_hint: None, None
size: dp(60), dp(50)
font_size: sp(18)
background_color: 0.6, 0.2, 0.2, 0.9
color: 1, 1, 1, 1
on_press: root.exit_app()
canvas.before:
Color:
rgba: self.background_color
RoundedRectangle:
size: self.size
pos: self.pos
radius: [dp(8)]
# Settings popup content # Settings popup content