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(): for widget in self.builder.get_object("homepage").get_children():
if isinstance(widget, Gtk.Button) and widget.get_image_position() is Gtk.PositionType.RIGHT: 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) img.set_margin_left(2)
widget.set_image(img) widget.set_image(img)
@ -117,7 +118,8 @@ class Hello():
:type locale: str :type locale: str
""" """
try: 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() tr.install()
except OSError: except OSError:
return return
@ -158,7 +160,8 @@ class Hello():
for method in elts: for method in elts:
for elt in elts[method]: for elt in elts[method]:
if elt not in self.default_texts: 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])) getattr(self.builder.get_object(elt), "set_" + method)(_(self.default_texts[elt]))
# Change content of pages # Change content of pages
@ -202,7 +205,8 @@ class Hello():
""" """
filename = self.preferences["data_path"] + "pages/{}/{}".format(self.save["locale"], name) filename = self.preferences["data_path"] + "pages/{}/{}".format(self.save["locale"], name)
if not os.path.isfile(filename): 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: try:
with open(filename, "r") as f: with open(filename, "r") as f:
return f.read() return f.read()