This is definitely a WIP patch - I wanted quick results for the moment.

In the end I will probably discover dynamically the available commands,
and in even longer term BRL-CAD upstream plans to provide command
registration and query of the list of commands plus command info objects
(which can then be mapped 1 to 1 in python-brlcad).

So yes, that will change, but for now I would like to leave it to have
them available.

Cheers,
Csaba


On Sa, 2014-03-08 at 16:23 -0800, Bryan Bishop wrote:
> In brlcad/ged.py:
> 
> > +        self._ged_pointer = result
> > +
> > +    def __enter__(self):
> > +        global _GED_INSTANCE
> > +        self.old_ged_instance = _GED_INSTANCE
> > +        _GED_INSTANCE = self
> > +        return self
> > +
> > +    def __exit__(self, exc_type, exc_val, exc_tb):
> > +        global _GED_INSTANCE
> > +        _GED_INSTANCE = self.old_ged_instance
> > +        self.close()
> > +
> > +    def execute_command(self, ged_function, *args, **kwargs):
> > +        args = list(args)
> > +        command_name = kwargs.get("command_name", ged_function.__name__)
> 
> Ouch. Approximately how many commands are available? I was thinking
> instead of allowing a variable to be passed, each of the functions can
> be defined and they just are each a thin wrapper calling
> execute_command. Alternatively, there could be a class constant that
> defines the list of commands, and then there's a method that is
> responsible for creating the default methods based on the values of
> the class constant (probably a tuple).
> 
> —
> Reply to this email directly or view it on GitHub.
>