MCP1624 board update + Anki/Pidgin update

I'd previously etched a board for a MCP1624 boost converter. I drilled the holes for the vias. I have a Dremel and a fairly flimsy drill press for it, as well as some small carbide bits I bought used on eBay. They're still plenty sharp enough for drilling PCBs and the Dremel goes up to 30K rpm so there's little risk of breaking them. I drilled holes big enough for the core of some wire-wrapping wire. I drilled away the copper from the back of the positive connectors for the input and output to avoid shorting them to ground. This is easier than etching away the copper. I then noticed that I'd routed the pins backwards and it's not going to work. I could continue anyway to test my soldering skill but I don't want to waste my remaining chip so I abandoned it.

Because I've committed to posting this blog update using Beeminder, I'll instead post about something else. The most practically useful thing I've done so far is the Anki plugin for Pidgin integration, so I'll work on improving that.

Unicode support

Anki, and by extension any Anki add-on, is written in Python 2. Python 2 strings default to plain ASCII. My code prints a debug message to the console when an IM is received, and this raises an exception if it contains a non-ASCII character:

ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 230, in maybe_handle_message
    self._handler(*args, **kwargs)
  File "/home/___/Anki/addons/test.py", line 48, in imReceived
    print sender, "said:", message, threading.currentThread()
UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-8: ordinal not in range(128)

Unicode in Python 2 turns out to interact with the current locale and file redirections (see http://pythonhosted.org/kitchen/unicode-frustrations.html, so fixing this is not immediately obvious. The simple solution is to remove the debug messages, which shouldn't really be there in the release version anyway.

GUI

Sometimes you need to work for less than your usual timebox (eg. when adding new cards) but it's not certain how long that time will be. To avoid misleading reporting it would be better to disable the status reporting, and it would be useful is there was some easy way to do that from the Anki GUI.

The Anki documentation shows how to add a menu item. Qt supports menu items with checkboxes, using the setCheckable method of QAction. The plugin will only send commands to Pidgin over DBUS if the menu item checkbox is enabled. The state of this checkbox will not be saved when Anki is closed, and it will default to enabled each time, to reduce the risk of forgetting to turn it on. There is no need for any more permanent shutdown method because the add-on can easily be removed.

The updated code is available from my Github account as usual.

blogroll