[PATCH 1/2] Don't display sleeping every second on the screen
Sebastian Spaeth
Sebastian at SSpaeth.de
Sun Dec 5 14:35:01 GMT 2010
Only every 10 seconds. Also fix up the documentation of that function
while at it. The Curses ui actually implements user abort it
seems. Not sure if we could do the same in the UIBase, but that is for
another time.
Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
offlineimap/ui/UIBase.py | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py
index b1176fd..bb927c0 100644
--- a/offlineimap/ui/UIBase.py
+++ b/offlineimap/ui/UIBase.py
@@ -346,18 +346,23 @@ class UIBase:
# retrieved signal while sleeping: 1 means immediately resynch, 2 means immediately die
except Empty:
# no signal
- abortsleep = s.sleeping(1, sleepsecs)
- sleepsecs -= 1
+ abortsleep = s.sleeping(10, sleepsecs)
+ sleepsecs -= 10
s.sleeping(0, 0) # Done sleeping.
return abortsleep
def sleeping(s, sleepsecs, remainingsecs):
- """Sleep for sleepsecs, remainingsecs to go.
- If sleepsecs is 0, indicates we're done sleeping.
+ """Sleep for sleepsecs, display remainingsecs to go.
- Return 0 for normal sleep, or 1 to indicate a request
- to sync immediately."""
- s._msg("Next refresh in %d seconds" % remainingsecs)
+ Does nothing if sleepsecs <= 0.
+ Display a message on the screen every 10 seconds.
+
+ This implementation in UIBase does not support this, but some
+ implementations return 0 for successful sleep and 1 for an
+ 'abort', ie a request to sync immediately.
+ """
if sleepsecs > 0:
+ if remainingsecs % 10 == 0:
+ s._msg("Next refresh in %d seconds" % remainingsecs)
time.sleep(sleepsecs)
return 0
--
1.7.1
More information about the OfflineIMAP-project
mailing list