Browse Source

i18n cleanup

subparsing
chriskiehl 9 years ago
parent
commit
78aa9e81c3
6 changed files with 18 additions and 18 deletions
  1. 14
      gooey/gui/controller.py
  2. 4
      gooey/gui/windows/advanced_config.py
  3. 2
      gooey/gui/windows/base_window.py
  4. 6
      gooey/gui/windows/footer.py
  5. 8
      gooey/gui/windows/header.py
  6. 2
      gooey/gui/windows/runtime_display_panel.py

14
gooey/gui/controller.py

@ -32,8 +32,8 @@ class Controller(object):
self.build_spec = build_spec self.build_spec = build_spec
def OnCancelButton(self, widget, event): def OnCancelButton(self, widget, event):
msg = i18n.translate('sure_you_want_to_exit')
dlg = wx.MessageDialog(None, msg, i18n.translate('close_program'), wx.YES_NO)
msg = i18n._('sure_you_want_to_exit')
dlg = wx.MessageDialog(None, msg, i18n._('close_program'), wx.YES_NO)
result = dlg.ShowModal() result = dlg.ShowModal()
if result == YES: if result == YES:
dlg.Destroy() dlg.Destroy()
@ -47,7 +47,7 @@ class Controller(object):
if not self.build_spec['manual_start']: if not self.build_spec['manual_start']:
_required = self.core_gui.GetRequiredArgs() _required = self.core_gui.GetRequiredArgs()
if _required and any(req == '' for req in _required): if _required and any(req == '' for req in _required):
self.ShowDialog(i18n.translate('error_title'), "Must fill in all fields in the Required section!", wx.ICON_ERROR)
self.ShowDialog(i18n._('error_title'), "Must fill in all fields in the Required section!", wx.ICON_ERROR)
return return
command = '{0} {1}'.format(self.build_spec['target'], cmd_line_args) command = '{0} {1}'.format(self.build_spec['target'], cmd_line_args)
@ -86,13 +86,13 @@ class Controller(object):
sys.exit() sys.exit()
def ShowGoodFinishedDialog(self): def ShowGoodFinishedDialog(self):
self.ShowDialog(i18n.translate("execution_finished"),
i18n.translate('success_message'),
self.ShowDialog(i18n._("execution_finished"),
i18n._('success_message'),
wx.ICON_INFORMATION) wx.ICON_INFORMATION)
def ShowBadFinishedDialog(self, error_msg): def ShowBadFinishedDialog(self, error_msg):
msg = i18n.translate('uh_oh').format(error_msg)
self.ShowDialog(i18n.translate('error_title'), msg, wx.ICON_ERROR)
msg = i18n._('uh_oh').format(error_msg)
self.ShowDialog(i18n._('error_title'), msg, wx.ICON_ERROR)
def ShowDialog(self, title, content, style): def ShowDialog(self, title, content, style):

4
gooey/gui/windows/advanced_config.py

@ -46,7 +46,7 @@ class AdvancedConfigPanel(ScrolledPanel, OptionReader):
container.AddSpacer(15) container.AddSpacer(15)
if self.widgets.required_args: if self.widgets.required_args:
container.Add(wx_util.h1(self, i18n.translate("required_args_msg")), 0, wx.LEFT | wx.RIGHT, PADDING)
container.Add(wx_util.h1(self, i18n._("required_args_msg")), 0, wx.LEFT | wx.RIGHT, PADDING)
container.AddSpacer(5) container.AddSpacer(5)
container.Add(wx_util.horizontal_rule(self), *STD_LAYOUT) container.Add(wx_util.horizontal_rule(self), *STD_LAYOUT)
container.AddSpacer(20) container.AddSpacer(20)
@ -58,7 +58,7 @@ class AdvancedConfigPanel(ScrolledPanel, OptionReader):
if self.widgets.optional_args: if self.widgets.optional_args:
container.AddSpacer(10) container.AddSpacer(10)
container.Add(wx_util.h1(self, i18n.translate("optional_args_msg")), 0, wx.LEFT | wx.RIGHT, PADDING)
container.Add(wx_util.h1(self, i18n._("optional_args_msg")), 0, wx.LEFT | wx.RIGHT, PADDING)
container.AddSpacer(5) container.AddSpacer(5)
container.Add(wx_util.horizontal_rule(self), *STD_LAYOUT) container.Add(wx_util.horizontal_rule(self), *STD_LAYOUT)
container.AddSpacer(20) container.AddSpacer(20)

