From 4e632180ec019ab81bd1b06d203c44e63fd14287 Mon Sep 17 00:00:00 2001 From: axtloss Date: Wed, 5 Apr 2023 23:42:24 +0200 Subject: [PATCH] Fix css loading error by switching to style.css --- vanilla_first_setup/main.py | 57 ------------------- vanilla_first_setup/style.css | 41 +++++++++++++ .../vanilla-first-setup.gresource.xml | 2 + 3 files changed, 43 insertions(+), 57 deletions(-) create mode 100644 vanilla_first_setup/style.css diff --git a/vanilla_first_setup/main.py b/vanilla_first_setup/main.py index 8996384..a3b58af 100644 --- a/vanilla_first_setup/main.py +++ b/vanilla_first_setup/main.py @@ -80,64 +80,7 @@ class FirstSetupApplication(Adw.Application): self.activate() def do_activate(self): - """ - Called when the application is activated. - - We raise the application's main window, creating it if - necessary. - - -- - CSS inspired by: Sonny Piers - """ - css = b""" -.theme-selector { - border-radius: 100px; - margin: 8px; - border: 1px solid rgba(145, 145, 145, 0.1); - padding: 30px; -} -.theme-selector radio { - -gtk-icon-source: none; - border: none; - background: none; - box-shadow: none; - min-width: 12px; - min-height: 12px; - transform: translate(34px, 20px); - padding: 2px; - border-radius: 100px; -} -.theme-selector radio:checked { - -gtk-icon-source: -gtk-icontheme("object-select-symbolic"); - background-color: @theme_selected_bg_color; - color: @theme_selected_fg_color; -} -.theme-selector:checked { - border-color: @theme_selected_bg_color; - border-width: 2px; - background-color: @theme_selected_bg_color; -} -.theme-selector.light { - background-color: #ffffff; -} -.theme-selector.dark { - background-color: #202020; -} -.theme-selector.light:checked { - background-color: #eeeeee; -} -.theme-selector.dark:checked { - background-color: #303030; -} -""" - provider = Gtk.CssProvider() - provider.load_from_data(data=css) - Gtk.StyleContext.add_provider_for_display( - display=Gdk.Display.get_default(), - provider=provider, - priority=Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION - ) win = self.props.active_window if not win: diff --git a/vanilla_first_setup/style.css b/vanilla_first_setup/style.css new file mode 100644 index 0000000..e9b403d --- /dev/null +++ b/vanilla_first_setup/style.css @@ -0,0 +1,41 @@ +/* CSS inspired by: Sonny Piers */ + +.theme-selector { + border-radius: 100px; + margin: 8px; + border: 1px solid rgba(145, 145, 145, 0.1); + padding: 30px; +} +.theme-selector radio { + -gtk-icon-source: none; + border: none; + background: none; + box-shadow: none; + min-width: 12px; + min-height: 12px; + transform: translate(34px, 20px); + padding: 2px; + border-radius: 100px; +} +.theme-selector radio:checked { + -gtk-icon-source: -gtk-icontheme("object-select-symbolic"); + background-color: @theme_selected_bg_color; + color: @theme_selected_fg_color; +} +.theme-selector:checked { + border-color: @theme_selected_bg_color; + border-width: 2px; + background-color: @theme_selected_bg_color; +} +.theme-selector.light { + background-color: #ffffff; +} +.theme-selector.dark { + background-color: #202020; +} +.theme-selector.light:checked { + background-color: #eeeeee; +} +.theme-selector.dark:checked { + background-color: #303030; +} \ No newline at end of file diff --git a/vanilla_first_setup/vanilla-first-setup.gresource.xml b/vanilla_first_setup/vanilla-first-setup.gresource.xml index 64e94fd..076601a 100644 --- a/vanilla_first_setup/vanilla-first-setup.gresource.xml +++ b/vanilla_first_setup/vanilla-first-setup.gresource.xml @@ -1,6 +1,8 @@ + style.css + gtk/window.ui gtk/done.ui gtk/progress.ui