Date: 13 Jan 2003 11:20:56 -0000 From: Sergei Kolobov <sergei@kolobov.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: nbm@FreeBSD.org Subject: ports/47013: [PATCH] Fix curses bug in mail/offlineimap 3.99.7 Message-ID: <20030113112056.4214.qmail@outpost.globcon.net>
next in thread | raw e-mail | index | archive | help
>Number: 47013 >Category: ports >Synopsis: [PATCH] Fix curses bug in mail/offlineimap 3.99.7 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Jan 13 03:30:01 PST 2003 >Closed-Date: >Last-Modified: >Originator: Sergei Kolobov >Release: FreeBSD 4.7-STABLE i386 >Organization: >Environment: System: FreeBSD outpost.globcon.net 4.7-STABLE FreeBSD 4.7-STABLE #0: Mon Oct 14 02:23:23 MSD 2002 sgk@outpost.globcon.net:/data/FreeBSD/obj/data/FreeBSD/src/sys/OUTPOST i386 >Description: The new and shiny Curses.Blinkenlights user interfaces has a bug that makes it useless under FreeBSD - all messages are displayed with black foreground on black background! The author has published a patch that will be included in the next upstream (3.99.8, date of release is not known). - Fix a bug with curses initialization (patch supplied by the OfflineIMAP's author, John Goerzen) - Bump PORTREVISION File added: - files/patch-ui::Curses.py (new) Port maintainer - nbm@FreeBSD.org - has been copied. >How-To-Repeat: >Fix: --- offlineimap-3.99.7_1.patch begins here --- diff -ruN --exclude=CVS offlineimap/Makefile offlineimap-3.99.7_1/Makefile --- offlineimap/Makefile Thu Jan 9 20:44:05 2003 +++ offlineimap-3.99.7_1/Makefile Mon Jan 13 14:07:37 2003 @@ -7,6 +7,7 @@ PORTNAME= offlineimap PORTVERSION= 3.99.7 +PORTREVISION= 1 CATEGORIES= mail python MASTER_SITES= http://gopher.quux.org:70/devel/offlineimap/ DISTNAME= ${PORTNAME}_${PORTVERSION} diff -ruN --exclude=CVS offlineimap/files/patch-ui::Curses.py offlineimap-3.99.7_1/files/patch-ui::Curses.py --- offlineimap/files/patch-ui::Curses.py Thu Jan 1 03:00:00 1970 +++ offlineimap-3.99.7_1/files/patch-ui::Curses.py Mon Jan 13 13:51:47 2003 @@ -0,0 +1,101 @@ +--- offlineimap/ui/Curses.py (original) ++++ offlineimap/ui/Curses.py Fri Jan 10 11:47:36 2003 +@@ -29,12 +29,18 @@ + + class CursesUtil: + def __init__(self): +- self.pairs = {self._getpairindex(curses.COLOR_WHITE, +- curses.COLOR_BLACK): 0} +- self.start() +- self.nextpair = 1 + self.pairlock = Lock() + self.iolock = MultiLock() ++ self.start() ++ ++ def initpairs(self): ++ self.pairlock.acquire() ++ try: ++ self.pairs = {self._getpairindex(curses.COLOR_WHITE, ++ curses.COLOR_BLACK): 0} ++ self.nextpair = 1 ++ finally: ++ self.pairlock.release() + + def lock(self): + self.iolock.acquire() +@@ -63,6 +69,8 @@ + return '%d/%d' % (fg,bg) + + def getpair(self, fg, bg): ++ if not self.has_color: ++ return 0 + pindex = self._getpairindex(fg, bg) + self.pairlock.acquire() + try: +@@ -96,6 +104,7 @@ + self.stdscr.clear() + self.stdscr.refresh() + (self.height, self.width) = self.stdscr.getmaxyx() ++ self.initpairs() + + def stop(self): + if not hasattr(self, 'stdscr'): +@@ -200,7 +209,10 @@ + + def display(self): + def lockedstuff(): +- self.window.addstr(self.y, self.x, '.', self.color) ++ if self.getcolor() == 'black': ++ self.window.addstr(self.y, self.x, ' ', self.color) ++ else: ++ self.window.addstr(self.y, self.x, '.', self.color) + self.c.stdscr.move(self.c.height - 1, self.c.width - 1) + self.window.refresh() + self.c.locked(lockedstuff) +@@ -406,9 +418,12 @@ + s.c.unlock() + + def setupwindow_drawbanner(s): +- s.bannerwindow.bkgd(' ', curses.A_BOLD | \ +- s.c.getpair(curses.COLOR_WHITE, +- curses.COLOR_BLUE)) ++ if s.c.has_color: ++ color = s.c.getpair(curses.COLOR_WHITE, curses.COLOR_BLUE) | \ ++ curses.A_BOLD ++ else: ++ color = curses.A_REVERSE ++ s.bannerwindow.bkgd(' ', color) # Fill background with that color + s.bannerwindow.addstr("%s %s" % (version.productname, + version.versionstr)) + s.bannerwindow.addstr(0, s.bannerwindow.getmaxyx()[1] - len(version.copyright) - 1, +@@ -417,7 +432,11 @@ + s.bannerwindow.noutrefresh() + + def setupwindow_drawlog(s): +- s.logwindow.bkgd(' ', s.c.getpair(curses.COLOR_WHITE, curses.COLOR_BLACK)) ++ if s.c.has_color: ++ color = s.c.getpair(curses.COLOR_WHITE, curses.COLOR_BLACK) ++ else: ++ color = curses.A_NORMAL ++ s.logwindow.bkgd(' ', color) + for line, color in s.text: + s.logwindow.addstr("\n" + line, color) + s.logwindow.noutrefresh() +@@ -501,7 +520,7 @@ + x = Blinkenlights(None) + x.init_banner() + import time +- time.sleep(10) ++ time.sleep(5) + x.c.stop() + fgs = {'black': curses.COLOR_BLACK, 'red': curses.COLOR_RED, + 'green': curses.COLOR_GREEN, 'yellow': curses.COLOR_YELLOW, +@@ -536,7 +555,7 @@ + win4.refresh() + x.stdscr.refresh() + import time +- time.sleep(40) ++ time.sleep(5) + x.stop() + print x.has_color + print x.height --- offlineimap-3.99.7_1.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030113112056.4214.qmail>