diff options
author | hut <hut@lavabit.com> | 2010-10-08 17:36:59 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-10-08 17:36:59 +0200 |
commit | 6615467cb849207dd98fd307e4cc217cd05c9f09 (patch) | |
tree | 073e573333c3218077e46300f74238fa9ca3731b /ranger | |
parent | 8a38db1aff96a0e04ce692a326c643afe0ede4d0 (diff) | |
download | ranger-6615467cb849207dd98fd307e4cc217cd05c9f09.tar.gz |
core.loader: simplified throbber logic
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/loader.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py index ae6436a1..cda578f2 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -18,14 +18,6 @@ from time import time from ranger.core.shared import FileManagerAware import math -def status_generator(): - """Generate a rotating line which can be used as a throbber""" - while True: - yield '/' - yield '-' - yield '\\' - yield '|' - class LoadableObject(object): def __init__(self, gen, descr): self.load_generator = gen @@ -37,11 +29,13 @@ class LoadableObject(object): class Loader(FileManagerAware): seconds_of_work_time = 0.03 + throbber_chars = r'/-\|' def __init__(self): self.queue = deque() self.item = None self.load_generator = None + self.throbber_status = 0 self.status_generator = status_generator() self.rotate() self.old_item = None @@ -49,7 +43,9 @@ class Loader(FileManagerAware): def rotate(self): """Rotate the throbber""" # TODO: move all throbber logic to UI - self.status = next(self.status_generator) + self.throbber_status = \ + (self.throbber_status + 1) % len(self.throbber_chars) + self.status = self.throbber_chars[self.throbber_status] def add(self, obj): """ |