From 4d10dc23990eefe8df9dd6387dd9a4d5de574c43 Mon Sep 17 00:00:00 2001 From: Huluti Date: Sun, 11 Dec 2016 00:58:59 +0100 Subject: [PATCH] Merge two functions in one --- src/manjaro-hello.glade | 66 ++++++++++++++++++++--------------------- src/manjaro-hello.py | 45 +++++++++++++--------------- 2 files changed, 53 insertions(+), 58 deletions(-) diff --git a/src/manjaro-hello.glade b/src/manjaro-hello.glade index 989b2c4..f62a5ac 100644 --- a/src/manjaro-hello.glade +++ b/src/manjaro-hello.glade @@ -97,7 +97,7 @@ - + True False Welcome to Manjaro! @@ -113,7 +113,7 @@ - + True False True @@ -131,7 +131,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + True False DOCUMENTATION @@ -145,7 +145,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + True False SUPPORT @@ -159,7 +159,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + True False PROJECT @@ -173,9 +173,9 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + Read me - readmebtn + readme True True True @@ -187,9 +187,9 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + Release info - releasebtn + release True True True @@ -201,13 +201,13 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + Wiki - wikibtn + wiki True True False - + 0 @@ -215,9 +215,9 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + Get involved - involvedbtn + involved True True True @@ -229,13 +229,13 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + Forums - forumsbtn + forums True True True - + 1 @@ -243,13 +243,13 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + Chat room - chatbtn + chat True True True - + 1 @@ -257,13 +257,13 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + Mailling lists - maillingbtn + mailling True True True - + 1 @@ -271,13 +271,13 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + Build Manjaro - buildbtn + build True True True - + 2 @@ -285,13 +285,13 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we - + 2 @@ -315,7 +315,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we google+ True False - + True @@ -334,7 +334,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we facebook True False - + True @@ -353,7 +353,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we twitter True False - + True @@ -372,7 +372,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we reddit True False - + True diff --git a/src/manjaro-hello.py b/src/manjaro-hello.py index fe48e06..c40cfea 100644 --- a/src/manjaro-hello.py +++ b/src/manjaro-hello.py @@ -17,15 +17,13 @@ class ManjaroHello(): self.app = "manjaro-hello" self.default_locale = "en_US" self.sys_locale = locale.getdefaultlocale()[0] - self.welcome_urls = { + self.urls = { "wiki": "https://wiki.manjaro.org", "forums": "https://forum.manjaro.org", "chat": "https://kiwiirc.com/client/irc.freenode.net/?nick=manjaro-web|?#manjaro", "mailling": "https://lists.manjaro.org/cgi-bin/mailman/listinfo", "build": "https://github.com/manjaro", - "donate": "https://manjaro.org/donate" - } - self.social_urls = { + "donate": "https://manjaro.org/donate", "google+": "https://plus.google.com/118244873957924966264", "facebook": "https://www.facebook.com/ManjaroLinux", "twitter": "https://twitter.com/ManjaroLinux", @@ -115,23 +113,23 @@ class ManjaroHello(): # Dirty code to fix an issue with gettext that can't translate text from glade interface # TODO: Find a better solution elts = { + "welcometitle": "label", "welcomelabel": "label", - "welcometext": "label", - "documentationtitle": "label", "readmelabel": "label", "releaselabel": "label", "involvedlabel": "label", - "supporttitle": "label", - "projecttitle": "label", - "readmebtn": "label", - "releasebtn": "label", - "wikibtn": "label", - "involvedbtn": "label", - "forumsbtn": "label", - "chatbtn": "label", - "maillingbtn": "label", - "buildbtn": "label", - "donatebtn": "label", + "firstcategory": "label", + "secondcategory": "label", + "thirdcategory": "label", + "readme": "label", + "release": "label", + "wiki": "label", + "involved": "label", + "forums": "label", + "chat": "label", + "mailling": "label", + "build": "label", + "donate": "label", "installlabel": "label", "installgui": "label", "installcli": "label", @@ -203,13 +201,13 @@ class ManjaroHello(): def on_action_btn_clicked(self, btn): name = btn.get_name() - if name == "readmebtn": + if name == "readme": self.builder.get_object("stack").set_visible_child(self.builder.get_object("documentation")) self.builder.get_object("documentation").set_current_page(0) - elif name == "releasebtn": + elif name == "release": self.builder.get_object("stack").set_visible_child(self.builder.get_object("documentation")) self.builder.get_object("documentation").set_current_page(1) - elif name == "involvedbtn": + elif name == "involved": self.builder.get_object("stack").set_visible_child(self.builder.get_object("project")) self.builder.get_object("project").set_current_page(0) elif name == "installgui": @@ -217,11 +215,8 @@ class ManjaroHello(): elif name == "installcli": subprocess.call(["sudo cli-installer"]) - def on_link_btn_clicked(self, btn): - webbrowser.open_new_tab(self.welcome_urls[btn.get_name()[:-3]]) - - def on_social_pressed(self, eventbox, _): - webbrowser.open_new_tab(self.social_urls[eventbox.get_name()]) + def on_link_clicked(self, link, _=None): + webbrowser.open_new_tab(self.urls[link.get_name()]) def on_autostart_switched(self, switch, _): autostart = True if switch.get_active() else False