Don't display sleeping every second on the screen
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@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
0cdfffa04d
commit
f68b626cb4
@ -346,18 +346,23 @@ class UIBase:
|
|||||||
# retrieved signal while sleeping: 1 means immediately resynch, 2 means immediately die
|
# retrieved signal while sleeping: 1 means immediately resynch, 2 means immediately die
|
||||||
except Empty:
|
except Empty:
|
||||||
# no signal
|
# no signal
|
||||||
abortsleep = s.sleeping(1, sleepsecs)
|
abortsleep = s.sleeping(10, sleepsecs)
|
||||||
sleepsecs -= 1
|
sleepsecs -= 10
|
||||||
s.sleeping(0, 0) # Done sleeping.
|
s.sleeping(0, 0) # Done sleeping.
|
||||||
return abortsleep
|
return abortsleep
|
||||||
|
|
||||||
def sleeping(s, sleepsecs, remainingsecs):
|
def sleeping(s, sleepsecs, remainingsecs):
|
||||||
"""Sleep for sleepsecs, remainingsecs to go.
|
"""Sleep for sleepsecs, display remainingsecs to go.
|
||||||
If sleepsecs is 0, indicates we're done sleeping.
|
|
||||||
|
|
||||||
Return 0 for normal sleep, or 1 to indicate a request
|
Does nothing if sleepsecs <= 0.
|
||||||
to sync immediately."""
|
Display a message on the screen every 10 seconds.
|
||||||
s._msg("Next refresh in %d seconds" % remainingsecs)
|
|
||||||
|
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 sleepsecs > 0:
|
||||||
|
if remainingsecs % 10 == 0:
|
||||||
|
s._msg("Next refresh in %d seconds" % remainingsecs)
|
||||||
time.sleep(sleepsecs)
|
time.sleep(sleepsecs)
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user