From a023cce7ec486c85234bc25ad1740191c920d454 Mon Sep 17 00:00:00 2001 From: erick Date: Fri, 30 Oct 2009 22:21:54 +0000 Subject: Tutorial: Changed Tutorial.update_* to update properties instead of replacing the object, Moved validation of state name to a decorator to avoid dupliation --- (limited to 'tutorius/properties.py') diff --git a/tutorius/properties.py b/tutorius/properties.py index a675ba9..427222b 100644 --- a/tutorius/properties.py +++ b/tutorius/properties.py @@ -19,7 +19,7 @@ TutoriusProperties have the same behaviour as python properties (assuming you also use the TPropContainer), with the added benefit of having builtin dialog prompts and constraint validation. """ -from copy import copy +from copy import copy, deepcopy from .constraints import Constraint, \ UpperLimitConstraint, LowerLimitConstraint, \ @@ -93,8 +93,16 @@ class TPropContainer(object): """ Return the list of property names. """ + # Why isn't it simply: + # return self._props.keys() ? return object.__getattribute__(self, "_props").keys() + def get_properties_dict_copy(self): + """ + Return a deep copy of the dictionary of properties from that object. + """ + return deepcopy(self._props) + # Providing the hash methods necessary to use TPropContainers # in a dictionary, according to their properties def __hash__(self): -- cgit v0.9.1