From 9e9c5279ac0c07f8e70477fa6b50eafa51df94ec Mon Sep 17 00:00:00 2001 From: Huluti Date: Sat, 10 Dec 2016 17:34:29 +0100 Subject: [PATCH] Handle PKGBUILD --- BUILD/PKGBUILD | 0 src/{ => data}/img/facebook.png | Bin src/{ => data}/img/google+.png | Bin src/{ => data}/img/reddit.png | Bin src/{ => data}/img/twitter.png | Bin src/{ => data}/pages/en_US/involved | 0 src/{ => data}/pages/en_US/readme | 0 src/{ => data}/pages/en_US/release | 0 src/manjaro-hello.glade | 12 ++++-------- src/manjaro-hello.py | 28 +++++++++++++++++++--------- 10 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 BUILD/PKGBUILD rename src/{ => data}/img/facebook.png (100%) rename src/{ => data}/img/google+.png (100%) rename src/{ => data}/img/reddit.png (100%) rename src/{ => data}/img/twitter.png (100%) rename src/{ => data}/pages/en_US/involved (100%) rename src/{ => data}/pages/en_US/readme (100%) rename src/{ => data}/pages/en_US/release (100%) diff --git a/BUILD/PKGBUILD b/BUILD/PKGBUILD new file mode 100644 index 0000000..e69de29 diff --git a/src/img/facebook.png b/src/data/img/facebook.png similarity index 100% rename from src/img/facebook.png rename to src/data/img/facebook.png diff --git a/src/img/google+.png b/src/data/img/google+.png similarity index 100% rename from src/img/google+.png rename to src/data/img/google+.png diff --git a/src/img/reddit.png b/src/data/img/reddit.png similarity index 100% rename from src/img/reddit.png rename to src/data/img/reddit.png diff --git a/src/img/twitter.png b/src/data/img/twitter.png similarity index 100% rename from src/img/twitter.png rename to src/data/img/twitter.png diff --git a/src/pages/en_US/involved b/src/data/pages/en_US/involved similarity index 100% rename from src/pages/en_US/involved rename to src/data/pages/en_US/involved diff --git a/src/pages/en_US/readme b/src/data/pages/en_US/readme similarity index 100% rename from src/pages/en_US/readme rename to src/data/pages/en_US/readme diff --git a/src/pages/en_US/release b/src/data/pages/en_US/release similarity index 100% rename from src/pages/en_US/release rename to src/data/pages/en_US/release diff --git a/src/manjaro-hello.glade b/src/manjaro-hello.glade index 98b1e18..9895582 100644 --- a/src/manjaro-hello.glade +++ b/src/manjaro-hello.glade @@ -317,10 +317,9 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we False - + True False - img/google+.png @@ -337,10 +336,9 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we False - + True False - img/facebook.png @@ -357,10 +355,9 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we False - + True False - img/twitter.png @@ -377,10 +374,9 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we False - + True False - img/reddit.png diff --git a/src/manjaro-hello.py b/src/manjaro-hello.py index f73ea70..7857116 100644 --- a/src/manjaro-hello.py +++ b/src/manjaro-hello.py @@ -33,13 +33,17 @@ class ManjaroHello(): } # Path vars - config_path = os.path.expanduser("~") + "/.config/" - #share_path = "/usr/share/" - self.preferences_path = config_path + self.app + ".json" - self.desktop_path = os.getcwd() + "/" + self.app + ".desktop" # later use share_path - self.autostart_path = config_path + "autostart/" + self.app + ".desktop" - self.icon_path = self.app + ".png" # later use share_path - self.locale_path = "locale" # later use share_path + self.current_folder = os.getcwd() + "/" + if os.path.exists("/usr/share/" + self.app + "/data/"): + self.data_path = "/usr/share/" + self.app + "/data/" + self.locale_path = "/usr/share/locale/" + else: + self.data_path = self.current_folder + "data/" + self.locale_path = "locale/" + self.config_path = os.path.expanduser("~") + "/.config/" + self.preferences_path = self.config_path + self.app + ".json" + self.desktop_path = self.current_folder + self.app + ".desktop" + self.autostart_path = self.config_path + "autostart/" + self.app + ".desktop" # Load preferences self.preferences = self.get_preferences() @@ -84,6 +88,12 @@ class ManjaroHello(): self.builder.get_object("headerbar").props.subtitle = self.infos["codename"] + " " + self.infos["release"] + " " self.builder.get_object("headerbar").props.subtitle += self.infos["arch"] + # Load images + self.builder.get_object("google+").set_from_file(self.data_path + "img/google+.png") + self.builder.get_object("facebook").set_from_file(self.data_path + "img/facebook.png") + self.builder.get_object("twitter").set_from_file(self.data_path + "img/twitter.png") + self.builder.get_object("reddit").set_from_file(self.data_path + "img/reddit.png") + # Set autostart switcher state self.builder.get_object("autostart").set_active(self.preferences["autostart"]) @@ -134,9 +144,9 @@ class ManjaroHello(): return None def read_page(self, name): - filename = "pages/{}/{}".format(self.preferences["locale"], name) + filename = self.data_path + "pages/{}/{}".format(self.preferences["locale"], name) if not os.path.isfile(filename): - filename = "pages/{}/{}".format(self.default_locale, name) + filename = self.data_path + "pages/{}/{}".format(self.default_locale, name) try: with open(filename, "r") as f: return f.read()