Add comments in init

merge-requests/64/head
Huluti 2016-12-04 22:48:13 +01:00
parent 71dfba8a63
commit 11a3909a98
1 changed files with 5 additions and 0 deletions

View File

@ -11,16 +11,19 @@ from gi.repository import Gtk
class ManjaroHello(Gtk.Window): class ManjaroHello(Gtk.Window):
def __init__(self): def __init__(self):
# Path vars
config_path = "{}/.config/".format(os.path.expanduser("~")) config_path = "{}/.config/".format(os.path.expanduser("~"))
self.preferences_path = config_path + "manjaro-hello.json" self.preferences_path = config_path + "manjaro-hello.json"
self.autostart_path = config_path + "autostart/manjaro-hello.desktop" self.autostart_path = config_path + "autostart/manjaro-hello.desktop"
self.icon_path = "manjaro-hello.png" self.icon_path = "manjaro-hello.png"
# Languages vars
self.language = locale.getlocale()[0][:2] self.language = locale.getlocale()[0][:2]
self.default_language = "en" self.default_language = "en"
self.app = "manjaro-hello" self.app = "manjaro-hello"
self.locale_dir = "locale" self.locale_dir = "locale"
# Settings vars
self.preferences = self.get_preferences() self.preferences = self.get_preferences()
if not self.preferences: if not self.preferences:
self.preferences = {"autostart": os.path.isfile(self.autostart_path)} self.preferences = {"autostart": os.path.isfile(self.autostart_path)}
@ -41,12 +44,14 @@ class ManjaroHello(Gtk.Window):
self.builder.connect_signals(self) self.builder.connect_signals(self)
self.window = self.builder.get_object("window") self.window = self.builder.get_object("window")
# Set window subtitle
self.builder.get_object("headerbar").props.subtitle = self.infos["codename"] + " " + self.infos["release"] + " " + self.infos["arch"] self.builder.get_object("headerbar").props.subtitle = self.infos["codename"] + " " + self.infos["release"] + " " + self.infos["arch"]
# Initialize pages # Initialize pages
for page in ("readme", "release", "involved"): for page in ("readme", "release", "involved"):
self.builder.get_object(page + "text").set_text(self.read_data(page)) self.builder.get_object(page + "text").set_text(self.read_data(page))
# Set switcher state
self.builder.get_object("autostart").set_active(self.preferences["autostart"]) self.builder.get_object("autostart").set_active(self.preferences["autostart"])
self.window.show() self.window.show()