gusmueller
Saturday, January 21st, 2006

Jonathan Wight of Toxic Software (super leet programmer extrodonaire++) took up a little project that I wanted to do and wrote a "meta plugin" for VoodooPad that works just like my Lua plugin does. Only for Python, using PyObjC. How cool is that?

Download plugin + source: http://flyingmeat.com/fs/contrib/voodoopad/PythonPluginEnabler.zip.

It requires VoodooPad 2.5.3, and when installed (double with the click) it installs some examples in: ~/Library/Application Support/VoodooPad/Script PlugIns/ which you can take and copy and use with the full power of PyObjC goodness.

Here's a quick example that just selects the current line:

VPScriptSuperMenuTitle = "Select"
VPScriptMenuTitle = "Current Line (python)"

def main(windowController, *args, **kwargs):
    windowController.textView().selectLine_(None)


It's pretty easy and shows up in the menus as "Plugin->Select->Current Line (python)"

And here's an example that creates a new page with the current date and inserts the link at the current cursor position.

textView = windowController.textView()
document = windowController.document()
pageName = time.strftime('%Y.%m.%d')
document.createNewVPDataWithKey_(pageName)
textView.insertText_(pageName)


Thanks Jonathan!

comments (5)   # posted 5:03 pm (uct-6)