Browse Source

Add parameter clear_before_run that forces console clear between runs.

If the parameter is set to yes in the gooey decorator, the console will
be cleared before each run.

Current default parameter value is conservative and does not clear the
console.
pull/473/head
Nathan Richard 6 years ago
committed by Chris
parent
commit
47206ec15a
3 changed files with 9 additions and 0 deletions
  1. 6
      gooey/gui/components/console.py
  2. 2
      gooey/gui/containers/application.py
  3. 1
      gooey/python_bindings/config_generator.py

6
gooey/gui/components/console.py

@ -65,6 +65,12 @@ class Console(wx.Panel):
"""
self.textbox.AppendText(txt)
def clear(self):
"""
Clear the the main TextCtrl.
"""
self.textbox.Clear()
def getText(self):
return self.textbox.GetValue()

2
gooey/gui/containers/application.py

@ -83,6 +83,8 @@ class GooeyApplication(wx.Frame):
config = self.navbar.getActiveConfig()
config.resetErrors()
if config.isValid():
if self.buildSpec['clear_before_run']:
self.console.clear()
self.clientRunner.run(self.buildCliString())
self.showConsole()
else:

1
gooey/python_bindings/config_generator.py

@ -50,6 +50,7 @@ def create_from_parser(parser, source_path, **kwargs):
'show_restart_button': kwargs.get('show_restart_button', True),
'requires_shell': kwargs.get('requires_shell', True),
'menu': kwargs.get('menu', []),
'clear_before_run': kwargs.get('clear_before_run', False),
# Legacy/Backward compatibility interop
'use_legacy_titles': kwargs.get('use_legacy_titles', True),

Loading…
Cancel
Save