Hi, I am writing a SIMBL plugin for Mail.app, so far it loads and the correct method has been swizzled. However, i would like to call the original method and that is where the problem lies.
If you could see the code(below), in console.app, i get the following error because of old(x) " 2007-06-26 03:42:04.053 Mail[2600] *** NSRunLoop ignoring exception 'exceptions.TypeError: 'int' object is not callable' that raised during posting of delayed perform with target 5bd1b10 and selector '_finalSetup' " #saved as MailDump.py import objc from Foundation import * from AppKit import * WebMessageEditor = objc.lookUpClass('WebMessageEditor') old=1 swizzled = {} #http://end.com/svn/BionicDOM/tags/1.0/ BionicDOMPalette.py def swizzle(cls, SEL, func): NSLog(cls) oldIMP = cls.instanceMethodForSelector_(SEL) oldMethod = objc.selector(oldIMP.__call__, selector=oldIMP.selector, signature=oldIMP.signature) newMethod = objc.selector(func, selector=oldIMP.selector, signature=oldIMP.signature) objc.classAddMethod(cls, 'OLD'+SEL, oldMethod) objc.classAddMethod(cls, SEL, newMethod) swizzled[(cls, SEL, func)] = (oldMethod, newMethod, oldIMP) return(oldMethod) def updateContentsToShowSignature_(self,x): NSLog("OHMYGOD") old(x) class MWM(NSObject): plugin = None # We will retain a pointer to the plugin to prevent it being garbage-collected @classmethod def sharedInstance(cls): # not strictly necessary, but we only need one instance of our object if not cls.plugin: cls.plugin = cls.alloc().init() return cls.plugin @classmethod def initialize(cls): old=swizzle(WebMessageEditor, 'updateContentsToShowSignature:', updateContentsToShowSignature_) #setup.py # from distutils.core import setup # import py2app # plist = dict( # NSPrincipalClass='MWM', # CFBundleName='MWM', # SIMBLTargetApplications=[dict(BundleIdentifier='com.apple.mail', MinBundleVersion='000', MaxBundleVersion='999920')], # ) # setup( # plugin=['MailDump.py'], # options=dict(py2app=dict( # extension='.bundle', # plist=plist, # )), # ) #Run the following #python2.4 setup.py py2app -A #and copy the dist/MailDump.bundle to ~/Library/Application Support/ SIMBL/Plugins/ -- http://mail.python.org/mailman/listinfo/python-list