From 5511467f6f7eab041b53563c883f72cd7547402f Mon Sep 17 00:00:00 2001 From: mike Date: Wed, 02 Dec 2009 22:36:46 +0000 Subject: Creator : Updating for working property updates from activity to Shell (HACK alert in saveTutorial!!!) --- (limited to 'tutorius/properties.py') diff --git a/tutorius/properties.py b/tutorius/properties.py index cc76748..85e8aa5 100644 --- a/tutorius/properties.py +++ b/tutorius/properties.py @@ -36,6 +36,9 @@ from .propwidgets import PropWidget, \ FloatPropWidget, \ IntArrayPropWidget +import logging +LOGGER = logging.getLogger("properties") + class TPropContainer(object): """ A class containing properties. This does the attribute wrapping between @@ -62,6 +65,12 @@ class TPropContainer(object): copy(propinstance.default)) self.__id = hash(uuid.uuid4()) + # The differences dictionary. This is a structure that holds all the + # modifications that were made to the properties since the action + # was last installed or the last moment the notification was executed. + # Every property change will be logged inside it and it will be sent + # to the creator to update its action edition dialog. + self._diff_dict = {} def __getattribute__(self, name): """ @@ -96,8 +105,11 @@ class TPropContainer(object): try: # We attempt to get the property object with __getattribute__ # to work through inheritance and benefit of the MRO. - return props.__setitem__(name, + real_value = props.__setitem__(name, object.__getattribute__(self, name).validate(value)) + LOGGER.debug("Action :: caching %s = %s in diff dict"%(name, str(value))) + self._diff_dict[name] = value + return real_value except AttributeError: return object.__setattr__(self, name, value) -- cgit v0.9.1