/offlineimap/head: changeset 181

Basic Blinkenlights done.
This commit is contained in:
jgoerzen 2002-07-24 22:00:02 +01:00
parent c38b0a06cf
commit a4c6a338f9
2 changed files with 28 additions and 2 deletions

View File

@ -140,6 +140,7 @@ def syncaccount(accountname, *args):
ui.syncfolders(remoterepos, localrepos) ui.syncfolders(remoterepos, localrepos)
remoterepos.syncfoldersto(localrepos) remoterepos.syncfoldersto(localrepos)
ui.acct(accountname)
folderthreads = [] folderthreads = []
for remotefolder in remoterepos.getfolders(): for remotefolder in remoterepos.getfolders():

View File

@ -303,6 +303,7 @@ class LEDCanvas(Canvas):
class LEDThreadFrame: class LEDThreadFrame:
def __init__(self, master): def __init__(self, master):
self.canvas = master self.canvas = master
self.color = ''
try: try:
self.canvas.acquireLEDLock() self.canvas.acquireLEDLock()
startpos = 5 + self.canvas.getLEDCount() * 10 startpos = 5 + self.canvas.getLEDCount() * 10
@ -314,7 +315,12 @@ class LEDThreadFrame:
outline = '#303030') outline = '#303030')
def setcolor(self, newcolor): def setcolor(self, newcolor):
self.canvas.itemconfigure(self.ovalid, fill = newcolor) if newcolor != self.color:
self.canvas.itemconfigure(self.ovalid, fill = newcolor)
self.color = newcolor
def getcolor(self):
return self.color
def setthread(self, newthread): def setthread(self, newthread):
if newthread: if newthread:
@ -368,7 +374,7 @@ class Blinkenlights(VerboseUI):
s._msg(version.banner) s._msg(version.banner)
def acct(s, accountname): def acct(s, accountname):
s.gettf().setcolor('brown') s.gettf().setcolor('purple')
VerboseUI.acct(s, accountname) VerboseUI.acct(s, accountname)
def syncfolders(s, srcrepos, destrepos): def syncfolders(s, srcrepos, destrepos):
@ -418,3 +424,22 @@ class Blinkenlights(VerboseUI):
tf.setthread(None) tf.setthread(None)
finally: finally:
s.tflock.release() s.tflock.release()
def sleep(s, sleepsecs):
s.sleeping_abort = 0
s.menubar.add_command(label = "Sync now", command = s._sleep_cancel)
UIBase.sleep(s, sleepsecs)
def sleeping(s, sleepsecs, remainingsecs):
if remainingsecs:
s.menubar.entryconfig('end', label = "Sync now (%d:%02d remain)" % \
(remainingsecs / 60, remainingsecs % 60))
else:
s.menubar.delete('end')
if s.gettf().getcolor() == 'red':
s.gettf().setcolor('black')
else:
s.gettf().setcolor('red')
time.sleep(sleepsecs)
return s.sleeping_abort