Пример #1
0
 def boundAllNewCommands(self):
     """
     For all commands that are not attribute of the object instance nor of the
     class, a new attribute of the instance is created to bound the command.
     """
     cmdList = wrap.entity_list_commands(self.obj)
     cmdList = filter(lambda x: not x in self.__dict__, cmdList)
     cmdList = filter(lambda x: not x in self.__class__.__dict__, cmdList)
     for cmd in cmdList:
         self.boundNewCommand( cmd )
Пример #2
0
 def boundClassCommands(self):
     """
     This static function has to be called from a class heritating from Entity.
     It should be called only once. It parses the list of commands obtained from
     c++, and bind each of them to a python class method.
     """
     # Get list of commands of the Entity object
     commands = wrap.entity_list_commands(self.obj)
     # for each command, add a method with the name of the command
     for cmdstr in commands:
         docstr = wrap.entity_get_command_docstring(self.obj, cmdstr)
         cmdpy = Entity.createCommandBind(cmdstr, docstr)
         setattrpath(self.__class__, cmdstr, cmdpy)
Пример #3
0
 def commands(self):
     """
     Return the list of commands.
     """
     return wrap.entity_list_commands(self.obj)