Imbubble

I was getting annoyed with blo.gs paging me in Trillian about each and every update on my watch list. Every time it happened I had to mouse to the tray, click the icon, read the popup window, mouse to the close button (which looks like a Windows Classic button even though I use the Professional/Watercolors theme), click, then go back to what I was doing. I thought to myself, "Self, it'd be a lot easier if blo.gs just popped up standard XP bubble tips to show you when a blog has updated."

So here's an early version of that. It's not blo.gs-specific. Currently it's a little C++ and a tiiiny tiny Python script. In fact, it's so tiny, here it is:

from toc import TocTalk from os import spawnl, P_NOWAIT from pre import sub username = "markpascblog" password = "sammyjankis" class Imbubble(TocTalk): def on_IM_IN(self, data): (sname, flags, message) = data.split(":", 2) message = sub("<[^>]*>", "", message) spawnl(P_NOWAIT, "y0", "y0 %s" % message) if __name__ == '__main__': im = Imbubble(username, password) im._agent = "Imbubble (PyTOC)" im._info = "I look for things. Things that make me go." im.go()

Note it uses Jamie Turner's Py-TOC to wait for any and all messages, then runs y0 with the message for the arguments. At first I used JabberPy, which made for a slightly larger Python program; then I realized I had only imagined blo.gs gave you the option of IMing updates to a Jabber account. Giving Imbubble my Radio AIM account and Radio the new Jabber account sounded OK, except Radio isn't too happy about the Jabber account either: "Can't complete logging in to the Jabber server because the connection was terminated before logging in was complete," it says. So eh. (Apparently it wasn't so hot an idea after all.)

y0 is a similarly tiny C++ Windows API program (which of course means it's much larger but does about as much) that prints its arguments in a bubble tip for ten seconds then exits. I need to add the sender's name to the tip, probably as a title. I'd like to make y0 a Python extension if I can; that would at least solve the problem of how to pass the title in on the command line (that is, don't). y0 also has a very ugly icon; it's an exclamation point from some random blocky face, but dithering to 16 colors ruined it even more than I expected. The icon is another thing you should be able to specify, really. (y0 should also take a link parameter, and run the URL if you click on the bubble. I have issues with the message that's supposed to fire when the bubble goes away, too, or it would let Windows do the waiting and just close whenever the bubble went away. But it doesn't, for some reason I've yet to determine.)

If you wonder why it's called why-zero, it's actually an enleetened "yo." I was going to call it "hey" in homage to the standard BeOS command for sending messages from shell scripts to programs, because y0 does the same thing only sending messages from shell scripts to people, but someone to whom I mentioned it suggested I shouldn't, because there's a standard BeOS command to do the same thing as y0, only instead of sending messages from shell scripts to people, it sends messages from shell scripts to programs. So it's "y0."

Originally (and I think I at least alluded to this last time I mentioned this project) I was going to do it all in Python, with the PythonWin/win32gui extension. Only after downloading and installing the extension, which involved installing Python 2.2.someodd final (I had been using 2.2c1 still), and trying to actually do it did I find win32gui's tray icon interface doesn't support XP bubble tips. Like, at all. It also took a while to find that out thanks to the wonderful documentation. So my own C++ app it is.

TrackBack

Listed below are links to weblogs that reference Imbubble:

» via Mark Paschal from Python Community Server: Noteblog
[Read More]