Update docstrings to use RST format
parent
28de403da0
commit
925f44e44f
|
@ -115,7 +115,10 @@ class ManjaroHello():
|
||||||
self.window.show();
|
self.window.show();
|
||||||
|
|
||||||
def set_locale(self, locale):
|
def set_locale(self, locale):
|
||||||
"""Set locale of ui and pages."""
|
"""Set locale of ui and pages.
|
||||||
|
:param locale: locale to use
|
||||||
|
:type locale: str
|
||||||
|
"""
|
||||||
if self.preferences["locale"] != self.default_locale:
|
if self.preferences["locale"] != self.default_locale:
|
||||||
tr = gettext.translation(self.app, self.locale_path, [locale])
|
tr = gettext.translation(self.app, self.locale_path, [locale])
|
||||||
tr.install()
|
tr.install()
|
||||||
|
@ -156,7 +159,10 @@ class ManjaroHello():
|
||||||
self.builder.get_object(page + "label").set_markup(self.read_page(page))
|
self.builder.get_object(page + "label").set_markup(self.read_page(page))
|
||||||
|
|
||||||
def change_autostart(self, autostart):
|
def change_autostart(self, autostart):
|
||||||
"""Set state of autostart."""
|
"""Set state of autostart.
|
||||||
|
:param autostart: wanted autostart state
|
||||||
|
:type autostart: bool
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
if autostart and not os.path.isfile(self.autostart_path):
|
if autostart and not os.path.isfile(self.autostart_path):
|
||||||
os.symlink(self.desktop_path, self.autostart_path)
|
os.symlink(self.desktop_path, self.autostart_path)
|
||||||
|
@ -187,7 +193,12 @@ class ManjaroHello():
|
||||||
}
|
}
|
||||||
|
|
||||||
def read_page(self, name):
|
def read_page(self, name):
|
||||||
"""Read page according to language."""
|
"""Read page according to language.
|
||||||
|
:param name: name of page (filename)
|
||||||
|
:type name: str
|
||||||
|
:return: text to load
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
filename = self.data_path + "pages/{}/{}".format(self.preferences["locale"], name)
|
filename = self.data_path + "pages/{}/{}".format(self.preferences["locale"], name)
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
filename = self.data_path + "pages/{}/{}".format(self.default_locale, name)
|
filename = self.data_path + "pages/{}/{}".format(self.default_locale, name)
|
||||||
|
@ -231,7 +242,10 @@ class ManjaroHello():
|
||||||
Gtk.main_quit(*args)
|
Gtk.main_quit(*args)
|
||||||
|
|
||||||
def get_infos():
|
def get_infos():
|
||||||
"""Get informations on user's system."""
|
"""Get informations about user's system.
|
||||||
|
:return: informations about user's system
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
lsb = get_lsb_infos()
|
lsb = get_lsb_infos()
|
||||||
infos = {}
|
infos = {}
|
||||||
infos["codename"] = lsb.get("CODENAME", None)
|
infos["codename"] = lsb.get("CODENAME", None)
|
||||||
|
@ -241,7 +255,10 @@ def get_infos():
|
||||||
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
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
lsb = {}
|
lsb = {}
|
||||||
try:
|
try:
|
||||||
with open("/etc/lsb-release") as lsb_file:
|
with open("/etc/lsb-release") as lsb_file:
|
||||||
|
|
Loading…
Reference in New Issue