From a7b0f618e7db3e0a41f7e8a4a952ec816d5061c8 Mon Sep 17 00:00:00 2001 From: chriskiehl Date: Tue, 2 Jun 2015 20:34:57 -0400 Subject: [PATCH] expanded i18n coverage. Fixed layout issues --- gooey/gui/image_repository.py | 1 + gooey/gui/widgets/choosers.py | 4 +++- gooey/gui/widgets/widget_pack.py | 5 +++-- gooey/gui/windows/header.py | 12 +++++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gooey/gui/image_repository.py b/gooey/gui/image_repository.py index 29748cb..e52603b 100644 --- a/gooey/gui/image_repository.py +++ b/gooey/gui/image_repository.py @@ -14,6 +14,7 @@ icon = os.path.join(image_dir, "icon.ico") images = os.path.join(image_dir, "images.jpg") loader = os.path.join(image_dir, "loader.gif") settings2 = os.path.join(image_dir, "settings2.png") +error = os.path.join(image_dir, "error.png") def _list_images(): diff --git a/gooey/gui/widgets/choosers.py b/gooey/gui/widgets/choosers.py index d215646..8468ca3 100644 --- a/gooey/gui/widgets/choosers.py +++ b/gooey/gui/widgets/choosers.py @@ -1,3 +1,5 @@ +from gooey.gui.lang import i18n + __author__ = 'Chris' import wx @@ -13,7 +15,7 @@ class AbstractChooser(object): # parent self.panel = None - self.button_text = 'Browse' + self.button_text = i18n._('browse') # Widgets self.title = None diff --git a/gooey/gui/widgets/widget_pack.py b/gooey/gui/widgets/widget_pack.py index be78ac2..4ec3304 100644 --- a/gooey/gui/widgets/widget_pack.py +++ b/gooey/gui/widgets/widget_pack.py @@ -1,4 +1,5 @@ from functools import partial +from gooey.gui.lang import i18n from gooey.gui.util.filedrop import FileDrop __author__ = 'Chris' @@ -36,8 +37,8 @@ class WidgetPack(object): class BaseChooser(WidgetPack): - def __init__(self, button_text='Browse'): - self.button_text = button_text + def __init__(self, button_text=''): + self.button_text = i18n._('browse') self.option_string = None self.parent = None self.text_box = None diff --git a/gooey/gui/windows/header.py b/gooey/gui/windows/header.py index 8a3b5bb..890541c 100644 --- a/gooey/gui/windows/header.py +++ b/gooey/gui/windows/header.py @@ -29,6 +29,7 @@ class FrameHeader(wx.Panel): self._settings_img = None self._running_img = None self._check_mark = None + self._error_symbol = None self.layouts = {} @@ -52,6 +53,7 @@ class FrameHeader(wx.Panel): self._settings_img = self._load_image(image_repository.settings2, height=79) self._running_img = self._load_image(image_repository.computer3, 79) self._check_mark = self._load_image(image_repository.alessandro_rei_checkmark, height=75) + self._error_symbol = self._load_image(image_repository.error, height=75) def _do_layout(self): @@ -62,8 +64,10 @@ class FrameHeader(wx.Panel): sizer.Add(self._settings_img, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE) sizer.Add(self._running_img, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE) sizer.Add(self._check_mark, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE) + sizer.Add(self._error_symbol, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE) self._running_img.Hide() self._check_mark.Hide() + self._error_symbol.Hide() vsizer.Add(sizer, 1, wx.EXPAND) self.SetSizer(vsizer) @@ -90,6 +94,7 @@ class FrameHeader(wx.Panel): self._settings_img.Show() self._check_mark.Hide() self._running_img.Hide() + self._error_symbol.Hide() self.Layout() def running(): @@ -98,6 +103,7 @@ class FrameHeader(wx.Panel): self._check_mark.Hide() self._settings_img.Hide() self._running_img.Show() + self._error_symbol.Hide() self.Layout() def success(): @@ -108,7 +114,11 @@ class FrameHeader(wx.Panel): self.Layout() def error(): - success() + self._header.SetLabel(i18n._('finished_title')) + self._subheader.SetLabel(i18n._('finished_error')) + self._running_img.Hide() + self._error_symbol.Show() + self.Layout() self.layouts = locals()