Curses.Blinkenlights debugging

Asheesh Laroia asheesh at asheesh.org
Tue Apr 6 05:09:32 BST 2010


On Mon, 5 Apr 2010, Kurt Granroth wrote:

> Kurt Granroth <kurt.offlineimap <at> granroth.com> writes:
>> I run offlineimap on a number of systems and the output of
>> Curses.Blinkenlights differs in ways that I have never been able to
>> figure out.
>>
>> For instance, on an Ubuntu system, Curses.Blinkenlights works
>> perfectly and everything looks exactly like you'd expect
>>
>> On a couple of OpenSUSE systems, though, Curses.Blinkenlights
>> *mostly* works.  That is, it shows all of the "text" bits of the
>> output but shows only a blank screen where the LEDs should be.
>>
>> On one OpenSUSE system (nearly identical to the other two),
>> Curses.Blinkenlights doesn't work at all!  Offlineimap throws up
>> an error about an invalid UI and defaults to the TTY.UI.
> [snip]
>
> To follow up to my own post...
>
> The singular OpenSUSE system with the completely non-working
> Curses.Blinkenlights was a dumb user error.  I (mistakenly) assumed
> that python-curses was a dependency of offlinemap and would be
> installed when offlineimap was installed.  It's not.  A quick check
> disabused me of that notion.  I manually installed python-curses and
> now all of my OpenSUSE systems have a working Curses.Blinkenlights.

Packaging bug, I think!

> Working, that is, with the exception of the blank account status area.
> The lower left hand corner is completely black, followed by the
> blinking "leds".
>
> I'm not very familiar with curses but this is python, after all, so
> why not dig around.  I discovered that the invisible text is written
> out in the CursesAccountFrame.drawleadstr(sec) method.  That's just
> doing a simple addstr like everything else so maybe it's color related
> (black text on a black background)?  That method doesn't work with
> color so I trace down a few levels.
>
> Now I'm at Blinkenlights.setupwindow().  I can't find any place where
> the color of the lead string is set.  I *do* see where the color is
> set for a bunch of other parts of the screen, though.  So just for
> fun, I do this:
>
> +++ Curses.py   2010-04-05 08:25:51.000000000 -0700
> --- Curses.py.orig      2010-04-05 08:25:12.000000000 -0700
> @@ -436,8 +436,6 @@
>             s.hotkeys = []
>             for account in accounts:
>                 accountwindow = curses.newwin(1, s.c.width, pos, 0)
> +                color = s.c.getpair(curses.COLOR_WHITE, curses.COLOR_BLACK) |\
> +                                    curses.A_BOLD
> +                accountwindow.bkgd(' ', color)
>
>                 s.af[account].setwindow(accountwindow, acctkeys[index])
>                 s.hotkeys.append(account)
>
> Tadah!  That actually works.  I can see the account status text (lead
> str) finally!
>
> I don't need those lines on an Ubuntu system, though.  So why are they
> needed on my OpenSUSE system?

That one I have no feedback on.

-- Asheesh.

-- 
Q:	Why haven't you graduated yet?
A:	Well, Dad, I could have finished years ago, but I wanted
 	my dissertation to rhyme.




More information about the OfflineIMAP-project mailing list