From 582c67c34e5df3e5a9e0030f04869cab152f9187 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Wed, 19 Mar 2014 15:19:13 +0000
Subject: [PATCH] widgets_list  bugfix - wrong variable name; comments in
 properties

---
 tkprop/properties.py   | 43 +++++++++++++++++++++++-------------------
 tkprop/widgets_list.py |  2 +-
 2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/tkprop/properties.py b/tkprop/properties.py
index 99d3d26e8..582371938 100644
--- a/tkprop/properties.py
+++ b/tkprop/properties.py
@@ -19,9 +19,8 @@
 #     myPropObj = PropObj()
 #
 #
-#     # access the property value as normal:
+#     # Access the property value as a normal attribute:
 #     myPropObj.myProperty = True
-#
 #     myPropObj.myProperty
 #
 #     # >>> True
@@ -33,26 +32,28 @@
 #     # >>> <tkprops.tkprop.Boolean at 0x1045e2710>
 #
 #
-#     # access the underlying Tkinter control variable:
+#     # access the underlying Tkinter control variable
+#     # (there are caveats for List properties):
 #     myPropObj.getTkVar('myProperty')
 #
 #     # >>> <tkinter.BooleanVar instance at 0x1047ef518>
 #
 #
 #     # Receive notification of property value changes
-#     def myPropertyChanged(instance, propName, newValue):
-#         print('New value for {}: {}'.format(propname, newValue)
+#     def myPropertyChanged(instance, name, value):
+#         print('New value for {}: {}'.format(name, value))
 #
 #     PropObj.myProperty.addListener(
 #         myPropObj, 'myListener', myPropertyChanged)
+# 
+#     myPropObj.myProperty = False
+#
+#     # >>> New value for myProperty: False
 #
 #
 #     # Remove a previously added listener
 #     PropObj.myProperty.removeListener(myPropObj, 'myListener')
 #
-#
-#
-#
 # 
 # Lots of the code in this file is probably very confusing. First
 # of all, you will need to understand python descriptors.
@@ -150,8 +151,10 @@ class PropertyBase(object):
         PropertyBase object as a property, a _TkVarProxy instance
         is created and attached as an attribute of the parent.
         Subclasses should call this superclass constructor,
-        passing it the tkvartype and default value, and an optional
-        custom validation function.
+        passing it the tkVarType and default value, and an optional
+        custom validation function specified by the application
+        code. Built in validation should be specified by overriding
+        the validate method.
         """
         self.label             = None
         self.tkVarType         = tkVarType
@@ -643,15 +646,16 @@ class FilePath(String):
 class _ListWrapper(object):
     """
     Used by the List property type, defined below. An object which
-    acts like a list, but for which items are embedded in an
-    appropriate Tkinter variable, a minimum/maximum list length may
-    be enforced, and value/type constraints enforced on the values
-    added to it. Not all list operations are supported.  
+    acts like a list, but for which items are embedded in a
+    _TkVarProxy object, minimum/maximum list length may be enforced,
+    and value/type constraints enforced on the values added to it.
+    
+    Not all list operations are supported.  
 
     A _TkVarProxy object is created for each item that is added to
     the list.  When a list value is changed, instead of a new
     variable being created, the value of the existing variable
-    is changed.  References to every Tk variable in the list may
+    is changed.  References to the list of _TkVarProxy objects may
     be accessed via the _tkVars attribute of the _ListWrapper
     object.
     """
@@ -700,10 +704,11 @@ class _ListWrapper(object):
     def tkVar(self):
         """
         There is a bit of trickery going on here.  The HasProperties
-        class thinks that all properties are represented by a _TkVarProxy
-        object, which encapsulates a Tkinter control variable, which in
-        turn controls the property value. The Tkinter control variable
-        is accessible via the 'tkVar' attribute of the _TkVarProxy class.
+        class thinks that all properties are represented by a single
+        _TkVarProxy object, which encapsulates a Tkinter control
+        variable, which in turn controls the property value. The
+        Tkinter control variable is accessible via the 'tkVar'
+        attribute of the _TkVarProxy class.
         
         However, this is not possible for List properties, because a single
         List property has multiple values, and is thus represented by a
diff --git a/tkprop/widgets_list.py b/tkprop/widgets_list.py
index f7484d1fc..7cb8e24ca 100644
--- a/tkprop/widgets_list.py
+++ b/tkprop/widgets_list.py
@@ -32,7 +32,7 @@ def _pasteDataDialog(parent, listProp, propObj):
       - propObj:  The tkprop.HasProperties object which owns listProp.    
     """
 
-    listObj = propObj.getTkVar(listObj.label)
+    listObj = propObj.getTkVar(listProp.label)
     
     window = tk.Toplevel()
     frame  = ttk.Frame(window)
-- 
GitLab