minor pep8 and spelling

merge-requests/64/head
Johnathan Jenkins 2016-12-21 06:35:54 -08:00
parent 596d0129d2
commit 5ba5a6b59e
No known key found for this signature in database
GPG Key ID: 7086E9CC7EC3233B
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.
- 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.
- Interface is translated using gettext and po files. (po/)

View File

@ -11,6 +11,7 @@ import webbrowser
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GdkPixbuf
class ManjaroHello():
def __init__(self):
# App vars
@ -64,7 +65,7 @@ class ManjaroHello():
self.preferences["locale"] = self.get_best_locale()
# 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)
# Make translation
@ -95,7 +96,7 @@ class ManjaroHello():
if os.path.isfile("/usr/bin/cli-installer"):
self.builder.get_object("installcli").set_visible(True)
self.window.show();
self.window.show()
def get_best_locale(self):
"""Choose best locale, based on user's preferences.
@ -236,6 +237,7 @@ class ManjaroHello():
self.save_preferences()
Gtk.main_quit(*args)
def get_infos():
"""Get 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")
return infos
def get_lsb_infos():
"""Read informations from the lsb-release file.
:return: args from lsb-release file
@ -270,6 +273,7 @@ def get_lsb_infos():
print(e)
return lsb
def read_json(path):
try:
with open(path, "r") as f:
@ -277,6 +281,7 @@ def read_json(path):
except OSError as e:
return None
if __name__ == "__main__":
ManjaroHello()
Gtk.main()

View File

@ -2,13 +2,14 @@ import unittest
from src import manjaro_hello
class ManjaroHello(unittest.TestCase):
def setUp(self):
self.path = "test/"
def test_read_json(self):
json = manjaro_hello.read_json(self.path + "test.json")
self.assertEqual(json, {"test":"json"})
self.assertEqual(json, {"test": "json"})
json = manjaro_hello.read_json(self.path + "test")
self.assertEqual(json, None)