Merge pull request #3 from shaggytwodope/master

minor pep8 and spelling
merge-requests/64/head
Hugo Posnic 2016-12-21 15:40:41 +01:00 committed by GitHub
commit 5026204cc2
3 changed files with 12 additions and 6 deletions

View File

@ -13,7 +13,7 @@ Manjaro-hello is widely inspired by [manjaro-welcome](https://github.com/manjaro
- By using web technologies and Webkit, the renderer is a little bit slower than using native technologies. - By using web technologies and Webkit, the renderer is a little bit slower than using native technologies.
- Can't know if each link will be open in an external browser or in app. - Can't know if each link will be open in an external browser or in app.
For all this reasons, I have choosen to build a new software from scratch but keeping the original structure. For all this reasons, I have chosen to build a new software from scratch but keeping the original structure.
Currently, manjaro-hello has all the major features of manjaro-welcome plus a translation system. Currently, manjaro-hello has all the major features of manjaro-welcome plus a translation system.
- Interface is translated using gettext and po files. (po/) - Interface is translated using gettext and po files. (po/)

View File

@ -11,6 +11,7 @@ import webbrowser
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GdkPixbuf from gi.repository import Gtk, GdkPixbuf
class ManjaroHello(): class ManjaroHello():
def __init__(self): def __init__(self):
# App vars # App vars
@ -64,7 +65,7 @@ class ManjaroHello():
self.preferences["locale"] = self.get_best_locale() self.preferences["locale"] = self.get_best_locale()
# Select current locale in languages menu # Select current locale in languages menu
self.builder.get_object("languages").set_active_id(self.preferences["locale"]); self.builder.get_object("languages").set_active_id(self.preferences["locale"])
self.builder.get_object("languages").connect("changed", self.on_languages_changed) self.builder.get_object("languages").connect("changed", self.on_languages_changed)
# Make translation # Make translation
@ -95,7 +96,7 @@ class ManjaroHello():
if os.path.isfile("/usr/bin/cli-installer"): if os.path.isfile("/usr/bin/cli-installer"):
self.builder.get_object("installcli").set_visible(True) self.builder.get_object("installcli").set_visible(True)
self.window.show(); self.window.show()
def get_best_locale(self): def get_best_locale(self):
"""Choose best locale, based on user's preferences. """Choose best locale, based on user's preferences.
@ -236,6 +237,7 @@ class ManjaroHello():
self.save_preferences() self.save_preferences()
Gtk.main_quit(*args) Gtk.main_quit(*args)
def get_infos(): def get_infos():
"""Get informations about user's system. """Get informations about user's system.
:return: informations about user's system :return: informations about user's system
@ -249,6 +251,7 @@ def get_infos():
infos["live"] = os.path.exists("/bootmnt/manjaro") or os.path.exists("/run/miso/bootmnt/manjaro") infos["live"] = os.path.exists("/bootmnt/manjaro") or os.path.exists("/run/miso/bootmnt/manjaro")
return infos return infos
def get_lsb_infos(): def get_lsb_infos():
"""Read informations from the lsb-release file. """Read informations from the lsb-release file.
:return: args from lsb-release file :return: args from lsb-release file
@ -270,6 +273,7 @@ def get_lsb_infos():
print(e) print(e)
return lsb return lsb
def read_json(path): def read_json(path):
try: try:
with open(path, "r") as f: with open(path, "r") as f:
@ -277,6 +281,7 @@ def read_json(path):
except OSError as e: except OSError as e:
return None return None
if __name__ == "__main__": if __name__ == "__main__":
ManjaroHello() ManjaroHello()
Gtk.main() Gtk.main()

View File

@ -2,6 +2,7 @@ import unittest
from src import manjaro_hello from src import manjaro_hello
class ManjaroHello(unittest.TestCase): class ManjaroHello(unittest.TestCase):
def setUp(self): def setUp(self):
self.path = "test/" self.path = "test/"