2
gooey/gui/windows/base_window.py

@ -51,7 +51,7 @@ class BaseWindow(wx.Frame):
# init gui # init gui
_desc = self.build_spec['program_description'] _desc = self.build_spec['program_description']
self.head_panel = header.FrameHeader( self.head_panel = header.FrameHeader(
heading=i18n.translate("settings_title"),
heading=i18n._("settings_title"),
subheading=_desc or '', subheading=_desc or '',
parent=self) parent=self)
self.config_panel = AdvancedConfigPanel(self, self.build_spec) self.config_panel = AdvancedConfigPanel(self, self.build_spec)

6
gooey/gui/windows/footer.py

@ -43,10 +43,10 @@ class AbstractFooter(wx.Panel):
Refactor image tools into their own module. The resize code is Refactor image tools into their own module. The resize code is
getting spread around a bit. getting spread around a bit.
''' '''
self.cancel_button = self._Button(i18n.translate('cancel'), wx.ID_CANCEL)
self.start_button = self._Button(i18n.translate('start'), wx.ID_OK)
self.cancel_button = self._Button(i18n._('cancel'), wx.ID_CANCEL)
self.start_button = self._Button(i18n._('start'), wx.ID_OK)
self.running_animation = wx.animate.GIFAnimationCtrl(self, -1, image_repository.loader) self.running_animation = wx.animate.GIFAnimationCtrl(self, -1, image_repository.loader)
self.close_button = self._Button(i18n.translate("close"), wx.ID_OK)
self.close_button = self._Button(i18n._("close"), wx.ID_OK)
self.stop_button = self._Button('Stop', wx.ID_OK) # TODO: i18n self.stop_button = self._Button('Stop', wx.ID_OK) # TODO: i18n
self.restart_button = self._Button('Restart', wx.ID_OK) # TODO: i18n self.restart_button = self._Button('Restart', wx.ID_OK) # TODO: i18n

8
gooey/gui/windows/header.py

@ -79,16 +79,16 @@ class FrameHeader(wx.Panel):
def _init_pages(self): def _init_pages(self):
def PageOne(): def PageOne():
self._header.SetLabel(i18n.translate("running_title"))
self._subheader.SetLabel(i18n.translate('running_msg'))
self._header.SetLabel(i18n._("running_title"))
self._subheader.SetLabel(i18n._('running_msg'))
self._check_mark.Hide() self._check_mark.Hide()
self._settings_img.Hide() self._settings_img.Hide()
self._running_img.Show() self._running_img.Show()
self.Layout() self.Layout()
def PageTwo(): def PageTwo():
self._header.SetLabel(i18n.translate('finished_title'))
self._subheader.SetLabel(i18n.translate('finished_msg'))
self._header.SetLabel(i18n._('finished_title'))
self._subheader.SetLabel(i18n._('finished_msg'))
self._running_img.Hide() self._running_img.Hide()
self._check_mark.Show() self._check_mark.Show()
self.Layout() self.Layout()

2
gooey/gui/windows/runtime_display_panel.py

@ -35,7 +35,7 @@ class RuntimeDisplay(wx.Panel):
self.SetBackgroundColour('#F0F0F0') self.SetBackgroundColour('#F0F0F0')
def _init_components(self): def _init_components(self):
self.text = wx.StaticText(self, label=i18n.translate("status"))
self.text = wx.StaticText(self, label=i18n._("status"))
self.cmd_textbox = wx.TextCtrl( self.cmd_textbox = wx.TextCtrl(
self, -1, "", self, -1, "",
style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH) style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)

Loading…
Cancel
Save