Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius/properties.py
diff options
context:
space:
mode:
Diffstat (limited to 'tutorius/properties.py')
-rw-r--r--tutorius/properties.py14
1 files changed, 13 insertions, 1 deletions
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)