The source project of this merge request has been removed.
Way to create programaticaly cobject
I need to create object programaticaly to reuse some behaviour from a CObject to another. That a kind of composition with anonymous CObject.
Then i have a CustomOriginMotor and i want to reuse that feature into another complex CObject.
I update the constructor like that. I think it is not so horrible
class CustomOriginMotor(AbstractMotor):
def __init__(self, motor=None, *args, **kwargs):
AbstractMotor.__init__(self, *args, **kwargs)
if motor:
self.__motor = self.objects["motor"] = motor
And i use it like that into the main CObject:
self.__user_rotation = CustomOriginMotor(motor=self.__rotation)
cool.core.init(self.__user_rotation)
Ca me construit un moteur auquel je peux customer l'origine (une origine utilisateur du gui) pour la tomo. Et ca utilise __rotation (un CObject) qui est le véritable moteur sous-jacent. Si tu as une autre idée pour construire programmatiquement un CObject, je prends.