def __init__(self, command=None, _self=cmd):

        self.input_arg = None
        self.input_value = None
        self.input_numeric = False

        wizard.Wizard.__init__(self, _self)

        self.stored_name = stored.get_unused_name('_wizard')
        setattr(stored, self.stored_name, self)
        self.varname = 'stored.' + self.stored_name

        self.set_command(command, False)
示例#2
0
    def __init__(self, command, _self=cmd):
        import inspect

        self.input_arg = None
        self.input_value = None
        self.input_numeric = False

        wizard.Wizard.__init__(self, _self)

        self.command = command
        self.func = _self.keyword[command][0]
        sig = inspect.signature(self.func, follow_wrapped=False)
        self.args = []
        self.current = {}
        self.shortcut = {}

        self.stored_name = stored.get_unused_name('_wizard')
        setattr(stored, self.stored_name, self)
        self.varname = 'stored.' + self.stored_name

        for param, aa in izip_longest(sig.parameters.values(), _self.auto_arg):
            if param.kind != inspect.Parameter.POSITIONAL_OR_KEYWORD:
                break

            arg = param.name
            if arg.startswith('_') or arg in self.ignored_args:
                continue
            self.args.append(arg)
            self.menu[arg] = [[2, arg.title(), ''], [0, '', ''],
                              [
                                  1, 'Enter value...',
                                  '%s.set_input_arg("%s")' %
                                  (self.varname, arg)
                              ]]
            try:
                self.shortcut[arg] = aa[command][0]
            except:
                pass

        for param in sig.parameters.values():
            if param.default == inspect.Parameter.empty:
                continue

            arg = param.name
            if not (arg in self.ignored_args or arg.startswith('_')):
                self.current[arg] = param.default
示例#3
0
    def __init__(self, command, _self=cmd):
        import inspect

        self.input_arg = None
        self.input_value = None
        self.input_numeric = False

        wizard.Wizard.__init__(self, _self)

        self.command = command
        self.func = _self.keyword[command][0]
        spec = inspect.getargspec(self.func)
        self.args = []
        self.current = {}
        self.shortcut = {}

        self.stored_name = stored.get_unused_name('_wizard')
        setattr(stored, self.stored_name, self)
        self.varname = 'stored.' + self.stored_name

        for arg, aa in izip_longest(spec.args, _self.auto_arg):
            if arg.startswith('_') or arg in self.ignored_args:
                continue
            self.args.append(arg)
            self.menu[arg] = [[2, arg.title(), ''], [0, '', ''],
                              [
                                  1, 'Enter value...',
                                  '%s.set_input_arg("%s")' %
                                  (self.varname, arg)
                              ]]
            try:
                self.shortcut[arg] = aa[command][0]
            except:
                pass

        for (arg, value) in zip(reversed(spec.args), reversed(spec.defaults)):
            if not (arg in self.ignored_args or arg.startswith('_')):
                self.current[arg] = value
示例#4
0
    def __init__(self, command, _self=cmd):
        import inspect

        self.input_arg = None
        self.input_value = None
        self.input_numeric = False

        wizard.Wizard.__init__(self, _self)

        self.command = command
        self.func = _self.keyword[command][0]
        spec = inspect.getargspec(self.func)
        self.args = []
        self.current = {}
        self.shortcut = {}

        self.stored_name = stored.get_unused_name('_wizard')
        setattr(stored, self.stored_name, self)
        self.varname = 'stored.' + self.stored_name

        for arg, aa in izip_longest(spec.args, _self.auto_arg):
            if arg.startswith('_') or arg in self.ignored_args:
                continue
            self.args.append(arg)
            self.menu[arg] = [
                [2, arg.title(), ''],
                [0, '', ''],
                [1, 'Enter value...', '%s.set_input_arg("%s")' % (self.varname, arg)]
            ]
            try:
                self.shortcut[arg] = aa[command][0]
            except:
                pass

        for (arg, value) in zip(reversed(spec.args), reversed(spec.defaults)):
            if not (arg in self.ignored_args or arg.startswith('_')):
                self.current[arg] = value