How to use the gooey.util.functional.merge function in Gooey

To help you get started, we’ve selected a few Gooey examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chriskiehl / Gooey / gooey / python_bindings / argparse_to_json.py View on Github external
def extract_groups(action_group):
    '''
    Recursively extract argument groups and associated actions
    from ParserGroup objects
    '''
    return {
        'name': action_group.title,
        'description': action_group.description,
        'items': [action for action in action_group._group_actions
                  if not is_help_message(action)],
        'groups': [extract_groups(group)
                   for group in action_group._action_groups],
        'options': merge(group_defaults,
                               getattr(action_group, 'gooey_options', {}))
    }
github chriskiehl / Gooey / gooey / python_bindings / argparse_to_json.py View on Github external
return {
        'id': action.option_strings[0] if action.option_strings else action.dest,
        'type': widget,
        'cli_type': choose_cli_type(action),
        'required': action.required,
        'data': {
            'display_name': action.metavar or action.dest,
            'help': action.help,
            'required': action.required,
            'nargs': action.nargs or '',
            'commands': action.option_strings,
            'choices': action.choices or [],
            'default': clean_default(action.default),
            'dest': action.dest,
        },
        'options': merge(base, options.get(action.dest) or {})
    }
github chriskiehl / Gooey / gooey / python_bindings / argparse_to_json.py View on Github external
def action_to_json(action, widget, options):
    if action.required:
        # check that it's present and not just spaces
        validator = 'user_input and not user_input.isspace()'
        error_msg = 'This field is required'
    else:
        # not required; do nothing;
        validator = 'True'
        error_msg = ''

    base = merge(item_default, {
        'validator': {
            'test': validator,
            'message': error_msg
        },
    })

    return {
        'id': action.option_strings[0] if action.option_strings else action.dest,
        'type': widget,
        'cli_type': choose_cli_type(action),
        'required': action.required,
        'data': {
            'display_name': action.metavar or action.dest,
            'help': action.help,
            'required': action.required,
            'nargs': action.nargs or '',
github chriskiehl / Gooey / gooey / gui / application.py View on Github external
def build_app(build_spec):
  app = wx.App(False)

  i18n.load(build_spec['language_dir'], build_spec['language'], build_spec['encoding'])
  imagesPaths = image_repository.loadImages(build_spec['image_dir'])
  gapp = GooeyApplication(merge(build_spec, imagesPaths))
  # wx.lib.inspection.InspectionTool().Show()
  gapp.Show()
  return app
github chriskiehl / Gooey / gooey / gui / components / widgets / core / chooser.py View on Github external
def __init__(self, *args, **kwargs):
        defaults = {'label': _('choose_date')}
        super(DateChooser, self).__init__(*args, **merge(kwargs, defaults))
github chriskiehl / Gooey / gooey / gui / components / widgets / radio_group.py View on Github external
def getValue(self):
        for button, widget in zip(self.radioButtons, self.widgets):
            if button.GetValue():  # is Checked
                return merge(widget.getValue(), {'id': self._id})
        else:
            # just return the first widget's value even though it's
            # not active so that the expected interface is satisfied
            return self.widgets[0].getValue()
github chriskiehl / Gooey / gooey / gui / components / widgets / core / text_input.py View on Github external
def MultilineTextInput(_, parent, *args, **kwargs):
    style = {'style': wx.TE_MULTILINE}
    return TextInput(parent, *args, **merge(kwargs, style))
github chriskiehl / Gooey / gooey / gui / image_repository.py View on Github external
def loadImages(targetDir):
    defaultImages = resolvePaths(getResourcePath('images'), filenames)
    return {'images': merge(defaultImages, collectOverrides(targetDir, filenames))}