From ec129821d171bc6f3fe6bd4afe626216cb41a799 Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Thu, 11 Jul 2002 11:55:32 +0100 Subject: [PATCH] /head: changeset 102 Updated more Tk stuff --- head/offlineimap.py | 5 +++-- head/offlineimap/folder/Base.py | 2 ++ head/offlineimap/ui/Tk.py | 37 ++++++++++++++++++++++++++------- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/head/offlineimap.py b/head/offlineimap.py index 24f6255..dec3bb2 100644 --- a/head/offlineimap.py +++ b/head/offlineimap.py @@ -115,7 +115,7 @@ def syncaccount(accountname, *args): thread = InstanceLimitedThread(\ instancename = 'FOLDER_' + accountname, target = syncfolder, - name = "syncfolder-%s-%s" % \ + name = "Folder sync %s[%s]" % \ (accountname, remotefolder.getvisiblename()), args = (accountname, remoterepos, remotefolder, localrepos, statusrepos)) @@ -189,7 +189,7 @@ def syncitall(): for accountname in accounts: thread = InstanceLimitedThread(instancename = 'ACCOUNTLIMIT', target = syncaccount, - name = "syncaccount-%s" % accountname, + name = "Account sync %s" % accountname, args = (accountname,)) thread.setDaemon(1) thread.start() @@ -214,6 +214,7 @@ def sync_with_timer(): event = Event() kaevents[accountname] = event thread = ExitNotifyThread(target = servers[accountname].keepalive, + name = "Keep alive " + accountname, args = (config.getint(accountname, 'keepalive'), event)) thread.setDaemon(1) thread.start() diff --git a/head/offlineimap/folder/Base.py b/head/offlineimap/folder/Base.py index 63ff4ed..2cca564 100644 --- a/head/offlineimap/folder/Base.py +++ b/head/offlineimap/folder/Base.py @@ -199,6 +199,8 @@ class BaseFolder: thread = InstanceLimitedThread(\ self.getcopyinstancelimit(), target = self.copymessageto, + name = "Copy message %d from %s" % (uid, + self.getvisiblename()), args = (uid, applyto)) thread.setDaemon(1) thread.start() diff --git a/head/offlineimap/ui/Tk.py b/head/offlineimap/ui/Tk.py index f428804..3872ffd 100644 --- a/head/offlineimap/ui/Tk.py +++ b/head/offlineimap/ui/Tk.py @@ -73,25 +73,46 @@ class TextOKDialog: class ThreadFrame(Frame): def __init__(self, master=None): + self.threadextraframe = None self.thread = currentThread() self.threadid = thread.get_ident() Frame.__init__(self, master, relief = RIDGE, borderwidth = 2) self.pack(fill = 'x') - #self.threadlabel = Label(self, foreground = '#FF0000', - # text ="Thread %d (%s)" % (self.threadid, - # self.thread.getName())) - #self.threadlabel.pack() + self.threadlabel = Label(self, foreground = '#FF0000', + text ="Thread %d (%s)" % (self.threadid, + self.thread.getName())) + self.threadlabel.pack() + self.setthread(currentThread()) self.account = "Unknown" self.mailbox = "Unknown" - self.loclabel = Label(self, foreground = '#0000FF', + self.loclabel = Label(self, text = "Account/mailbox information unknown") #self.loclabel.pack() self.updateloclabel() - self.message = Label(self, text="Messages will appear here.\n") - self.message.pack(side = LEFT) + self.message = Label(self, text="Messages will appear here.\n", + foreground = '#0000FF') + self.message.pack(fill = 'x') + + def setthread(self, newthread): + if newthread: + self.threadlabel['text'] = newthread.getName() + else: + self.threadlabel['text'] = "No thread" + self.destroythreadextraframe() + + def destroythreadextraframe(self): + if self.threadextraframe: + self.threadextraframe.destroy() + self.threadextraframe = None + + def getthreadextraframe(self): + if self.threadextraframe: + return self.threadextraframe + self.threadextraframe = Frame() + self.threadextraframe.pack(fill = 'x') def setaccount(self, account): self.account = account @@ -150,6 +171,7 @@ class TkUI(UIBase): return s.threadframes[threadid] if len(s.availablethreadframes): tf = s.availablethreadframes.pop(0) + tf.setthread(currentThread()) else: tf = ThreadFrame(s.top) s.threadframes[threadid] = tf @@ -167,6 +189,7 @@ class TkUI(UIBase): if threadid in s.threadframes: print "Removing thread %d" % threadid tf = s.threadframes[threadid] + tf.setthread(None) tf.setaccount("Unknown") tf.setmessage("Idle") s.availablethreadframes.append(tf)