[Python-checkins] python/dist/src/Mac/Modules/evt evtsupport.py,1.15,1.16

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Fri, 29 Nov 2002 15:41:15 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/evt
In directory sc8-pr-cvs1:/tmp/cvs-serv8673/evt

Modified Files:
	evtsupport.py 
Log Message:
Converted the Carbon modules to use PEP252-style objects, with
descriptors in stead of manual getattr hooks to get at attributes
of the objects.

For Qd I have in stead gotten rid of most of the attribute access
in favor of the carbon-style accessor methods (with the exception
of visRgn, to be done later), and of the Carbon.Qd.qd global object,
for which accessor functions are also available.

For List I have fixed the fact that various methods were incorrectly
generated as functions.

CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with
basechain, so it will have to wait for PEP253 support.


Index: evtsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/evtsupport.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** evtsupport.py	25 Mar 2002 00:31:58 -0000	1.15
--- evtsupport.py	29 Nov 2002 23:40:43 -0000	1.16
***************
*** 44,66 ****
  """
  
- class MyObjectDefinition(GlobalObjectDefinition):
- 	def outputCheckNewArg(self):
- 		Output("if (itself == NULL) return PyMac_Error(resNotFound);")
- 	def outputCheckConvertArg(self):
- 		OutLbrace("if (DlgObj_Check(v))")
- 		Output("*p_itself = ((WindowObject *)v)->ob_itself;")
- 		Output("return 1;")
- 		OutRbrace()
- 		Out("""
- 		if (v == Py_None) { *p_itself = NULL; return 1; }
- 		if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
- 		""")
- 
  # From here on it's basically all boiler plate...
  
  # Create the generator groups and link them
  module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
- ##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
- ##module.addobject(object)
  
  # Create the generator classes used to populate the lists
--- 44,51 ----
***************
*** 70,74 ****
  # Create and populate the lists
  functions = []
- ##methods = []
  execfile(INPUTFILE)
  
--- 55,58 ----
***************
*** 81,85 ****
  # (in a different wordl the scan program would generate this)
  for f in functions: module.add(f)
- ##for f in methods: object.add(f)
  
  WaitNextEvent_body = """
--- 65,68 ----