From 133c87ccd556d7eadae171e394a6383d77dba2cf Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 22 Nov 2026 19:45:42 +0000 Subject: [PATCH] Clean up flat-dark design system naming and tokens Rename leftover Glassmorphic* widgets to real names, drive theme/splash CSS from a single DesignTokens set with a steel-blue accent, and refresh screenshot docs noting legacy captures. Co-authored-by: Joshua Kac --- CHANGELOG.md | 3 +- README.md | 2 +- app/dialogs/ffmpeg_setup_dialog.py | 2 +- app/dialogs/settings_dialog.py | 5 +- app/dialogs/update_dialog.py | 4 +- app/main_window.py | 13 +- app/splash_screen.py | 24 +- app/widgets/custom_widgets.py | 60 ++--- app/widgets/encoder_tab.py | 34 +-- app/widgets/logs_tab.py | 2 +- app/widgets/metadata_tab.py | 2 +- app/widgets/subtitle_tab.py | 10 +- app/widgets/update_toast.py | 6 +- docs/index.html | 2 +- docs/screenshots/README.md | 11 + main.py | 4 +- resources/styles/splash_screen.css | 22 +- resources/styles/theme_base.css | 351 +++++++++++++++-------------- tests/test_design_tokens.py | 40 ++++ utils/app_stylesheet.py | 47 ++-- utils/design_tokens.py | 76 ++++++- utils/theme_manager.py | 24 +- 22 files changed, 428 insertions(+), 316 deletions(-) create mode 100644 docs/screenshots/README.md create mode 100644 tests/test_design_tokens.py diff --git a/CHANGELOG.md b/CHANGELOG.md index f89b028..0f03636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- **Design system cleanup (P5-A)** — Renamed leftover `Glassmorphic*` widgets to real names (`SectionCard`, `StyledButton`, `AppMainWindow`, …), dropped card drop-shadows, and drove `theme_base.css` / splash CSS from a single `DesignTokens` flat-dark set (steel-blue accent, no purple/glow). Screenshot docs note the PNGs are still legacy menu-bar captures. - **macOS packaging docs** — README now states official DMG builds are **Apple Silicon only** (no Intel Mac artifacts). - **Test foundation (P3-D)** — Unit CI now enforces `--cov=core --cov=utils --cov-fail-under=30`, locks C1/C2 via `audit_c1`/`audit_c2` markers, and adds Encoder/Subtitle widget smoke tests. A scheduled/on-demand workflow runs the FFmpeg integration suite that the PR matrix still excludes. - **GPU / encoder OS matrix documented** — README, CLAUDE.md, and encoder docs spell out NVENC (all), AMF (Windows), VAAPI (Linux), QSV (Windows/Linux), VideoToolbox (macOS). @@ -110,7 +111,7 @@ First stable release of the PySide6 rewrite. This promotes the 0.5.0 alpha line - Several subtitle scrapers (Podnapisi, SubDivX, Jimaku) target site layouts that have since changed. They are **quarantined**: shown as unavailable in the Subtitles tab and skipped during search until rewritten (no silent empty “success”). - CLI: `encode`, `rename`, and `gui` work and share `EncodeForgeCore` with the desktop app; `subtitle` is still a stub that exits with status 2 (use the GUI). - Theme Light/Auto, app language, toolbar, and two-pass encoding are not offered in Settings until implemented; status bar visibility is wired. -- Screenshots under `docs/screenshots/` show an older menu-bar / three-table UI, not the current frameless sidebar layout. +- Screenshots under `docs/screenshots/` are legacy menu-bar / three-table captures (see `docs/screenshots/README.md`); the shipping UI is frameless sidebar + flat dark tokens. ### Release Links diff --git a/README.md b/README.md index e6cf18f..d45358b 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ python build_nuitka.py That's it. Most options have sensible defaults, so you can dive straight in. -> **Note:** Screenshots on the [project site](https://sirstig.github.io/EncodeForge/#screenshots) (`docs/screenshots/`) show an older menu-bar UI, not the current frameless sidebar layout. +> **Note:** Screenshots on the [project site](https://sirstig.github.io/EncodeForge/#screenshots) (`docs/screenshots/`) are legacy menu-bar captures. The current app uses frameless sidebar chrome and a flat dark token theme — see `docs/screenshots/README.md`. ### Scripting from the CLI diff --git a/app/dialogs/ffmpeg_setup_dialog.py b/app/dialogs/ffmpeg_setup_dialog.py index fe08629..70e8bfb 100644 --- a/app/dialogs/ffmpeg_setup_dialog.py +++ b/app/dialogs/ffmpeg_setup_dialog.py @@ -73,7 +73,7 @@ def __init__(self, parent=None, required: bool = True): self._auto_detect() def _apply_theme(self): - """Apply glassmorphism theme to dialog.""" + """Apply flat dark theme to dialog.""" try: theme_manager = get_theme_manager() theme_manager.apply_dialog_theme(self) diff --git a/app/dialogs/settings_dialog.py b/app/dialogs/settings_dialog.py index 9b653fc..51fd9ef 100644 --- a/app/dialogs/settings_dialog.py +++ b/app/dialogs/settings_dialog.py @@ -64,7 +64,10 @@ def _hint(text: str) -> QLabel: def _link(text: str, url: str) -> QLabel: """Return a small clickable hyperlink label.""" - lbl = QLabel(f'{text}') + from utils.design_tokens import default_tokens + + accent = default_tokens().accent + lbl = QLabel(f'{text}') lbl.setOpenExternalLinks(True) lbl.setStyleSheet("font-size: 10px;") return lbl diff --git a/app/dialogs/update_dialog.py b/app/dialogs/update_dialog.py index 84c862c..89e6e89 100644 --- a/app/dialogs/update_dialog.py +++ b/app/dialogs/update_dialog.py @@ -7,7 +7,7 @@ from PySide6.QtGui import QDesktopServices from PySide6.QtWidgets import QDialog, QHBoxLayout, QLabel, QTextEdit, QVBoxLayout -from app.widgets.custom_widgets import GlassmorphicButton, PrimaryButton, StyledLabel +from app.widgets.custom_widgets import StyledButton, PrimaryButton, StyledLabel from utils.update_checker import ReleaseInfo @@ -52,7 +52,7 @@ def __init__(self, release: ReleaseInfo, current_version: str, parent=None): row = QHBoxLayout() row.addStretch() - close_btn = GlassmorphicButton("Close") + close_btn = StyledButton("Close") close_btn.clicked.connect(self.reject) row.addWidget(close_btn) diff --git a/app/main_window.py b/app/main_window.py index 0a65c79..fe9c89d 100644 --- a/app/main_window.py +++ b/app/main_window.py @@ -26,9 +26,8 @@ from app import __version__ as APP_VERSION from app.widgets.app_title_bar import AppTitleBar from app.widgets.custom_widgets import ( - GlassmorphicButton, - GlassmorphicMainWindow, - GlassmorphicStatusBar, + AppMainWindow, + AppStatusBar, SectionDivider, StyledLabel, ) @@ -58,14 +57,14 @@ LogsTab = None -class MainWindow(GlassmorphicMainWindow): +class MainWindow(AppMainWindow): def __init__(self): super().__init__() self._title_bar = None self.setWindowTitle("EncodeForge") - # Enable transparency for glassmorphism effect - self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground, False) # Keep opaque for now + # Frameless window stays opaque (flat dark theme; no translucent glass) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground, False) # Set proper window sizing with responsive constraints self.setMinimumSize(1000, 640) @@ -554,7 +553,7 @@ def _handle_add_folder(self): # -------------------- Status & callbacks -------------------- def _create_statusbar(self): - self.statusbar = GlassmorphicStatusBar() + self.statusbar = AppStatusBar() self.statusbar.setObjectName("app_bottom_bar") self.setStatusBar(self.statusbar) self.status_label = StyledLabel("Ready") diff --git a/app/splash_screen.py b/app/splash_screen.py index 6142738..ffee10b 100644 --- a/app/splash_screen.py +++ b/app/splash_screen.py @@ -9,7 +9,6 @@ from PySide6.QtWidgets import QWidget, QVBoxLayout, QLabel, QProgressBar from PySide6.QtCore import Qt, QTimer, Signal from PySide6.QtGui import QPixmap, QPalette, QColor, QFont -from pathlib import Path from utils.platform_fonts import ui_font @@ -96,25 +95,12 @@ def _setup_ui(self): layout.addStretch(1) def _load_styles(self): - """Load CSS styles for the splash screen.""" + """Load CSS styles for the splash screen from the shared token set.""" try: - from PySide6.QtCore import QFile, QTextStream - - css_file = Path(__file__).parent.parent / "resources" / "styles" / "splash_screen.css" - if css_file.exists(): - file = QFile(str(css_file)) - if file.open(QFile.OpenModeFlag.ReadOnly | QFile.OpenModeFlag.Text): - stream = QTextStream(file) - css_content = stream.readAll() - file.close() - - # Apply the CSS - self.setStyleSheet(css_content) - logger.debug("Splash screen styles loaded successfully") - else: - logger.warning("Failed to open splash_screen.css file") - else: - logger.warning("splash_screen.css file not found") + from utils.app_stylesheet import build_splash_stylesheet + + self.setStyleSheet(build_splash_stylesheet()) + logger.debug("Splash screen styles loaded successfully") except Exception as e: logger.error(f"Failed to load splash screen styles: {e}") diff --git a/app/widgets/custom_widgets.py b/app/widgets/custom_widgets.py index 78f9237..0e5f4b5 100644 --- a/app/widgets/custom_widgets.py +++ b/app/widgets/custom_widgets.py @@ -1,6 +1,6 @@ """ EncodeForge Custom Widget Library -Glassmorphic UI components — styling delegated to theme_base.css +Flat-dark UI components — styling delegated to theme_base.css / DesignTokens. """ from PySide6.QtCore import QSize, Qt @@ -10,7 +10,6 @@ QCheckBox, QComboBox, QFrame, - QGraphicsDropShadowEffect, QHBoxLayout, QHeaderView, QLabel, @@ -106,7 +105,7 @@ def enableDragDrop(self, drag_enter_callback=None, drop_callback=None): # CONTAINER WIDGETS # ============================================================================ -class GlassmorphicCard(QFrame): +class SectionCard(QFrame): """ Section title above a single rounded surface (styled in theme_base.css). Add children via content_layout() or add a QFormLayout with content_layout().addLayout(...). @@ -114,7 +113,7 @@ class GlassmorphicCard(QFrame): def __init__(self, title="", parent=None): super().__init__(parent) - self.setObjectName("glass_card") + self.setObjectName("section_card") self.setFrameShape(QFrame.Shape.NoFrame) self.setSizePolicy( QSizePolicy.Policy.Expanding, @@ -125,7 +124,7 @@ def __init__(self, title="", parent=None): root.setSpacing(0) if title: tl = QLabel(title) - tl.setObjectName("glass_card_title") + tl.setObjectName("section_card_title") tl.setSizePolicy( QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed, @@ -133,7 +132,7 @@ def __init__(self, title="", parent=None): root.addWidget(tl) root.setSpacing(8) self._body = QFrame() - self._body.setObjectName("glass_card_body") + self._body.setObjectName("section_card_body") self._body.setFrameShape(QFrame.Shape.NoFrame) self._body.setSizePolicy( QSizePolicy.Policy.Expanding, @@ -142,7 +141,6 @@ def __init__(self, title="", parent=None): self._body_layout = QVBoxLayout(self._body) self._body_layout.setContentsMargins(0, 0, 0, 0) root.addWidget(self._body, 1) - self.setGraphicsEffect(self._create_shadow()) def body(self) -> QFrame: return self._body @@ -150,19 +148,9 @@ def body(self) -> QFrame: def content_layout(self) -> QVBoxLayout: return self._body_layout - def _create_shadow(self): - shadow = QGraphicsDropShadowEffect() - shadow.setBlurRadius(18) - shadow.setColor(Qt.GlobalColor.black) - shadow.setOffset(0, 3) - return shadow - -class GlassmorphicPanel(QWidget): - """ - Generic panel — styling delegated to CSS. - Only sets shadow effect. - """ +class ContentPanel(QWidget): + """Generic expanding panel — styling delegated to CSS.""" def __init__(self, parent=None): super().__init__(parent) @@ -170,21 +158,13 @@ def __init__(self, parent=None): QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding ) - self.setGraphicsEffect(self._create_shadow()) - - def _create_shadow(self): - shadow = QGraphicsDropShadowEffect() - shadow.setBlurRadius(15) - shadow.setColor(Qt.GlobalColor.black) - shadow.setOffset(0, 2) - return shadow # ============================================================================ # BUTTON WIDGETS # ============================================================================ -class GlassmorphicButton(QPushButton): +class StyledButton(QPushButton): """ Button — styling via CSS QPushButton rules. Only enforces size constraints. @@ -218,7 +198,7 @@ def _setup_constraints(self): self.setMinimumWidth(28) -class PrimaryButton(GlassmorphicButton): +class PrimaryButton(StyledButton): """Accent-coloured primary action button (primary=true CSS property).""" def __init__(self, text="", icon=None, parent=None): @@ -360,7 +340,7 @@ def setHeading(self): # LAYOUT WIDGETS # ============================================================================ -class GlassmorphicToolBar(QToolBar): +class AppToolBar(QToolBar): """ Toolbar — styling via CSS QToolBar rules. Only enforces size constraints. @@ -375,7 +355,7 @@ def _setup_constraints(self): self.setIconSize(QSize(16, 16)) -class GlassmorphicStatusBar(QStatusBar): +class AppStatusBar(QStatusBar): """ Status bar — styling via CSS QStatusBar rules. Only enforces size constraints. @@ -394,10 +374,10 @@ def _setup_constraints(self): # WINDOW WIDGETS # ============================================================================ -class GlassmorphicMainWindow(QMainWindow): +class AppMainWindow(QMainWindow): """ Main window — background styling via CSS QMainWindow rule. - No inline stylesheet needed. + Frameless chrome; title bar is AppTitleBar. """ def __init__(self, parent=None): @@ -427,7 +407,7 @@ def __init__(self, spacing=8, parent=None): ) def addButton(self, text, icon=None, callback=None): - btn = GlassmorphicButton(text, icon) + btn = StyledButton(text, icon) if callback: btn.clicked.connect(callback) self.layout.addWidget(btn) @@ -474,9 +454,9 @@ def __init__(self, parent=None): __all__ = [ "AutoResizeTable", - "GlassmorphicCard", - "GlassmorphicPanel", - "GlassmorphicButton", + "SectionCard", + "ContentPanel", + "StyledButton", "PrimaryButton", "StyledComboBox", "StyledLineEdit", @@ -484,9 +464,9 @@ def __init__(self, parent=None): "StyledTextEdit", "StyledCheckBox", "StyledLabel", - "GlassmorphicToolBar", - "GlassmorphicStatusBar", - "GlassmorphicMainWindow", + "AppToolBar", + "AppStatusBar", + "AppMainWindow", "ButtonRow", "FormRow", "SectionDivider", diff --git a/app/widgets/encoder_tab.py b/app/widgets/encoder_tab.py index 1b3c8a2..4020876 100644 --- a/app/widgets/encoder_tab.py +++ b/app/widgets/encoder_tab.py @@ -36,8 +36,8 @@ from app.widgets.custom_widgets import ( AutoResizeTable, - GlassmorphicButton, - GlassmorphicCard, + StyledButton, + SectionCard, StyledCheckBox, StyledComboBox, StyledLabel, @@ -164,7 +164,7 @@ def _setup_ui(self): layout.addWidget(self._main_splitter) - logger.debug("Encoder tab initialized - using base glassmorphism theme") + logger.debug("Encoder tab initialized - using base flat dark theme") def _setup_video_settings(self, parent_layout): """Set up the top video settings panel with grid + compact control rows.""" @@ -231,9 +231,9 @@ def _setup_video_settings(self, parent_layout): self.profile_combo = StyledComboBox() self.profile_combo.setMinimumContentsLength(20) self.profile_combo.setMinimumWidth(160) - load_profile_btn = GlassmorphicButton("Load", qta.icon("fa5s.folder-open")) + load_profile_btn = StyledButton("Load", qta.icon("fa5s.folder-open")) load_profile_btn.setToolTip("Apply the selected profile to these encoder controls") - save_profile_btn = GlassmorphicButton("Save as…", qta.icon("fa5s.save")) + save_profile_btn = StyledButton("Save as…", qta.icon("fa5s.save")) save_profile_btn.setToolTip("Save current encoder options as a custom profile (JSON)") profile_row.addWidget(profile_label) profile_row.addWidget(self.profile_combo, 1) @@ -293,7 +293,7 @@ def _setup_video_settings(self, parent_layout): def _setup_tables_area(self, parent_layout): """Set up the single file table with all encoding states.""" # Main table container - table_group = GlassmorphicCard("Files") + table_group = SectionCard("Files") table_layout = table_group.content_layout() table_layout.setContentsMargins(0, 5, 0, 0) table_layout.setSpacing(8) @@ -319,32 +319,32 @@ def _setup_tables_area(self, parent_layout): table_layout.addWidget(self.files_table, 1) # Give table the stretch factor - # Table control buttons using glassmorphic buttons + # Table control buttons using styled buttons buttons_layout = QHBoxLayout() buttons_layout.setContentsMargins(0, 4, 0, 0) buttons_layout.setSpacing(8) - self.add_files_btn = GlassmorphicButton("Add Files", qta.icon('fa5s.plus')) + self.add_files_btn = StyledButton("Add Files", qta.icon('fa5s.plus')) self.add_files_btn.clicked.connect(lambda: self._add_files()) self.add_files_btn.setMinimumWidth(80) - self.add_folder_btn = GlassmorphicButton("Add Folder", qta.icon('fa5s.folder-plus')) + self.add_folder_btn = StyledButton("Add Folder", qta.icon('fa5s.folder-plus')) self.add_folder_btn.clicked.connect(lambda: self._add_folder()) self.add_folder_btn.setMinimumWidth(85) - self.remove_selected_btn = GlassmorphicButton("Remove Selected", qta.icon('fa5s.trash')) + self.remove_selected_btn = StyledButton("Remove Selected", qta.icon('fa5s.trash')) self.remove_selected_btn.clicked.connect(self._remove_selected_files) self.remove_selected_btn.setMinimumWidth(110) - self.clear_completed_btn = GlassmorphicButton("Clear Completed", qta.icon('fa5s.broom')) + self.clear_completed_btn = StyledButton("Clear Completed", qta.icon('fa5s.broom')) self.clear_completed_btn.clicked.connect(self._clear_completed_files) self.clear_completed_btn.setMinimumWidth(110) - self.queue_up_btn = GlassmorphicButton("Up", qta.icon("fa5s.arrow-up")) + self.queue_up_btn = StyledButton("Up", qta.icon("fa5s.arrow-up")) self.queue_up_btn.setToolTip("Move selected queued row up") self.queue_up_btn.clicked.connect(lambda: self._move_selected_queue(-1)) self.queue_up_btn.setMinimumWidth(52) - self.queue_down_btn = GlassmorphicButton("Down", qta.icon("fa5s.arrow-down")) + self.queue_down_btn = StyledButton("Down", qta.icon("fa5s.arrow-down")) self.queue_down_btn.setToolTip("Move selected queued row down") self.queue_down_btn.clicked.connect(lambda: self._move_selected_queue(1)) self.queue_down_btn.setMinimumWidth(68) @@ -378,7 +378,7 @@ def _setup_file_info_sidebar(self, splitter): sidebar_layout.addWidget(title_label) # Preview area - preview_group = GlassmorphicCard("Preview") + preview_group = SectionCard("Preview") preview_layout = preview_group.content_layout() self.preview_label = StyledLabel("No file selected") self.preview_label.setObjectName("preview_label") @@ -388,7 +388,7 @@ def _setup_file_info_sidebar(self, splitter): sidebar_layout.addWidget(preview_group) # File Information Section - file_group = GlassmorphicCard("File Details") + file_group = SectionCard("File Details") file_layout = QFormLayout() file_layout.setSpacing(6) file_layout.setContentsMargins(8, 12, 8, 8) @@ -409,7 +409,7 @@ def _setup_file_info_sidebar(self, splitter): sidebar_layout.addWidget(file_group) # Video Information Section - video_group = GlassmorphicCard("Video Properties") + video_group = SectionCard("Video Properties") video_layout = QFormLayout() video_layout.setSpacing(6) video_layout.setContentsMargins(8, 12, 8, 8) @@ -428,7 +428,7 @@ def _setup_file_info_sidebar(self, splitter): sidebar_layout.addWidget(video_group) # Audio Information Section - audio_group = GlassmorphicCard("Audio Properties") + audio_group = SectionCard("Audio Properties") audio_layout = QFormLayout() audio_layout.setSpacing(6) audio_layout.setContentsMargins(8, 12, 8, 8) diff --git a/app/widgets/logs_tab.py b/app/widgets/logs_tab.py index 88d18e4..5a68f9e 100644 --- a/app/widgets/logs_tab.py +++ b/app/widgets/logs_tab.py @@ -145,7 +145,7 @@ def _setup_ui(self): layout.addLayout(info_layout) - # Styling handled by base glassmorphism theme + # Styling handled by base flat dark theme def _setup_timer(self): """Set up timer for auto-refresh""" diff --git a/app/widgets/metadata_tab.py b/app/widgets/metadata_tab.py index 487716c..cf1f964 100644 --- a/app/widgets/metadata_tab.py +++ b/app/widgets/metadata_tab.py @@ -77,7 +77,7 @@ def __init__(self, thread_pool: QThreadPool, parent=None): self.refresh_providers() # A backup from a previous session's rename may still be undoable. self.undo_btn.setEnabled(bool(list_backups())) - logger.debug("Metadata tab initialized - using base glassmorphism theme") + logger.debug("Metadata tab initialized - using base flat dark theme") def _setup_ui(self): main_layout = QVBoxLayout(self) diff --git a/app/widgets/subtitle_tab.py b/app/widgets/subtitle_tab.py index 357953f..73fbbd6 100644 --- a/app/widgets/subtitle_tab.py +++ b/app/widgets/subtitle_tab.py @@ -29,7 +29,7 @@ from app.widgets.custom_widgets import ( AutoResizeTable, - GlassmorphicButton, + StyledButton, StyledComboBox, StyledLabel, StyledTextEdit, @@ -76,7 +76,7 @@ def __init__(self, thread_pool: QThreadPool, parent=None): self._setup_ui() self._update_whisper_status() self._update_subtitle_action_buttons() - logger.debug("Subtitle tab initialized - using base glassmorphism theme") + logger.debug("Subtitle tab initialized - using base flat dark theme") def showEvent(self, event): super().showEvent(event) @@ -218,11 +218,11 @@ def _setup_ui(self): # File management buttons under the file table file_btn_layout = QHBoxLayout() - self.add_files_btn = GlassmorphicButton("Add Files") + self.add_files_btn = StyledButton("Add Files") self.add_files_btn.clicked.connect(self._add_files) - self.add_folder_btn = GlassmorphicButton("Add Folder") + self.add_folder_btn = StyledButton("Add Folder") self.add_folder_btn.clicked.connect(self._add_folder) - self.remove_sub_btn = GlassmorphicButton("Remove") + self.remove_sub_btn = StyledButton("Remove") self.remove_sub_btn.clicked.connect(self._remove_selected) file_btn_layout.addWidget(self.add_files_btn) file_btn_layout.addWidget(self.add_folder_btn) diff --git a/app/widgets/update_toast.py b/app/widgets/update_toast.py index 96d9fac..bd209bf 100644 --- a/app/widgets/update_toast.py +++ b/app/widgets/update_toast.py @@ -5,7 +5,7 @@ from PySide6.QtCore import Qt, Signal from PySide6.QtWidgets import QFrame, QGraphicsDropShadowEffect, QHBoxLayout, QVBoxLayout -from app.widgets.custom_widgets import GlassmorphicButton, PrimaryButton, StyledLabel +from app.widgets.custom_widgets import StyledButton, PrimaryButton, StyledLabel class UpdateToast(QFrame): @@ -40,7 +40,7 @@ def __init__(self, parent=None): row = QHBoxLayout() row.setSpacing(8) - notes_btn = GlassmorphicButton("What's new") + notes_btn = StyledButton("What's new") notes_btn.clicked.connect(self.notes_clicked.emit) row.addWidget(notes_btn) @@ -48,7 +48,7 @@ def __init__(self, parent=None): dl_btn.clicked.connect(self.download_clicked.emit) row.addWidget(dl_btn) - later_btn = GlassmorphicButton("Later") + later_btn = StyledButton("Later") later_btn.clicked.connect(self.later_clicked.emit) row.addWidget(later_btn) diff --git a/docs/index.html b/docs/index.html index 964d46b..96b2aec 100644 --- a/docs/index.html +++ b/docs/index.html @@ -142,7 +142,7 @@

