Just a bit PEP8

merge-requests/64/head
Hugo Posnic 2017-05-25 17:03:35 +02:00
parent ad4f65374e
commit 22bdc5bcd0
1 changed files with 9 additions and 5 deletions

View File

@ -54,7 +54,8 @@ class Hello():
for widget in self.builder.get_object("homepage").get_children():
if isinstance(widget, Gtk.Button) and widget.get_image_position() is Gtk.PositionType.RIGHT:
img = Gtk.Image.new_from_file(self.preferences["data_path"] + "img/external-link.png")
img = Gtk.Image.new_from_file(
self.preferences["data_path"] + "img/external-link.png")
img.set_margin_left(2)
widget.set_image(img)
@ -117,7 +118,8 @@ class Hello():
:type locale: str
"""
try:
tr = gettext.translation(self.app, self.preferences["locale_path"], [locale], fallback=True)
tr = gettext.translation(self.app, self.preferences[
"locale_path"], [locale], fallback=True)
tr.install()
except OSError:
return
@ -158,7 +160,8 @@ class Hello():
for method in elts:
for elt in elts[method]:
if elt not in self.default_texts:
self.default_texts[elt] = getattr(self.builder.get_object(elt), "get_" + method)()
self.default_texts[elt] = getattr(
self.builder.get_object(elt), "get_" + method)()
getattr(self.builder.get_object(elt), "set_" + method)(_(self.default_texts[elt]))
# Change content of pages
@ -202,7 +205,8 @@ class Hello():
"""
filename = self.preferences["data_path"] + "pages/{}/{}".format(self.save["locale"], name)
if not os.path.isfile(filename):
filename = self.preferences["data_path"] + "pages/{}/{}".format(self.preferences["default_locale"], name)
filename = self.preferences["data_path"] + \
"pages/{}/{}".format(self.preferences["default_locale"], name)
try:
with open(filename, "r") as f:
return f.read()