Acquire lock before updating the CursesLogHandler window
Make sure that we refresh the screen atomically, since the emit() function may be called by more that one threads at a time. Also, modify the draw_bannerwin() method which used to fail in case the window would become too small. Make sure that the provided offsets to the window.addstr() method are properly bounded. Closes #160: blinkenlights display is broken Tested-by: Cyril Brulebois Tested-by: Gaudenz Steinlin Signed-off-by: Ilias Tsitsimpis <i.tsitsimpis@gmail.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
2b1c842a7d
commit
7bc54d241c
@ -315,11 +315,11 @@ class CursesLogHandler(logging.StreamHandler):
|
|||||||
y,x = self.ui.logwin.getyx()
|
y,x = self.ui.logwin.getyx()
|
||||||
if y or x: self.ui.logwin.addch(10) # no \n before 1st item
|
if y or x: self.ui.logwin.addch(10) # no \n before 1st item
|
||||||
self.ui.logwin.addstr(log_str, color)
|
self.ui.logwin.addstr(log_str, color)
|
||||||
|
self.ui.logwin.noutrefresh()
|
||||||
|
self.ui.stdscr.refresh()
|
||||||
finally:
|
finally:
|
||||||
self.ui.unlock()
|
self.ui.unlock()
|
||||||
self.ui.tframe_lock.release()
|
self.ui.tframe_lock.release()
|
||||||
self.ui.logwin.noutrefresh()
|
|
||||||
self.ui.stdscr.refresh()
|
|
||||||
|
|
||||||
class Blinkenlights(UIBase, CursesUtil):
|
class Blinkenlights(UIBase, CursesUtil):
|
||||||
"""Curses-cased fancy UI.
|
"""Curses-cased fancy UI.
|
||||||
@ -613,9 +613,10 @@ class Blinkenlights(UIBase, CursesUtil):
|
|||||||
self.bannerwin.bkgd(' ', color) # Fill background with that color
|
self.bannerwin.bkgd(' ', color) # Fill background with that color
|
||||||
string = "%s %s" % (offlineimap.__productname__,
|
string = "%s %s" % (offlineimap.__productname__,
|
||||||
offlineimap.__version__)
|
offlineimap.__version__)
|
||||||
self.bannerwin.addstr(0, 0, string, color)
|
spaces = " " * max(1, (self.width - len(offlineimap.__copyright__)
|
||||||
self.bannerwin.addstr(0, self.width -len(offlineimap.__copyright__) -1,
|
- len(string) - 1))
|
||||||
offlineimap.__copyright__, color)
|
string = "%s%s%s" % (string, spaces, offlineimap.__copyright__)
|
||||||
|
self.bannerwin.addnstr(0, 0, string, self.width - 1, color)
|
||||||
self.bannerwin.noutrefresh()
|
self.bannerwin.noutrefresh()
|
||||||
|
|
||||||
def draw_logwin(self):
|
def draw_logwin(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user