diff --git a/gooey/gui/controller.py b/gooey/gui/controller.py index 30523dc..e5a5647 100644 --- a/gooey/gui/controller.py +++ b/gooey/gui/controller.py @@ -70,7 +70,7 @@ class Controller(object): return self.show_dialog(i18n._('error_title'), i18n._('error_required_fields'), wx.ICON_ERROR) cmd_line_args = self.core_gui.GetOptions() - command = '{0} {1}'.format(self.build_spec['target'], cmd_line_args) + command = '{0} --ignore-gooey {1}'.format(self.build_spec['target'], cmd_line_args) pub.send_message(events.WINDOW_CHANGE, view_name=views.RUNNING_SCREEN) self.run_client_code(command) diff --git a/gooey/python_bindings/gooey_decorator.py b/gooey/python_bindings/gooey_decorator.py index 4a4335e..53fd3f2 100644 --- a/gooey/python_bindings/gooey_decorator.py +++ b/gooey/python_bindings/gooey_decorator.py @@ -13,12 +13,15 @@ import tempfile from . import source_parser from . import config_generator +import sys from gooey.gui import application from argparse import ArgumentParser +IGNORE_COMMAND = '--ignore-gooey' + def Gooey(f=None, advanced=True, language='english', @@ -38,8 +41,7 @@ def Gooey(f=None, def build(payload): def run_gooey(self, args=None, namespace=None): - source_path = store_executable_copy() - + source_path = sys.argv[0] build_spec = config_generator.create_from_parser(self, source_path, payload_name=payload.__name__, **params) if dump_build_config: @@ -57,6 +59,15 @@ def Gooey(f=None, inner2.__name__ = payload.__name__ return inner2 + def run_without_gooey(func): + return lambda: func() + + if IGNORE_COMMAND in sys.argv: + sys.argv.remove(IGNORE_COMMAND) + if callable(f): + return run_without_gooey(f) + return run_without_gooey + if callable(f): return build(f) return build