Browse Source

added ignore gooey flag

pull/95/head
chriskiehl 9 years ago
parent
commit
f42547fbe8
2 changed files with 14 additions and 3 deletions
  1. 2
      gooey/gui/controller.py
  2. 15
      gooey/python_bindings/gooey_decorator.py

2
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) return self.show_dialog(i18n._('error_title'), i18n._('error_required_fields'), wx.ICON_ERROR)
cmd_line_args = self.core_gui.GetOptions() 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) pub.send_message(events.WINDOW_CHANGE, view_name=views.RUNNING_SCREEN)
self.run_client_code(command) self.run_client_code(command)

15
gooey/python_bindings/gooey_decorator.py

@ -13,12 +13,15 @@ import tempfile
from . import source_parser from . import source_parser
from . import config_generator from . import config_generator
import sys
from gooey.gui import application from gooey.gui import application
from argparse import ArgumentParser from argparse import ArgumentParser
IGNORE_COMMAND = '--ignore-gooey'
def Gooey(f=None, def Gooey(f=None,
advanced=True, advanced=True,
language='english', language='english',
@ -38,8 +41,7 @@ def Gooey(f=None,
def build(payload): def build(payload):
def run_gooey(self, args=None, namespace=None): 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) build_spec = config_generator.create_from_parser(self, source_path, payload_name=payload.__name__, **params)
if dump_build_config: if dump_build_config:
@ -57,6 +59,15 @@ def Gooey(f=None,
inner2.__name__ = payload.__name__ inner2.__name__ = payload.__name__
return inner2 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): if callable(f):
return build(f) return build(f)
return build return build

Loading…
Cancel
Save