diff options
author | hut <hut@lavabit.com> | 2009-12-23 19:40:28 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-12-23 19:40:28 +0100 |
commit | 9a78b6449cb256fbe46e05f5a134a6e512893450 (patch) | |
tree | 0f96208a1146722f97221524225f3db56718244b /ranger | |
parent | 93454fb6cc2c0b77f7c44128561958bde7ed2890 (diff) | |
download | ranger-9a78b6449cb256fbe46e05f5a134a6e512893450.tar.gz |
fixed throbber
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/fm.py | 11 | ||||
-rw-r--r-- | ranger/gui/defaultui.py | 9 | ||||
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 7 |
3 files changed, 21 insertions, 6 deletions
diff --git a/ranger/fm.py b/ranger/fm.py index 186694e5..ce62e94c 100644 --- a/ranger/fm.py +++ b/ranger/fm.py @@ -62,11 +62,16 @@ class FM(Actions): while True: try: self.bookmarks.update_if_outdated() + self.loader.work() + if hasattr(self.ui, 'throbber'): + if self.loader.has_work(): + self.ui.throbber(self.loader.status) + else: + self.ui.throbber(remove=True) + self.ui.redraw() - if self.loader.has_work() and hasattr(self.ui, 'throbber'): - self.ui.throbber(self.loader.status) + self.ui.set_load_mode(self.loader.has_work()) - self.loader.work() key = self.ui.get_next_key() diff --git a/ranger/gui/defaultui.py b/ranger/gui/defaultui.py index f75c3915..ba3f79c9 100644 --- a/ranger/gui/defaultui.py +++ b/ranger/gui/defaultui.py @@ -63,5 +63,10 @@ class DefaultUI(UI): if self.main_filelist: self.main_filelist.scroll(relative) - def throbber(self, string): - self.win.addnstr(0, self.env.termsize[1]-1, string, 1) + def throbber(self, string='.', remove=False): + if remove: + self.titlebar.throbber = type(self.titlebar).throbber + else: + self.titlebar.throbber = string + +# self.win.addnstr(0, self.env.termsize[1]-1, string, 1) diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index 7bb21886..2004163e 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -10,6 +10,8 @@ class TitleBar(Widget): old_keybuffer = None old_wid = None result = None + throbber = ' ' + def draw(self): if self.env.cf != self.old_cf or\ str(self.env.keybuffer) != str(self.old_keybuffer) or\ @@ -18,6 +20,8 @@ class TitleBar(Widget): self.old_cf = self.env.cf self._calc_bar() self._print_result(self.result) + self.color('in_titlebar', 'throbber') + self.win.addnstr(self.y, self.wid - 2, self.throbber, 1) def _calc_bar(self): bar = Bar() @@ -51,7 +55,8 @@ class TitleBar(Widget): def _get_right_part(self, bar): kb = str(self.env.keybuffer) self.old_keybuffer = kb - bar.addright(kb, 'keybuffer') + bar.addright(kb, 'keybuffer', fixedsize=True) + bar.addright(' ', 'space', fixedsize=True) def _print_result(self, result): import _curses |