Encode, subtitle,
and organize your media

See it in action

-

These images show an older menu-bar layout. The current app uses a frameless sidebar chrome; screenshots will be refreshed in a later release.

+

Legacy captures — older menu-bar / three-table UI. The shipping app uses a frameless sidebar and a flat dark design system; refreshed screenshots will replace these.

diff --git a/docs/screenshots/README.md b/docs/screenshots/README.md new file mode 100644 index 0000000..6329d4d --- /dev/null +++ b/docs/screenshots/README.md @@ -0,0 +1,11 @@ +# Screenshots + +The PNGs in this folder (`encoding.png`, `subtitles.png`, `metadata.png`) are **legacy** captures of an older menu-bar / three-table layout. + +The current EncodeForge desktop UI (0.5.0 line) uses: + +- Frameless window with `AppTitleBar` +- Left sidebar navigation (Encoder, Subtitles, Metadata, Processes, Logs, Settings) +- Flat dark theme driven by `utils/design_tokens.py` + `resources/styles/theme_base.css` + +Project-site and README callouts mark these images as outdated until fresh captures of the sidebar chrome land. diff --git a/main.py b/main.py index 944de55..510d3b0 100644 --- a/main.py +++ b/main.py @@ -79,11 +79,11 @@ def main(): app.setApplicationVersion(APP_VERSION) app.setOrganizationName("EncodeForge") - # Load glassmorphism theme + # Load flat dark theme try: from utils.theme_manager import load_theme if load_theme(): - logger.info("Glassmorphism theme loaded successfully") + logger.info("Flat dark theme loaded successfully") else: logger.warning("Failed to load theme, using default styling") except Exception as e: diff --git a/resources/styles/splash_screen.css b/resources/styles/splash_screen.css index 618348e..286a8d6 100644 --- a/resources/styles/splash_screen.css +++ b/resources/styles/splash_screen.css @@ -1,34 +1,34 @@ -/* Splash — flat dark theme */ +/* Splash — flat dark theme (DesignTokens placeholders) */ QWidget { - background-color: #1a1a1a; - border: 1px solid #2e2e2e; - border-radius: 4px; - color: #cccccc; + background-color: __bg_base__; + border: 1px solid __border_subtle__; + border-radius: __radius_md__; + color: __text_primary__; } QLabel#title_label { - color: #cccccc; + color: __text_primary__; background: transparent; } QLabel#version_label { - color: #6e6e6e; + color: __text_muted__; background: transparent; } QLabel#status_label { - color: #9d9d9d; + color: __text_secondary__; background: transparent; } QLabel#tagline_label { - color: #6e6e6e; + color: __text_muted__; background: transparent; } QProgressBar { - background: #252526; + background: __bg_elevated__; border: none; border-radius: 2px; min-height: 3px; @@ -36,6 +36,6 @@ QProgressBar { } QProgressBar::chunk { - background: #6366f1; + background: __accent__; border-radius: 2px; } diff --git a/resources/styles/theme_base.css b/resources/styles/theme_base.css index bc0a322..cfe26f1 100644 --- a/resources/styles/theme_base.css +++ b/resources/styles/theme_base.css @@ -1,23 +1,24 @@ /* ======================================== ENCODEFORGE — FLAT DARK THEME + Colors/radii from DesignTokens via named placeholders (double-underscore). ======================================== */ /* ─── BASE ─────────────────────────────── */ QMainWindow { - background: #1a1a1a; + background: __bg_base__; } QDialog, QMessageBox { - background: #252526; - border: 1px solid #3e3e42; - border-radius: 4px; + background: __bg_elevated__; + border: 1px solid __border_strong__; + border-radius: __radius_md__; } QWidget { background-color: transparent; - color: #cccccc; - font-size: 12px; + color: __text_primary__; + font-size: __font_ui_size__; /* Windows → macOS → Linux common UI faces; Qt picks the first installed. */ font-family: "Segoe UI", ".AppleSystemUIFont", "SF Pro Text", "Helvetica Neue", "Ubuntu", "Noto Sans", "DejaVu Sans", sans-serif; @@ -26,12 +27,12 @@ QWidget { /* ─── SIDEBAR ───────────────────────────── */ QFrame#sidebar { - background: #1e1e1e; - border-right: 1px solid #2e2e2e; + background: __bg_sidebar__; + border-right: 1px solid __border_subtle__; } QLabel#section_label { - color: #6e6e6e; + color: __text_muted__; font-size: 9px; font-weight: 700; letter-spacing: 1.2px; @@ -44,121 +45,121 @@ QLabel#section_label { QToolButton { background: transparent; border: 1px solid transparent; - border-radius: 3px; + border-radius: __radius_sm__; padding: 6px 10px; - color: #9d9d9d; - font-size: 12px; + color: __text_secondary__; + font-size: __font_ui_size__; font-weight: 400; text-align: left; } QToolButton:hover { background: #2a2d2e; - color: #cccccc; + color: __text_primary__; border: 1px solid transparent; } QToolButton:checked { background: #2a2d2e; - border-left: 2px solid #6366f1; - color: #cccccc; + border-left: 2px solid __accent__; + color: __text_primary__; font-weight: 600; } QToolButton:pressed { - background: #37373d; + background: __bg_hover__; } /* ─── PUSH BUTTONS ──────────────────────── */ QPushButton { - background: #2d2d2d; - border: 1px solid #3e3e42; - border-radius: 3px; + background: __bg_control__; + border: 1px solid __border_strong__; + border-radius: __radius_sm__; padding: 5px 14px; - color: #cccccc; - font-size: 12px; + color: __text_primary__; + font-size: __font_ui_size__; font-weight: 500; min-height: 28px; } QPushButton:hover { - background: #37373d; - border-color: #4e4e52; + background: __bg_hover__; + border-color: __border_muted__; } QPushButton:pressed { - background: #252526; - border-color: #3e3e42; + background: __bg_pressed__; + border-color: __border_strong__; } QPushButton:disabled { - background: #252526; - border: 1px solid #2e2e2e; - color: #4e4e52; + background: __bg_elevated__; + border: 1px solid __border_subtle__; + color: __text_disabled__; } /* Primary accent button */ QPushButton[primary="true"] { - background: #6366f1; - border: 1px solid #6366f1; - color: #ffffff; + background: __accent__; + border: 1px solid __accent__; + color: __text_on_accent__; font-weight: 600; } QPushButton[primary="true"]:hover { - background: #7577f3; - border-color: #7577f3; + background: __accent_hover__; + border-color: __accent_hover__; } QPushButton[primary="true"]:pressed { - background: #5254cc; - border-color: #5254cc; + background: __accent_pressed__; + border-color: __accent_pressed__; } QPushButton[primary="true"]:disabled { - background: rgba(99,102,241,0.25); - border-color: rgba(99,102,241,0.20); + background: __accent_soft__; + border-color: __accent_soft_border__; color: rgba(255,255,255,0.30); } /* Danger button */ QPushButton[danger="true"] { - background: #2d2d2d; - border: 1px solid #6e3e3e; - color: #f47272; + background: __bg_control__; + border: 1px solid __border_danger__; + color: __text_danger__; } QPushButton[danger="true"]:hover { - background: #3a2626; - border-color: #8e4e4e; + background: __bg_danger_hover__; + border-color: __border_danger_hover__; } /* ─── COMBO BOX ─────────────────────────── */ QComboBox { - background: #252526; - border: 1px solid #3e3e42; - border-radius: 3px; + background: __bg_elevated__; + border: 1px solid __border_strong__; + border-radius: __radius_sm__; padding: 3px 28px 3px 9px; - color: #cccccc; - font-size: 11px; - min-height: 24px; + color: __text_primary__; + font-size: __font_compact__; + min-height: __control_min_height__; selection-background-color: transparent; } QComboBox:hover { - border-color: #4e4e52; + border-color: __border_muted__; } QComboBox:focus { - border-color: #6366f1; + border-color: __accent__; } QComboBox:disabled { - background: #1e1e1e; - border-color: #2e2e2e; - color: #4e4e52; + background: __bg_sidebar__; + border-color: __border_subtle__; + color: __text_disabled__; } QComboBox::drop-down { @@ -173,16 +174,16 @@ QComboBox::down-arrow { image: none; border-left: 4px solid transparent; border-right: 4px solid transparent; - border-top: 5px solid #9d9d9d; + border-top: 5px solid __text_secondary__; width: 0; height: 0; margin-right: 6px; } QComboBox QAbstractItemView { - background: #252526; - border: 1px solid #3e3e42; - border-radius: 3px; + background: __bg_elevated__; + border: 1px solid __border_strong__; + border-radius: __radius_sm__; padding: 3px; outline: none; selection-background-color: transparent; @@ -191,127 +192,127 @@ QComboBox QAbstractItemView { QComboBox QAbstractItemView::item { padding: 5px 10px; border-radius: 2px; - color: #cccccc; + color: __text_primary__; min-height: 22px; } QComboBox QAbstractItemView::item:hover { - background: #37373d; + background: __bg_hover__; } QComboBox QAbstractItemView::item:selected { - background: rgba(99,102,241,0.30); - color: #ffffff; + background: __accent_soft__; + color: __text_on_accent__; } /* ─── LINE EDIT ─────────────────────────── */ QLineEdit { - background: #252526; - border: 1px solid #3e3e42; - border-radius: 3px; + background: __bg_elevated__; + border: 1px solid __border_strong__; + border-radius: __radius_sm__; padding: 3px 9px; - color: #cccccc; - font-size: 11px; - min-height: 24px; - selection-background-color: rgba(99,102,241,0.40); + color: __text_primary__; + font-size: __font_compact__; + min-height: __control_min_height__; + selection-background-color: __accent_selection_strong__; } QLineEdit:focus { - border-color: #6366f1; + border-color: __accent__; } QLineEdit:disabled { - background: #1e1e1e; - border-color: #2e2e2e; - color: #4e4e52; + background: __bg_sidebar__; + border-color: __border_subtle__; + color: __text_disabled__; } /* Placeholder text color (PySide6 / Qt6) */ QLineEdit[placeholderText] { - color: #cccccc; + color: __text_primary__; } /* ─── SPIN BOX ──────────────────────────── */ QSpinBox { - background: #252526; - border: 1px solid #3e3e42; - border-radius: 3px; + background: __bg_elevated__; + border: 1px solid __border_strong__; + border-radius: __radius_sm__; padding: 3px 9px; - color: #cccccc; - font-size: 11px; - min-height: 24px; + color: __text_primary__; + font-size: __font_compact__; + min-height: __control_min_height__; } QSpinBox:focus { - border-color: #6366f1; + border-color: __accent__; } QSpinBox::up-button, QSpinBox::down-button { - background: #2d2d2d; + background: __bg_control__; border: none; - border-left: 1px solid #3e3e42; + border-left: 1px solid __border_strong__; width: 18px; margin: 0px; } QSpinBox::up-button:hover, QSpinBox::down-button:hover { - background: #37373d; + background: __bg_hover__; } QSpinBox::up-arrow { image: none; border-left: 3px solid transparent; border-right: 3px solid transparent; - border-bottom: 4px solid #9d9d9d; + border-bottom: 4px solid __text_secondary__; } QSpinBox::down-arrow { image: none; border-left: 3px solid transparent; border-right: 3px solid transparent; - border-top: 4px solid #9d9d9d; + border-top: 4px solid __text_secondary__; } /* ─── TEXT EDIT ─────────────────────────── */ QTextEdit, QPlainTextEdit { - background: #1e1e1e; - border: 1px solid #2e2e2e; - border-radius: 3px; + background: __bg_sidebar__; + border: 1px solid __border_subtle__; + border-radius: __radius_sm__; padding: 6px 8px; - color: #cccccc; - font-size: 12px; - selection-background-color: rgba(99,102,241,0.40); + color: __text_primary__; + font-size: __font_ui_size__; + selection-background-color: __accent_selection_strong__; } QTextEdit:focus, QPlainTextEdit:focus { - border-color: #6366f1; + border-color: __accent__; } /* ─── CHECKBOX ──────────────────────────── */ QCheckBox { - spacing: 8px; - color: #cccccc; - font-size: 12px; + spacing: __space_sm__; + color: __text_primary__; + font-size: __font_ui_size__; } QCheckBox:disabled { - color: #4e4e52; + color: __text_disabled__; } -/* ─── SECTION CARD (replaces glass_card) ── */ +/* ─── SECTION CARD ──────────────────────── */ -QFrame#glass_card { +QFrame#section_card { background: transparent; border: none; } -QLabel#glass_card_title { - color: #9d9d9d; - font-size: 11px; +QLabel#section_card_title { + color: __text_secondary__; + font-size: __font_compact__; font-weight: 600; letter-spacing: 0.4px; padding: 0 2px; @@ -320,23 +321,23 @@ QLabel#glass_card_title { text-transform: uppercase; } -QFrame#glass_card_body { - background: #252526; - border: 1px solid #2e2e2e; - border-radius: 4px; +QFrame#section_card_body { + background: __bg_elevated__; + border: 1px solid __border_subtle__; + border-radius: __radius_md__; } /* ─── GROUP BOX ─────────────────────────── */ QGroupBox { - background: #252526; - border: 1px solid #2e2e2e; - border-radius: 4px; + background: __bg_elevated__; + border: 1px solid __border_subtle__; + border-radius: __radius_md__; padding: 18px 12px 10px 12px; margin-top: 16px; - font-size: 11px; + font-size: __font_compact__; font-weight: 600; - color: #9d9d9d; + color: __text_secondary__; } QGroupBox::title { @@ -347,8 +348,8 @@ QGroupBox::title { padding: 0 4px; background: transparent; border: none; - color: #9d9d9d; - font-size: 11px; + color: __text_secondary__; + font-size: __font_compact__; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; @@ -359,15 +360,15 @@ QGroupBox::title { QTableWidget { background: transparent; border: none; - gridline-color: #2e2e2e; + gridline-color: __border_subtle__; alternate-background-color: rgba(255,255,255,0.015); - selection-background-color: rgba(99,102,241,0.22); + selection-background-color: __accent_selection__; outline: none; } QTableWidget::item { padding: 3px 8px; - color: #cccccc; + color: __text_primary__; border: none; } @@ -376,8 +377,8 @@ QTableWidget::item:hover { } QTableWidget::item:selected { - background: rgba(99,102,241,0.22); - color: #ffffff; + background: __accent_selection__; + color: __text_on_accent__; } QHeaderView { @@ -385,12 +386,12 @@ QHeaderView { } QHeaderView::section { - background: #1e1e1e; - color: #6e6e6e; + background: __bg_sidebar__; + color: __text_muted__; padding: 4px 8px; border: none; - border-right: 1px solid #2e2e2e; - border-bottom: 1px solid #2e2e2e; + border-right: 1px solid __border_subtle__; + border-bottom: 1px solid __border_subtle__; font-size: 10px; font-weight: 600; letter-spacing: 0.4px; @@ -404,9 +405,9 @@ QHeaderView::section:last { /* ─── LIST WIDGET ───────────────────────── */ QListWidget { - background: #1e1e1e; - border: 1px solid #2e2e2e; - border-radius: 3px; + background: __bg_sidebar__; + border: 1px solid __border_subtle__; + border-radius: __radius_sm__; padding: 2px; outline: none; } @@ -414,7 +415,7 @@ QListWidget { QListWidget::item { padding: 5px 10px; border-radius: 2px; - color: #cccccc; + color: __text_primary__; min-height: 20px; } @@ -423,8 +424,8 @@ QListWidget::item:hover { } QListWidget::item:selected { - background: rgba(99,102,241,0.25); - color: #ffffff; + background: __accent_soft__; + color: __text_on_accent__; } /* ─── SCROLLBARS ────────────────────────── */ @@ -436,8 +437,8 @@ QScrollBar:vertical { } QScrollBar::handle:vertical { - background: #3e3e42; - border-radius: 3px; + background: __border_strong__; + border-radius: __radius_sm__; min-height: 24px; } @@ -446,7 +447,7 @@ QScrollBar::handle:vertical:hover { } QScrollBar::handle:vertical:pressed { - background: #6366f1; + background: __accent__; } QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { @@ -462,8 +463,8 @@ QScrollBar:horizontal { } QScrollBar::handle:horizontal { - background: #3e3e42; - border-radius: 3px; + background: __border_strong__; + border-radius: __radius_sm__; min-width: 24px; } @@ -485,7 +486,7 @@ QScrollBar::add-page, QScrollBar::sub-page { QTabWidget::pane { background: transparent; - border: 1px solid #2e2e2e; + border: 1px solid __border_subtle__; border-radius: 0px; margin-top: -1px; } @@ -500,45 +501,45 @@ QTabBar::tab { border-bottom: 2px solid transparent; padding: 6px 16px; margin: 0px 2px 0px 0px; - color: #9d9d9d; - font-size: 12px; + color: __text_secondary__; + font-size: __font_ui_size__; font-weight: 400; } QTabBar::tab:selected { background: transparent; - border-bottom: 2px solid #6366f1; - color: #cccccc; + border-bottom: 2px solid __accent__; + color: __text_primary__; font-weight: 600; } QTabBar::tab:hover { background: #2a2d2e; - color: #cccccc; + color: __text_primary__; } /* ─── PROGRESS BAR ──────────────────────── */ QProgressBar { - background: #252526; - border: 1px solid #2e2e2e; + background: __bg_elevated__; + border: 1px solid __border_subtle__; border-radius: 2px; text-align: center; - color: #9d9d9d; + color: __text_secondary__; font-size: 10px; min-height: 8px; max-height: 14px; } QProgressBar::chunk { - background: #6366f1; + background: __accent__; border-radius: 2px; } /* ─── SPLITTER ──────────────────────────── */ QSplitter::handle { - background: #2e2e2e; + background: __border_subtle__; } QSplitter::handle:horizontal { @@ -552,15 +553,15 @@ QSplitter::handle:vertical { } QSplitter::handle:hover { - background: #6366f1; + background: __accent__; } /* ─── MENUS ─────────────────────────────── */ QMenu { - background: #252526; - border: 1px solid #3e3e42; - border-radius: 4px; + background: __bg_elevated__; + border: 1px solid __border_strong__; + border-radius: __radius_md__; padding: 4px; } @@ -568,44 +569,44 @@ QMenu::item { background: transparent; padding: 5px 14px; border-radius: 2px; - color: #cccccc; - font-size: 12px; + color: __text_primary__; + font-size: __font_ui_size__; } QMenu::item:selected { - background: #37373d; + background: __bg_hover__; } QMenu::item:disabled { - color: #4e4e52; + color: __text_disabled__; } QMenu::separator { height: 1px; - background: #2e2e2e; + background: __border_subtle__; margin: 3px 6px; } /* ─── TOOLTIPS ──────────────────────────── */ QToolTip { - background: #252526; - border: 1px solid #3e3e42; - border-radius: 3px; - color: #cccccc; + background: __bg_elevated__; + border: 1px solid __border_strong__; + border-radius: __radius_sm__; + color: __text_primary__; padding: 4px 8px; - font-size: 11px; + font-size: __font_compact__; } /* ─── STATUS BAR ────────────────────────── */ QStatusBar { - background: #111111; - border-top: 1px solid #2e2e2e; - color: #6e6e6e; - font-size: 11px; - padding: 2px 12px; - min-height: 24px; + background: __bg_elevated2__; + border-top: 1px solid __border_subtle__; + color: __text_muted__; + font-size: __font_small__; + padding: 2px __space_md__; + min-height: __bottom_bar_height__; } QStatusBar::item { @@ -621,14 +622,14 @@ QSizeGrip { /* ─── TOOLBAR ───────────────────────────── */ QToolBar { - background: #1e1e1e; - border-bottom: 1px solid #2e2e2e; + background: __bg_sidebar__; + border-bottom: 1px solid __border_subtle__; spacing: 4px; padding: 4px 8px; } QToolBar::separator { - background: #2e2e2e; + background: __border_subtle__; width: 1px; margin: 4px 6px; } @@ -636,13 +637,13 @@ QToolBar::separator { /* ─── SLIDER ────────────────────────────── */ QSlider::groove:horizontal { - background: #3e3e42; + background: __border_strong__; height: 3px; border-radius: 1px; } QSlider::handle:horizontal { - background: #cccccc; + background: __text_primary__; width: 12px; height: 12px; margin: -5px 0px; @@ -650,25 +651,25 @@ QSlider::handle:horizontal { } QSlider::handle:horizontal:hover { - background: #6366f1; + background: __accent__; } QSlider::sub-page:horizontal { - background: #6366f1; + background: __accent__; border-radius: 1px; } /* ─── ENCODER TOOLBAR ───────────────────── */ QWidget#encoder_toolbar { - background: #1e1e1e; - border-bottom: 1px solid #2e2e2e; + background: __bg_sidebar__; + border-bottom: 1px solid __border_subtle__; } /* ─── UPDATE TOAST ───────────────────────── */ QFrame#update_toast { - background: #252526; - border: 1px solid rgba(99, 102, 241, 0.50); - border-radius: 4px; + background: __bg_elevated__; + border: 1px solid __accent_border__; + border-radius: __radius_md__; } diff --git a/tests/test_design_tokens.py b/tests/test_design_tokens.py new file mode 100644 index 0000000..f8f1d18 --- /dev/null +++ b/tests/test_design_tokens.py @@ -0,0 +1,40 @@ +"""Design system: single token set drives theme CSS.""" + +from __future__ import annotations + +from utils.app_stylesheet import ( + apply_token_placeholders, + build_app_stylesheet, + build_splash_stylesheet, +) +from utils.design_tokens import THEME_NAME, default_tokens + + +def test_default_tokens_are_flat_dark_not_purple(): + t = default_tokens() + assert THEME_NAME == "flat_dark" + assert t.accent.lower() == "#3b82f6" + assert "99,102,241" not in t.accent_soft # old indigo soft + assert t.bg_base.startswith("#") + + +def test_theme_base_placeholders_fully_substituted(): + css = build_app_stylesheet(default_tokens()) + assert "__accent__" not in css + assert "__bg_base__" not in css + assert "#3b82f6" in css + assert "section_card" in css + assert "glass_card" not in css + assert "#6366f1" not in css + + +def test_splash_stylesheet_uses_same_accent(): + css = build_splash_stylesheet(default_tokens()) + assert "__accent__" not in css + assert default_tokens().accent in css + + +def test_apply_token_placeholders_roundtrip(): + sample = "color: __accent__; bg: __bg_base__;" + out = apply_token_placeholders(sample, default_tokens()) + assert out == f"color: {default_tokens().accent}; bg: {default_tokens().bg_base};" diff --git a/utils/app_stylesheet.py b/utils/app_stylesheet.py index dee463e..d88ab29 100644 --- a/utils/app_stylesheet.py +++ b/utils/app_stylesheet.py @@ -2,7 +2,7 @@ from pathlib import Path -from utils.design_tokens import DesignTokens +from utils.design_tokens import DesignTokens, default_tokens def _project_root() -> Path: @@ -13,7 +13,20 @@ def _theme_base_path() -> Path: return _project_root() / "resources" / "styles" / "theme_base.css" +def _splash_path() -> Path: + return _project_root() / "resources" / "styles" / "splash_screen.css" + + +def apply_token_placeholders(css: str, tokens: DesignTokens) -> str: + """Replace ``__token_name__`` placeholders with values from the token set.""" + out = css + for key, value in tokens.as_mapping().items(): + out = out.replace(f"__{key}__", value) + return out + + def build_app_stylesheet(tokens: DesignTokens) -> str: + """Compose the flat-dark app stylesheet from theme_base.css + chrome overlay.""" base_path = _theme_base_path() with open(base_path, "r", encoding="utf-8") as f: base = f.read() @@ -55,7 +68,7 @@ def build_app_stylesheet(tokens: DesignTokens) -> str: }} QToolButton#titlebar_control:hover {{ - background: #37373d; + background: {t.bg_hover}; border: 1px solid transparent; color: {t.text_primary}; }} @@ -74,7 +87,7 @@ def build_app_stylesheet(tokens: DesignTokens) -> str: }} QToolButton#titlebar_menu:hover {{ - background: #37373d; + background: {t.bg_hover}; color: {t.text_primary}; }} @@ -188,23 +201,23 @@ def build_app_stylesheet(tokens: DesignTokens) -> str: width: 15px; height: 15px; border-radius: 3px; - background: #252526; - border: 1.5px solid #4e4e52; + background: {t.bg_elevated}; + border: 1.5px solid {t.border_muted}; }} QCheckBox::indicator:hover {{ - border-color: #7577f3; + border-color: {t.accent_hover}; }} QCheckBox::indicator:checked {{ - background: #6366f1; - border-color: #6366f1; + background: {t.accent}; + border-color: {t.accent}; image: url({check_svg}); }} QCheckBox::indicator:disabled {{ - background: #1e1e1e; - border-color: #2e2e2e; + background: {t.bg_sidebar}; + border-color: {t.border_subtle}; }} QToolButton#statusbar_indicator {{ @@ -224,11 +237,11 @@ def build_app_stylesheet(tokens: DesignTokens) -> str: }} QToolButton#statusbar_indicator[status="ok"] {{ - color: #7a9e7a; + color: {t.status_ok}; }} QToolButton#statusbar_indicator[status="warn"] {{ - color: #9e8a6a; + color: {t.status_warn}; }} QTabBar::tab {{ @@ -251,4 +264,12 @@ def build_app_stylesheet(tokens: DesignTokens) -> str: color: {t.text_secondary}; }} """ - return base.rstrip() + "\n" + overlay + return apply_token_placeholders(base, tokens).rstrip() + "\n" + overlay + + +def build_splash_stylesheet(tokens: DesignTokens | None = None) -> str: + """Splash CSS with the same token set as the main app theme.""" + t = tokens if tokens is not None else default_tokens() + path = _splash_path() + with open(path, "r", encoding="utf-8") as f: + return apply_token_placeholders(f.read(), t) diff --git a/utils/design_tokens.py b/utils/design_tokens.py index 8f82b7f..64e4469 100644 --- a/utils/design_tokens.py +++ b/utils/design_tokens.py @@ -1,20 +1,56 @@ from __future__ import annotations -from dataclasses import dataclass +from dataclasses import asdict, dataclass @dataclass(frozen=True) class DesignTokens: + """Single source of truth for the flat-dark desktop theme.""" + + # Surfaces bg_base: str bg_elevated: str bg_elevated2: str + bg_sidebar: str + bg_control: str + bg_hover: str + bg_pressed: str + bg_input: str + bg_danger_hover: str + + # Borders border_subtle: str border_strong: str + border_muted: str + border_danger: str + border_danger_hover: str + + # Accent (steel blue — media-tool, not purple/glow) accent: str + accent_hover: str + accent_pressed: str accent_soft: str + accent_soft_border: str + accent_selection: str + accent_selection_strong: str + accent_border: str + + # Text text_primary: str text_secondary: str text_muted: str + text_disabled: str + text_on_accent: str + text_danger: str + + # Status + success: str + warning: str + error: str + status_ok: str + status_warn: str + + # Radii / spacing / type / chrome radius_sm: str radius_md: str radius_lg: str @@ -24,24 +60,54 @@ class DesignTokens: space_lg: str font_ui_size: str font_small: str + font_compact: str control_min_height: str title_bar_height: str bottom_bar_height: str - font_compact: str + + def as_mapping(self) -> dict[str, str]: + return asdict(self) + + +THEME_NAME = "flat_dark" def default_tokens() -> DesignTokens: + """Flat dark palette for EncodeForge desktop chrome.""" return DesignTokens( bg_base="#1a1a1a", bg_elevated="#252526", bg_elevated2="#111111", + bg_sidebar="#1e1e1e", + bg_control="#2d2d2d", + bg_hover="#37373d", + bg_pressed="#252526", + bg_input="#1e1e1e", + bg_danger_hover="#3a2626", border_subtle="#2e2e2e", border_strong="#3e3e42", - accent="#6366f1", - accent_soft="rgba(99,102,241,0.25)", + border_muted="#4e4e52", + border_danger="#6e3e3e", + border_danger_hover="#8e4e4e", + accent="#3b82f6", + accent_hover="#60a5fa", + accent_pressed="#2563eb", + accent_soft="rgba(59,130,246,0.25)", + accent_soft_border="rgba(59,130,246,0.20)", + accent_selection="rgba(59,130,246,0.22)", + accent_selection_strong="rgba(59,130,246,0.40)", + accent_border="rgba(59,130,246,0.50)", text_primary="#cccccc", text_secondary="#9d9d9d", text_muted="#6e6e6e", + text_disabled="#4e4e52", + text_on_accent="#ffffff", + text_danger="#f47272", + success="#4ade80", + warning="#fbbf24", + error="#f87171", + status_ok="#7a9e7a", + status_warn="#9e8a6a", radius_sm="3px", radius_md="4px", radius_lg="6px", @@ -51,8 +117,8 @@ def default_tokens() -> DesignTokens: space_lg="16px", font_ui_size="12px", font_small="11px", + font_compact="11px", control_min_height="24px", title_bar_height="30px", bottom_bar_height="24px", - font_compact="11px", ) diff --git a/utils/theme_manager.py b/utils/theme_manager.py index f11f8a7..921ff12 100644 --- a/utils/theme_manager.py +++ b/utils/theme_manager.py @@ -9,8 +9,8 @@ from PySide6.QtWidgets import QApplication -from utils.app_stylesheet import build_app_stylesheet -from utils.design_tokens import default_tokens +from utils.app_stylesheet import build_app_stylesheet, build_splash_stylesheet +from utils.design_tokens import THEME_NAME, default_tokens logger = logging.getLogger(__name__) @@ -29,13 +29,14 @@ def __new__(cls): def __init__(self): if not hasattr(self, 'initialized'): self.initialized = True - self.current_theme = "glassmorphism" + self.current_theme = THEME_NAME self.styles_dir = Path(__file__).parent.parent / "resources" / "styles" self.loaded_styles = {} + self._tokens = default_tokens() def load_base_theme(self) -> bool: """ - Load the base glassmorphism theme for the entire application. + Load the flat-dark theme for the entire application. Returns: True if successful, False otherwise @@ -46,14 +47,15 @@ def load_base_theme(self) -> bool: logger.warning(f"Base theme file not found: {theme_file}") return False - tokens = default_tokens() - css = build_app_stylesheet(tokens) + self._tokens = default_tokens() + css = build_app_stylesheet(self._tokens) app = QApplication.instance() if app: app.setStyleSheet(css) self.loaded_styles["base"] = css ThemeManager._styles_loaded = True - logger.info("Base glassmorphism theme loaded successfully") + self.current_theme = THEME_NAME + logger.info("Flat dark theme loaded successfully") return True logger.error("Failed to build base theme stylesheet") @@ -87,6 +89,8 @@ def load_component_style(self, component_name: str, widget=None) -> Optional[str css = self._read_css_file(css_file) if css: + if component_name == "splash_screen": + css = build_splash_stylesheet(self._tokens) self.loaded_styles[component_name] = css if widget: widget.setStyleSheet(css) @@ -141,15 +145,15 @@ def get_accent_color() -> str: @staticmethod def get_success_color() -> str: - return "#4ade80" + return default_tokens().success @staticmethod def get_warning_color() -> str: - return "#fbbf24" + return default_tokens().warning @staticmethod def get_error_color() -> str: - return "#f87171" + return default_tokens().error @staticmethod def configure_table_columns(table_widget) -> None: