mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Support keys that have a Handle as parameter, by using the new GetControlDataHandle and SetControlDataHandle methods.
This commit is contained in:
		
							parent
							
								
									1f9249cea9
								
							
						
					
					
						commit
						e9c69bc53e
					
				
					 1 changed files with 21 additions and 0 deletions
				
			
		| 
						 | 
					@ -3,13 +3,31 @@
 | 
				
			||||||
from Controls import *
 | 
					from Controls import *
 | 
				
			||||||
import struct
 | 
					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 = {
 | 
					_codingdict = {
 | 
				
			||||||
	kControlPushButtonDefaultTag : ("b", None, None),
 | 
						kControlPushButtonDefaultTag : ("b", None, None),
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	kControlEditTextTextTag: (None, None, None),
 | 
						kControlEditTextTextTag: (None, None, None),
 | 
				
			||||||
	kControlEditTextPasswordTag: (None, None, None),
 | 
						kControlEditTextPasswordTag: (None, None, None),
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						kControlPopupButtonMenuIDTag: ("h", None, None),
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def SetControlData(control, part, selector, data):
 | 
					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):
 | 
						if not _codingdict.has_key(selector):
 | 
				
			||||||
		raise KeyError, ('Unknown control selector', selector)
 | 
							raise KeyError, ('Unknown control selector', selector)
 | 
				
			||||||
	structfmt, coder, decoder = _codingdict[selector]
 | 
						structfmt, coder, decoder = _codingdict[selector]
 | 
				
			||||||
| 
						 | 
					@ -20,6 +38,9 @@ def SetControlData(control, part, selector, data):
 | 
				
			||||||
	control.SetControlData(part, selector, data)
 | 
						control.SetControlData(part, selector, data)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
def GetControlData(control, part, selector):
 | 
					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):
 | 
						if not _codingdict.has_key(selector):
 | 
				
			||||||
		raise KeyError, ('Unknown control selector', selector)
 | 
							raise KeyError, ('Unknown control selector', selector)
 | 
				
			||||||
	structfmt, coder, decoder = _codingdict[selector]
 | 
						structfmt, coder, decoder = _codingdict[selector]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue