From 7c74b972f622b458bad50040dd6ec0d12305b602 Mon Sep 17 00:00:00 2001 From: Oguz Kagan EREN Date: Thu, 15 Jul 2021 16:32:54 +0300 Subject: [PATCH] fixed style path problem --- data/preferences.json | 47 ++++++++++++++++++++++--------------------- src/manjaro_hello.py | 9 ++++++--- {src => ui}/base.css | 0 {src => ui}/style.css | 0 4 files changed, 30 insertions(+), 26 deletions(-) rename {src => ui}/base.css (100%) rename {src => ui}/style.css (100%) diff --git a/data/preferences.json b/data/preferences.json index 93c3134..02e2d94 100644 --- a/data/preferences.json +++ b/data/preferences.json @@ -1,24 +1,25 @@ { - "default_locale": "en", - "autostart_path": "~/.config/autostart/manjaro-hello.desktop", - "data_path": "/usr/share/manjaro-hello/data/", - "desktop_path": "/usr/share/applications/manjaro-hello.desktop", - "installer_path": "/usr/bin/calamares", - "live_path": "/run/miso/bootmnt/manjaro", - "locale_path": "/usr/share/locale/", - "logo_path": "/usr/share/icons/hicolor/64x64/apps/manjaro.png", - "save_path": "~/.config/manjaro-hello.json", - "ui_path": "/usr/share/manjaro-hello/ui/manjaro-hello.glade", - "urls": { - "development": "https://gitlab.manjaro.org", - "discover": "https://discover.manjaro.org/", - "donate": "https://manjaro.org/donate", - "facebook": "https://www.facebook.com/ManjaroLinux", - "forum": "https://forum.manjaro.org", - "telegram": "https://t.me/manjaro_official", - "mailling": "https://lists.manjaro.org/cgi-bin/mailman/listinfo", - "reddit": "https://www.reddit.com/r/ManjaroLinux", - "twitter": "https://twitter.com/ManjaroLinux", - "wiki": "https://wiki.manjaro.org" - } -} + "default_locale": "en", + "autostart_path": "~/.config/autostart/manjaro-hello.desktop", + "data_path": "/usr/share/manjaro-hello/data/", + "desktop_path": "/usr/share/applications/manjaro-hello.desktop", + "installer_path": "/usr/bin/calamares", + "live_path": "/run/miso/bootmnt/manjaro", + "locale_path": "/usr/share/locale/", + "logo_path": "/usr/share/icons/hicolor/64x64/apps/manjaro.png", + "save_path": "~/.config/manjaro-hello.json", + "ui_path": "/usr/share/manjaro-hello/ui/manjaro-hello.glade", + "style_path": "/usr/share/manjaro-hello/ui/style.css", + "urls": { + "development": "https://gitlab.manjaro.org", + "discover": "https://discover.manjaro.org/", + "donate": "https://manjaro.org/donate", + "facebook": "https://www.facebook.com/ManjaroLinux", + "forum": "https://forum.manjaro.org", + "telegram": "https://t.me/manjaro_official", + "mailling": "https://lists.manjaro.org/cgi-bin/mailman/listinfo", + "reddit": "https://www.reddit.com/r/ManjaroLinux", + "twitter": "https://twitter.com/ManjaroLinux", + "wiki": "https://wiki.manjaro.org" + } +} \ No newline at end of file diff --git a/src/manjaro_hello.py b/src/manjaro_hello.py index 42f9fa1..fcecde9 100644 --- a/src/manjaro_hello.py +++ b/src/manjaro_hello.py @@ -99,9 +99,6 @@ class Hello(Gtk.Window): self.app = "manjaro-hello" self.dev = "--dev" in sys.argv # Dev mode activated ? screen = Gdk.Screen.get_default() - provider = Gtk.CssProvider() - provider.load_from_path(os.path.abspath("src/style.css")) - Gtk.StyleContext.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) # Load preferences if self.dev: @@ -110,6 +107,7 @@ class Hello(Gtk.Window): self.preferences["desktop_path"] = os.getcwd() + f"/{self.app}.desktop" self.preferences["locale_path"] = "locale/" self.preferences["ui_path"] = f"ui/{self.app}.glade" + self.preferences["style_path"] = f"ui/style.css" else: self.preferences = read_json(f"/usr/share/{self.app}/data/preferences.json") # Get saved infos @@ -117,6 +115,11 @@ class Hello(Gtk.Window): if not self.save: self.save = {"locale": None} + # Import Css + provider = Gtk.CssProvider() + provider.load_from_path(self.preferences["style_path"]) + Gtk.StyleContext.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + # Init window self.builder = Gtk.Builder.new_from_file(self.preferences["ui_path"]) self.builder.connect_signals(self) diff --git a/src/base.css b/ui/base.css similarity index 100% rename from src/base.css rename to ui/base.css diff --git a/src/style.css b/ui/style.css similarity index 100% rename from src/style.css rename to ui/style.css