updated to show when is not online

This commit is contained in:
2025-09-09 17:11:25 +03:00
parent a91b07ede4
commit 26fc946a65
11 changed files with 453 additions and 17 deletions

88
test_ui_notification.py Normal file
View File

@@ -0,0 +1,88 @@
#!/usr/bin/env python3
"""Simple UI test for offline notification display"""
import sys
import os
import tkinter as tk
# Add the signage_player directory to the path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'signage_player'))
class TestNotificationApp:
def __init__(self):
self.root = tk.Tk()
self.root.title("Offline Notification Test")
self.root.geometry("800x600")
self.root.configure(bg='black')
# Create main content area
main_label = tk.Label(
self.root,
text="MAIN PLAYER CONTENT AREA",
fg='white',
bg='black',
font=('Arial', 24)
)
main_label.pack(expand=True, fill='both')
# Test buttons
button_frame = tk.Frame(self.root, bg='black')
button_frame.pack(pady=10)
tk.Button(
button_frame,
text="Show Offline Notification",
command=self.show_offline_notification,
bg='red',
fg='white'
).pack(side=tk.LEFT, padx=5)
tk.Button(
button_frame,
text="Hide Notification",
command=self.hide_offline_notification,
bg='green',
fg='white'
).pack(side=tk.LEFT, padx=5)
self.offline_notification = None
def show_offline_notification(self):
"""Show the offline notification at the bottom of the screen"""
if self.offline_notification:
return # Already showing
from get_playlists import get_last_playlist_update_time
last_update = get_last_playlist_update_time()
if last_update:
timestamp_str = last_update.strftime("%Y-%m-%d %H:%M:%S")
message = f"OFFLINE MODE: Playing last available playlist updated at: {timestamp_str}"
else:
message = "OFFLINE MODE: Playing last available playlist"
self.offline_notification = tk.Label(
self.root,
text=message,
fg='white',
bg='red',
font=('Arial', 12, 'bold'),
pady=5
)
self.offline_notification.pack(side=tk.BOTTOM, fill=tk.X)
print(f"[UI TEST] Notification shown: {message}")
def hide_offline_notification(self):
"""Hide the offline notification"""
if self.offline_notification:
self.offline_notification.destroy()
self.offline_notification = None
print("[UI TEST] Notification hidden")
def run(self):
print("[UI TEST] Starting offline notification UI test...")
self.root.mainloop()
if __name__ == "__main__":
app = TestNotificationApp()
app.run()