Thursday, December 30th, 2004

PyObjC 1.2 was released last night. And here's the first VoodooPad plugin written in it. Talk about super easy to do...

import objc
VPPlugin = objc.lookUpClass('VPPlugin')
class PPlugin (VPPlugin):
  __bundle_hack__ = True
  def pluginCall_(self, pluginWindowController):
    textStorage = pluginWindowController.textView().textStorage()
    textStorage.mutableString().insertString_atIndex_(u"Hello World!", 0)

  def didRegister(self):
    pluginManager = self.pluginManager()

    #imagine this was on one line:
      u"Say Hello World",

download the source, type "python py2app" in the terminal to build. Double click the plugin to install.

(Updated to use unicode strings- hint via Bob Ippolito)

comments (2)   # posted 10:21 am (uct-6)