From acde88ad401904abab55bfc259cb74c6d5e661a6 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 29 Dec 2009 18:23:05 +0100 Subject: fixed widget problems --- ranger/gui/defaultui.py | 2 +- ranger/gui/displayable.py | 12 ++++++++++-- ranger/gui/widgets/notify.py | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ranger/gui/defaultui.py b/ranger/gui/defaultui.py index 135ef0b5..462d394d 100644 --- a/ranger/gui/defaultui.py +++ b/ranger/gui/defaultui.py @@ -42,7 +42,7 @@ class DefaultUI(UI): UI.update_size(self) y, x = self.env.termsize - notify_hei = self.notify.requested_height + notify_hei = min(max(1, y - 4), self.notify.requested_height) self.filelist_container.resize(1, 0, y - 1 - notify_hei, x) self.pman.resize(1, 0, y - 1 - notify_hei, x) diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py index f54a3fc7..a9c297b5 100644 --- a/ranger/gui/displayable.py +++ b/ranger/gui/displayable.py @@ -56,12 +56,20 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): def color(self, keylist = None, *keys): """Change the colors from now on.""" keys = combine(keylist, keys) - self.win.attrset(self.colorscheme.get_attr(*keys)) + attr = self.colorscheme.get_attr(*keys) + try: + self.win.attrset(attr) + except: + pass def color_at(self, y, x, wid, keylist = None, *keys): """Change the colors at the specified position""" keys = combine(keylist, keys) - self.win.chgat(y, x, wid, self.colorscheme.get_attr(*keys)) + attr = self.colorscheme.get_attr(*keys) + try: + self.win.chgat(y, x, wid, attr) + except: + pass def color_reset(self): """Change the colors to the default colors""" diff --git a/ranger/gui/widgets/notify.py b/ranger/gui/widgets/notify.py index e3f972ee..8b783fdb 100644 --- a/ranger/gui/widgets/notify.py +++ b/ranger/gui/widgets/notify.py @@ -33,7 +33,7 @@ class Notify(Widget): self.color_at(i, 0, self.wid,\ 'in_notify', 'background', how) self.color('in_notify', 'message', how) - self.win.addnstr(i, 0, msg.text, self.wid) + self.addstr(i, 0, msg.text) i += 1 self.color_reset() -- cgit 1.4.1-2-gfad0