From 30785f2bdbfbaed60037d598561e7fed60c64256 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 13 Apr 2010 12:24:36 +0200 Subject: gui.bar: clean up --- ranger/gui/bar.py | 6 +----- ranger/gui/widgets/titlebar.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/ranger/gui/bar.py b/ranger/gui/bar.py index 0ef840a4..8b8eb33c 100644 --- a/ranger/gui/bar.py +++ b/ranger/gui/bar.py @@ -96,9 +96,6 @@ class BarSide(list): def add(self, string, *lst, **kw): cs = ColoredString(string, self.base_color_tag, *lst) cs.__dict__.update(kw) - if 'fixedsize' in kw: - kw['fixed'] = kw['fixedsize'] - del kw['fixedsize'] self.append(cs) def add_space(self, n=1): @@ -121,11 +118,10 @@ class BarSide(list): class ColoredString(object): - fixed = False - def __init__(self, string, *lst): self.string = string self.lst = lst + self.fixed = False def cut_off(self, n): n = max(n, min(len(self.string), 1)) diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index ddcd03c3..b815a07e 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -106,16 +106,16 @@ class TitleBar(Widget): else: clr = 'good' - bar.add(self.env.username, 'hostname', clr, fixedsize=True) - bar.add('@', 'hostname', clr, fixedsize=True) - bar.add(self.env.hostname, 'hostname', clr, fixedsize=True) - bar.add(':', 'hostname', clr, fixedsize=True) + bar.add(self.env.username, 'hostname', clr, fixed=True) + bar.add('@', 'hostname', clr, fixed=True) + bar.add(self.env.hostname, 'hostname', clr, fixed=True) + bar.add(':', 'hostname', clr, fixed=True) pathway = self.env.pathway if self.settings.tilde_in_titlebar and \ self.fm.env.cwd.path.startswith(self.env.home_path): pathway = pathway[self.env.home_path.count('/')+1:] - bar.add('~/', 'directory', fixedsize=True) + bar.add('~/', 'directory', fixed=True) for path in pathway: if path.islink: @@ -124,22 +124,22 @@ class TitleBar(Widget): clr = 'directory' bar.add(path.basename, clr, directory=path) - bar.add('/', clr, fixedsize=True, directory=path) + bar.add('/', clr, fixed=True, directory=path) if self.env.cf is not None: - bar.add(self.env.cf.basename, 'file', fixedsize=True) + bar.add(self.env.cf.basename, 'file', fixed=True) def _get_right_part(self, bar): kb = str(self.env.keybuffer) self.old_keybuffer = kb - bar.addright(kb, 'keybuffer', fixedsize=True) - bar.addright(' ', 'space', fixedsize=True) + bar.addright(kb, 'keybuffer', fixed=True) + bar.addright(' ', 'space', fixed=True) self.tab_width = 0 if len(self.fm.tabs) > 1: for tabname in self.fm._get_tab_list(): self.tab_width += len(str(tabname)) + 1 clr = 'good' if tabname == self.fm.current_tab else 'bad' - bar.addright(' '+str(tabname), 'tab', clr, fixedsize=True) + bar.addright(' '+str(tabname), 'tab', clr, fixed=True) def _print_result(self, result): import _curses -- cgit 1.4.1-2-gfad0