redesign: UI Work

This commit is contained in:
2026-04-14 13:18:27 -04:00
parent a015908d44
commit 66e7ca4fc7
11 changed files with 2130 additions and 812 deletions
+157 -67
View File
@@ -16,6 +16,7 @@ from datetime import datetime, timedelta
import os
from pathlib import Path
from update_config import get_update_config
from ui_theme import COLORS, FONT_FAMILY, style_text_button, center_window
class UpdateChecker:
def __init__(self, current_version=None):
@@ -170,6 +171,57 @@ class UpdateChecker:
self.save_last_check_time()
return latest_release, None
def _show_notice_dialog(self, parent_window, title, message, accent_color):
"""Show a small themed notice dialog."""
dialog = tk.Toplevel(parent_window)
dialog.title(title)
dialog.configure(bg=COLORS['bg_primary'])
dialog.resizable(False, False)
dialog.attributes('-topmost', True)
panel = tk.Frame(
dialog,
bg=COLORS['bg_card'],
highlightbackground=COLORS['border_light'],
highlightcolor=COLORS['border_light'],
highlightthickness=1,
)
panel.pack(fill='both', expand=True, padx=16, pady=16)
tk.Label(
panel,
text=title,
fg=accent_color,
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 18, 'bold italic'),
).pack(pady=(18, 10))
tk.Label(
panel,
text=message,
fg=COLORS['text_body'],
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 11),
justify='center',
wraplength=340,
).pack(padx=24, pady=(0, 18))
close_btn = tk.Button(
panel,
text="Close",
command=dialog.destroy,
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12, 'bold italic'),
padx=0,
pady=6,
)
style_text_button(close_btn, COLORS['accent_green'], COLORS['bg_card'])
close_btn.pack(pady=(0, 18))
center_window(dialog, 420, 220, parent_window)
dialog.protocol("WM_DELETE_WINDOW", dialog.destroy)
return dialog
def show_update_dialog(self, parent_window, release_info):
"""Show an update notification dialog"""
@@ -184,7 +236,7 @@ class UpdateChecker:
# Create update dialog
dialog = tk.Toplevel(parent_window)
dialog.title("Update Available - Progression Loader")
dialog.configure(bg='#2b2b2b')
dialog.configure(bg=COLORS['bg_primary'])
dialog.resizable(False, False)
dialog.attributes('-topmost', True)
@@ -195,58 +247,74 @@ class UpdateChecker:
except:
pass
# Calculate dialog size
dialog_width = 500
dialog_height = 400
# Center the dialog
x = parent_window.winfo_x() + (parent_window.winfo_width() // 2) - (dialog_width // 2)
y = parent_window.winfo_y() + (parent_window.winfo_height() // 2) - (dialog_height // 2)
dialog.geometry(f"{dialog_width}x{dialog_height}+{x}+{y}")
# Title
title_label = tk.Label(dialog,
text="🔄 Update Available!",
fg='#00ff00', bg='#2b2b2b',
font=('Arial', 16, 'bold'))
dialog_height = 430
center_window(dialog, dialog_width, dialog_height, parent_window)
panel = tk.Frame(
dialog,
bg=COLORS['bg_card'],
highlightbackground=COLORS['border_light'],
highlightcolor=COLORS['border_light'],
highlightthickness=1,
)
panel.pack(fill='both', expand=True, padx=16, pady=16)
title_label = tk.Label(
panel,
text="Update Available",
fg=COLORS['text_highlight'],
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 18, 'bold italic'),
)
title_label.pack(pady=20)
# Version info
version_frame = tk.Frame(dialog, bg='#2b2b2b')
version_frame = tk.Frame(panel, bg=COLORS['bg_card'])
version_frame.pack(pady=10)
current_label = tk.Label(version_frame,
text=f"Current Version: {self.current_version}",
fg='#cccccc', bg='#2b2b2b',
font=('Arial', 12))
fg=COLORS['text_body'], bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12))
current_label.pack()
latest_label = tk.Label(version_frame,
text=f"Latest Version: {latest_version}",
fg='#00ff00', bg='#2b2b2b',
font=('Arial', 12, 'bold'))
fg=COLORS['accent_green'], bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12, 'bold'))
latest_label.pack()
# Release notes
if release_info.get('body'):
notes_label = tk.Label(dialog,
notes_label = tk.Label(panel,
text="Release Notes:",
fg='#cccccc', bg='#2b2b2b',
font=('Arial', 12, 'bold'))
fg=COLORS['text_primary'], bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12, 'bold italic'))
notes_label.pack(pady=(20, 5))
# Create scrollable text widget for release notes
notes_frame = tk.Frame(dialog, bg='#2b2b2b')
notes_frame = tk.Frame(panel, bg=COLORS['bg_card'])
notes_frame.pack(fill='both', expand=True, padx=20, pady=(0, 20))
notes_text = tk.Text(notes_frame,
height=8,
bg='#404040', fg='#ffffff',
font=('Arial', 10),
bg=COLORS['bg_tertiary'], fg=COLORS['text_body'],
font=(FONT_FAMILY, 10),
wrap=tk.WORD,
state='disabled')
state='disabled',
relief='flat',
bd=0,
insertbackground=COLORS['text_primary'],
highlightthickness=1,
highlightbackground=COLORS['border_light'])
scrollbar = tk.Scrollbar(notes_frame)
scrollbar = tk.Scrollbar(
notes_frame,
bg=COLORS['bg_tertiary'],
troughcolor=COLORS['bg_secondary'],
activebackground=COLORS['bg_hover'],
)
scrollbar.pack(side='right', fill='y')
notes_text.pack(side='left', fill='both', expand=True)
@@ -259,7 +327,7 @@ class UpdateChecker:
notes_text.config(state='disabled')
# Buttons
button_frame = tk.Frame(dialog, bg='#2b2b2b')
button_frame = tk.Frame(panel, bg=COLORS['bg_card'])
button_frame.pack(pady=20)
def download_update():
@@ -302,9 +370,10 @@ class UpdateChecker:
download_btn = tk.Button(button_frame,
text="Download Update",
command=download_update,
bg='#00aa00', fg='white',
font=('Arial', 12, 'bold'),
padx=20, pady=5)
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12, 'bold italic'),
padx=0, pady=6)
style_text_button(download_btn, COLORS['accent_green'], COLORS['bg_card'])
download_btn.pack(side='left', padx=5)
# Only show remind/skip buttons if persistence is enabled
@@ -312,25 +381,28 @@ class UpdateChecker:
later_btn = tk.Button(button_frame,
text="Remind Later",
command=remind_later,
bg='#0078d4', fg='white',
font=('Arial', 12),
padx=20, pady=5)
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12, 'bold italic'),
padx=0, pady=6)
style_text_button(later_btn, COLORS['accent_yellow'], COLORS['bg_card'])
later_btn.pack(side='left', padx=5)
skip_btn = tk.Button(button_frame,
text="Skip Version",
command=skip_version,
bg='#666666', fg='white',
font=('Arial', 12),
padx=20, pady=5)
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12, 'bold italic'),
padx=0, pady=6)
style_text_button(skip_btn, COLORS['accent_red'], COLORS['bg_card'])
skip_btn.pack(side='left', padx=5)
else:
close_btn = tk.Button(button_frame,
text="Close",
command=dialog.destroy,
bg='#666666', fg='white',
font=('Arial', 12),
padx=20, pady=5)
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12, 'bold italic'),
padx=0, pady=6)
style_text_button(close_btn, COLORS['accent_red'], COLORS['bg_card'])
close_btn.pack(side='left', padx=5)
# Handle window close
@@ -355,15 +427,21 @@ class UpdateChecker:
"""Manually check for updates and show result"""
def check_complete(release_info, error):
if error:
messagebox.showerror("Update Check Failed",
f"Could not check for updates:\n{error}",
parent=parent_window)
self._show_notice_dialog(
parent_window,
"Update Check Failed",
f"Could not check for updates:\n{error}",
COLORS['accent_red'],
)
return
if not release_info:
messagebox.showinfo("No Updates",
"Could not retrieve release information.",
parent=parent_window)
self._show_notice_dialog(
parent_window,
"No Updates",
"Could not retrieve release information.",
COLORS['accent_yellow'],
)
return
latest_version = release_info['version']
@@ -371,33 +449,44 @@ class UpdateChecker:
if self.is_newer_version(latest_version) and not self.should_skip_version(latest_version):
self.show_update_dialog(parent_window, release_info)
else:
messagebox.showinfo("Up to Date",
f"You are running the latest version ({self.current_version}).",
parent=parent_window)
self._show_notice_dialog(
parent_window,
"Up To Date",
f"You are running the latest version ({self.current_version}).",
COLORS['accent_green'],
)
# Show checking message
checking_dialog = tk.Toplevel(parent_window)
checking_dialog.title("Checking for Updates")
checking_dialog.configure(bg='#2b2b2b')
checking_dialog.configure(bg=COLORS['bg_primary'])
checking_dialog.resizable(False, False)
checking_dialog.attributes('-topmost', True)
# Center the dialog
checking_dialog.geometry("300x100")
x = parent_window.winfo_x() + (parent_window.winfo_width() // 2) - 150
y = parent_window.winfo_y() + (parent_window.winfo_height() // 2) - 50
checking_dialog.geometry(f"300x100+{x}+{y}")
label = tk.Label(checking_dialog,
text="Checking for updates...",
fg='white', bg='#2b2b2b',
font=('Arial', 12))
panel = tk.Frame(
checking_dialog,
bg=COLORS['bg_card'],
highlightbackground=COLORS['border_light'],
highlightcolor=COLORS['border_light'],
highlightthickness=1,
)
panel.pack(fill='both', expand=True, padx=14, pady=14)
label = tk.Label(
panel,
text="Checking for updates...",
fg=COLORS['text_primary'],
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 12, 'bold italic'),
)
label.pack(expand=True)
center_window(checking_dialog, 320, 120, parent_window)
def check_and_close():
release_info, error = self.check_for_updates_sync()
checking_dialog.destroy()
check_complete(release_info, error)
parent_window.after(0, lambda: checking_dialog.destroy())
parent_window.after(0, lambda: check_complete(release_info, error))
# Start check in background
threading.Thread(target=check_and_close, daemon=True).start()
@@ -452,9 +541,10 @@ def integrate_update_checker_with_gui(gui_class):
update_btn = tk.Button(parent_frame,
text="Check Updates",
command=self.manual_update_check,
bg='#404040', fg='white',
font=('Arial', 10),
padx=10, pady=2)
bg=COLORS['bg_card'],
font=(FONT_FAMILY, 10, 'bold italic'),
padx=8, pady=3)
style_text_button(update_btn, COLORS['accent_yellow'], COLORS['bg_card'])
update_btn.pack(side='right', padx=5, pady=5)
except Exception as e:
print(f"Could not add update button: {e}")
@@ -484,4 +574,4 @@ def integrate_update_checker_with_gui(gui_class):
gui_class.manual_update_check = manual_update_check
gui_class.__init__ = new_init
return gui_class
return gui_class