From 290d650f80600aa0e8d6b745113c5e60d5377b12 Mon Sep 17 00:00:00 2001 From: benya Date: Sat, 18 Apr 2026 23:27:22 +0300 Subject: [PATCH] Respect system GTK theme --- whipper/gui.py | 84 -------------------------------------------------- 1 file changed, 84 deletions(-) diff --git a/whipper/gui.py b/whipper/gui.py index a10d2de..6254c68 100644 --- a/whipper/gui.py +++ b/whipper/gui.py @@ -152,10 +152,8 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): window.set_icon_name("com.github.whipper_team.Whipper") window.set_default_size(1380, 900) window.set_border_width(8) - self._install_css() root = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8) - root.get_style_context().add_class("eac-shell") window.add(root) root.pack_start(self._build_transport_strip(), False, False, 0) @@ -168,78 +166,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): window.show_all() return window - @staticmethod - def _install_css(): - provider = Gtk.CssProvider() - provider.load_from_data( - b""" - .eac-shell { - background: #d9d9d9; - } - frame > border { - border: 1px solid #8a8a8a; - border-radius: 0; - background: #ececec; - padding: 4px; - } - frame > label { - color: #1f1f1f; - font-weight: 700; - letter-spacing: 0.04em; - } - .eac-toolbar { - background: linear-gradient(to bottom, #f7f7f7, #d8d8d8); - border: 1px solid #8a8a8a; - padding: 6px; - } - .eac-toolbar button { - border-radius: 0; - padding: 4px 10px; - background: linear-gradient(to bottom, #fefefe, #dbdbdb); - border: 1px solid #7e7e7e; - color: #111111; - } - .eac-toolbar button.suggested-action { - background: linear-gradient(to bottom, #e5f2ff, #b7d4f3); - } - .eac-toolbar button.destructive-action { - background: linear-gradient(to bottom, #fbe7e7, #e7b7b7); - } - .eac-matrix, - .eac-log { - background: #fcfcfc; - color: #121212; - border: 1px solid #919191; - } - .eac-log text { - background: #fcfcfc; - color: #111111; - font: 10pt Monospace; - } - .eac-status { - font-weight: 700; - } - .eac-subtle { - color: #4c4c4c; - } - progressbar trough { - min-height: 16px; - border-radius: 0; - background: #cfcfcf; - border: 1px solid #8e8e8e; - } - progressbar progress { - border-radius: 0; - background: linear-gradient(to bottom, #8fc2f3, #4f84b6); - } - """ - ) - Gtk.StyleContext.add_provider_for_screen( - Gtk.Window().get_screen(), - provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION, - ) - def _build_transport_strip(self): frame = Gtk.Frame(label="Extraction Control Center") box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8, margin=8) @@ -305,7 +231,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): def _build_actions(self): box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8) - box.get_style_context().add_class("eac-toolbar") self.read_button = Gtk.Button(label="Detect TOC") self.read_button.connect("clicked", self._on_read_clicked) @@ -316,14 +241,12 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): self.rip_button.connect("clicked", self._on_rip_clicked) self.rip_button.set_tooltip_text("Rip the current disc using the selected release metadata") self.rip_button.set_sensitive(False) - self.rip_button.get_style_context().add_class("suggested-action") box.pack_start(self.rip_button, False, False, 0) self.stop_button = Gtk.Button(label="Abort") self.stop_button.connect("clicked", self._on_stop_clicked) self.stop_button.set_tooltip_text("Cancel the current scan or rip") self.stop_button.set_sensitive(False) - self.stop_button.get_style_context().add_class("destructive-action") box.pack_start(self.stop_button, False, False, 0) box.pack_start(Gtk.Separator(orientation=Gtk.Orientation.VERTICAL), False, False, 6) @@ -332,7 +255,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): label="EAC-style flow: Detect TOC -> pick release -> Secure Rip", xalign=0, ) - action_hint.get_style_context().add_class("eac-subtle") box.pack_start(action_hint, True, True, 0) return box @@ -342,7 +264,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): frame.add(box) self.progress_label = Gtk.Label(label="No task running", xalign=0) - self.progress_label.get_style_context().add_class("eac-status") box.pack_start(self.progress_label, False, False, 0) self.overall_bar = Gtk.ProgressBar(show_text=True) @@ -403,7 +324,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): self.release_view.set_enable_search(False) self.release_view.set_fixed_height_mode(True) self.release_view.set_grid_lines(Gtk.TreeViewGridLines.BOTH) - self.release_view.get_style_context().add_class("eac-matrix") self.release_view.get_selection().connect("changed", self._on_release_selected) for index, title in enumerate(["Artist", "Title", "Year", "Type", "Country"]): renderer = Gtk.CellRendererText() @@ -429,7 +349,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): self.release_details = Gtk.Label(label="Select a release to inspect it.", xalign=0, yalign=0) self.release_details.set_line_wrap(True) self.release_details.set_selectable(True) - self.release_details.get_style_context().add_class("eac-subtle") details_scroll.add(self.release_details) release_box.pack_start(details_frame, False, False, 0) @@ -460,7 +379,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): self.track_view.set_enable_search(False) self.track_view.set_fixed_height_mode(True) self.track_view.set_grid_lines(Gtk.TreeViewGridLines.BOTH) - self.track_view.get_style_context().add_class("eac-matrix") for index, title in enumerate(["#", "Status", "Artist", "Title", "Length", "Test CRC", "Copy CRC", "AR"]): renderer = Gtk.CellRendererText() column = Gtk.TreeViewColumn(title, renderer, text=index) @@ -543,7 +461,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): xalign=0, ) note.set_line_wrap(True) - note.get_style_context().add_class("eac-subtle") grid.attach(note, 0, 6, 4, 1) return frame @@ -560,7 +477,6 @@ class WhipperGui(Gtk.Application if Gtk is not None else object): text_view.set_editable(False) text_view.set_cursor_visible(False) text_view.set_monospace(True) - text_view.get_style_context().add_class("eac-log") self.log_buffer = text_view.get_buffer() scroll.add(text_view) return frame