Ramshackle code

This is a place to dump random (thoroughly ramshackle) code, explanations and ideas, mostly related to Gnome/GTK+ software.

All code here is released under GPL version 2 or later, unless there is some obligation from the program being extended, or from other factors, to release it under something else... in which case, it's released under that. Can you tell I don't care?

Reinteract custom results

These are released under the same license as Reinteract: the two-clause BSD license.

rematplotlib

This reinteract custom result uses the default matplotlib plotting backend, and does all sorts of awful stuff to make it more flexible, at the cost of being slower and probably fragile.

The idea is that you can create an 'Axes' object, queue up matplotlib drawing-related commands (i.e., commands that would work on a matplotlib.axes.Axes), and display at the end. Currently, this only works for setter-type calls that modify the state of the Axes; getters (of any kind, properties included) don't work, and quite possibly never will.

Download: rematplotlib.py
Example worksheet: mpl.rws


 

reTeX

This reTeX reinteract result takes a raw Python string and returns a custom result that embeds a rendered version of the passed TeX string into the reinteract worksheet.

Download: retex.py
Example worksheet: tex.pyw



Meld

Deskbar extensions

DOI lookup for Deskbar

This is a simple extension to detect entries of the form 10.2001/blah.2008.1337 (or similar) and provide an option to resolve them via http://dx.doi.org/.

The use case is quickly accessing a paper by copying from a web page/PDF and resolving it using deskbar.  In truth, a highly-intrusive epiphany extension and a similarly intrusive evince extension would do the job better, but the as far as I know, the necessary hooks aren't there in epiphany, and evince doesn't have extension/plugin support at all.

This extension uses a horrible hand-crafted regex that is in no way reliable, and almost certainly misses edge cases, but it mostly works. Part of the blame lies with DOIs themselves, for imposing so few restrictions on format, but that can't be helped.

Version 0.1

First release that is somewhat functional.

Download: doi.py

Known issues:

  • displayed result doesn't actually indicate what it's going to do (i.e., it uses "Open" rather than "Resolve ... DOI" or similar)
  • the regex is known to be overgeneral and generally poor
  • the extension needs to be reordered above the web extension (because DOIs look vaguely like IP addresses?) but this doesn't seem to work anyway (Deskbar bug?)

Epiphany extensions

Not here yet...