]> granicus.if.org Git - python/commitdiff
Support keys that have a Handle as parameter, by using the new GetControlDataHandle...
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 19 Dec 1999 00:06:52 +0000 (00:06 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 19 Dec 1999 00:06:52 +0000 (00:06 +0000)
Mac/Lib/lib-toolbox/ControlAccessor.py

index d3952f7b1f91eaa8348ae4c776e618bc411f504b..93805ab11b389a49f66c329fd8651c81062fc87e 100644 (file)
@@ -3,13 +3,31 @@
 from Controls import *
 import struct
 
+# These needn't go through this module, but are here for completeness
+def SetControlDataHandle(control, part, selector, data):
+       control.SetControlDataHandle(part, selector, data)
+       
+def GetControlDataHandle(control, part, selector):
+       return control.GetControlDataHandle(part, selector)
+       
+_accessdict = {
+       kControlPopupButtonMenuHandleTag: (SetControlDataHandle, GetControlDataHandle),
+}
+
 _codingdict = {
        kControlPushButtonDefaultTag : ("b", None, None),
+       
        kControlEditTextTextTag: (None, None, None),
        kControlEditTextPasswordTag: (None, None, None),
+       
+       kControlPopupButtonMenuIDTag: ("h", None, None),
 }
 
 def SetControlData(control, part, selector, data):
+       if _accessdict.has_key(selector):
+               setfunc, getfunc = _accessdict[selector]
+               setfunc(control, part, selector, data)
+               return
        if not _codingdict.has_key(selector):
                raise KeyError, ('Unknown control selector', selector)
        structfmt, coder, decoder = _codingdict[selector]
@@ -20,6 +38,9 @@ def SetControlData(control, part, selector, data):
        control.SetControlData(part, selector, data)
        
 def GetControlData(control, part, selector):
+       if _accessdict.has_key(selector):
+               setfunc, getfunc = _accessdict[selector]
+               return getfunc(control, part, selector, data)
        if not _codingdict.has_key(selector):
                raise KeyError, ('Unknown control selector', selector)
        structfmt, coder, decoder = _codingdict[selector]