The Shape of Everything
A website mostly about Mac stuff, written by August "Gus" Mueller
» Acorn
» Retrobatch
» Mastodon
» Instagram
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
December 30, 2004
(This post is from my old, old, super old site. My views have changed over the years, hopefully my writing has improved, and there is now more than a handful of folks reading my site. Enjoy.)

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 objc.registerPlugin('PPlugin') 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:     pluginManager.addPluginsMenuTitle_withSuperMenuTitle     target_action_keyEquivalent_keyEquivalentModifierMask(       u"Say Hello World",       u"Python",       self,       "pluginCall:",       "",       0     )

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)

-- posted 10:21 am