[Python-checkins] CVS: python/dist/src/Mac/Modules/carbonevt CarbonEvtscan.py,NONE,1.1

Jack Jansen jackjansen@users.sourceforge.net
Mon, 05 Nov 2001 06:44:20 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt
In directory usw-pr-cvs1:/tmp/cvs-serv24622/python/Mac/Modules/carbonevt

Added Files:
	CarbonEvtscan.py 
Log Message:
Carbon Event Manager module donated by Donovan Preston. Checked in as I received them (except for namechange), these will not work as-is, that'll be fixed in a later checkin.

--- NEW FILE: CarbonEvtscan.py ---
# IBCarbonscan.py

import sys
import os
import string
import MacOS

BGENDIR= '/Users/dsp/Documents/python/dist/src/Tools/bgen/bgen'
sys.path.append(BGENDIR)

from bgenlocations import TOOLBOXDIR

from scantools import Scanner, Scanner_OSX

def main():
	print "---Scanning CarbonEvents.h---"
	input = ["CarbonEvents.h"]
	output = "CarbonEventsgen.py"
	defsoutput = TOOLBOXDIR + "CarbonEvents.py"
	scanner = CarbonEvents_Scanner(input, output, defsoutput)
	scanner.scan()
	scanner.close()
	print "--done scanning, importing--"
	import CarbonEventssupport
	print "done"

RefObjectTypes = ["EventRef", 
				"EventQueueRef", 
				"EventLoopRef",
				"EventLoopTimerRef",
				"EventHandlerRef",
				"EventHandlerCallRef",
				"EventTargetRef",
				"EventHotKeyRef",
				]

class CarbonEvents_Scanner(Scanner):
	def destination(self, type, name, arglist):
		classname = "CarbonEventsFunction"
		listname = "functions"
		if arglist:
			t, n, m = arglist[0]
			print "*********", t,
			if t in RefObjectTypes and m == "InMode":
				print "method"
				classname = "CarbonEventsMethod"
				listname = t + "methods"
			else:
				print "not method"
		return classname, listname

	def makeblacklistnames(self):
		return [
			"MacCreateEvent",
			"TrackMouseLocationWithOptions",
			"TrackMouseLocation",
			"TrackMouseRegion",
			"RegisterToolboxObjectClass",
			"UnregisterToolboxObjectClass",
			"ProcessHICommand",
			"GetCFRunLoopFromEventLoop",
			
			"InvokeEventHandlerUPP",
			"InvokeEventComparatorUPP",
			"InvokeEventLoopTimerUPP",

			# Wrote by hand
			"InstallEventHandler",
			"RunApplicationEventLoop",
						
			# Write by hand?
			"GetEventParameter",
			"FlushSpecificEventsFromQueue",
			"FindSpecificEventInQueue",
			"InstallEventLoopTimer",

			# Don't do these because they require a CFRelease
			"CreateTypeStringWithOSType",
			"CopyEvent",
			]

#	def makeblacklisttypes(self):
#		return ["EventComparatorUPP",
#				"EventLoopTimerUPP",
#				#"EventHandlerUPP",
#				"EventComparatorProcPtr",
#				"EventLoopTimerProcPtr",
#				"EventHandlerProcPtr",
#				]
if __name__ == "__main__":
	main()