Skip to content
Snippets Groups Projects
Commit 4677b377 authored by Nicolas Mansard's avatar Nicolas Mansard Committed by Nicolas Mansard
Browse files

Added a method to bound new commands dynamically.

parent 58937676
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
Author: Florent Lamiraux
"""
import wrap, signal_base
import wrap, signal_base, new
entityClassNameList = []
if 'display' not in globals().keys():
......@@ -132,6 +132,16 @@ class Entity (object) :
except:
object.__getattr__(self, name)
def boundNewCommand(self,cmdName):
"""
At construction, all existing commands are bound directly in the class.
This method enables to bound new commands dynamically. These new bounds
are not made with the class, but directly with the object instance.
"""
docstring = wrap.entity_get_command_docstring(self.obj, cmdName)
cmd = commandMethod(cmdName,docstring)
setattr(self,cmdName,new.instancemethod( cmd, self,self.__class__))
# Script short-cuts: don't use this syntaxt in python coding,
# use it for debuging online only!
@property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment