/head: changeset 102

Updated more Tk stuff
This commit is contained in:
jgoerzen 2002-07-11 11:55:32 +01:00
parent bb987f1d81
commit ec129821d1
3 changed files with 35 additions and 9 deletions

View File

@ -115,7 +115,7 @@ def syncaccount(accountname, *args):
thread = InstanceLimitedThread(\ thread = InstanceLimitedThread(\
instancename = 'FOLDER_' + accountname, instancename = 'FOLDER_' + accountname,
target = syncfolder, target = syncfolder,
name = "syncfolder-%s-%s" % \ name = "Folder sync %s[%s]" % \
(accountname, remotefolder.getvisiblename()), (accountname, remotefolder.getvisiblename()),
args = (accountname, remoterepos, remotefolder, localrepos, args = (accountname, remoterepos, remotefolder, localrepos,
statusrepos)) statusrepos))
@ -189,7 +189,7 @@ def syncitall():
for accountname in accounts: for accountname in accounts:
thread = InstanceLimitedThread(instancename = 'ACCOUNTLIMIT', thread = InstanceLimitedThread(instancename = 'ACCOUNTLIMIT',
target = syncaccount, target = syncaccount,
name = "syncaccount-%s" % accountname, name = "Account sync %s" % accountname,
args = (accountname,)) args = (accountname,))
thread.setDaemon(1) thread.setDaemon(1)
thread.start() thread.start()
@ -214,6 +214,7 @@ def sync_with_timer():
event = Event() event = Event()
kaevents[accountname] = event kaevents[accountname] = event
thread = ExitNotifyThread(target = servers[accountname].keepalive, thread = ExitNotifyThread(target = servers[accountname].keepalive,
name = "Keep alive " + accountname,
args = (config.getint(accountname, 'keepalive'), event)) args = (config.getint(accountname, 'keepalive'), event))
thread.setDaemon(1) thread.setDaemon(1)
thread.start() thread.start()

View File

@ -199,6 +199,8 @@ class BaseFolder:
thread = InstanceLimitedThread(\ thread = InstanceLimitedThread(\
self.getcopyinstancelimit(), self.getcopyinstancelimit(),
target = self.copymessageto, target = self.copymessageto,
name = "Copy message %d from %s" % (uid,
self.getvisiblename()),
args = (uid, applyto)) args = (uid, applyto))
thread.setDaemon(1) thread.setDaemon(1)
thread.start() thread.start()

View File

@ -73,25 +73,46 @@ class TextOKDialog:
class ThreadFrame(Frame): class ThreadFrame(Frame):
def __init__(self, master=None): def __init__(self, master=None):
self.threadextraframe = None
self.thread = currentThread() self.thread = currentThread()
self.threadid = thread.get_ident() self.threadid = thread.get_ident()
Frame.__init__(self, master, relief = RIDGE, borderwidth = 2) Frame.__init__(self, master, relief = RIDGE, borderwidth = 2)
self.pack(fill = 'x') self.pack(fill = 'x')
#self.threadlabel = Label(self, foreground = '#FF0000', self.threadlabel = Label(self, foreground = '#FF0000',
# text ="Thread %d (%s)" % (self.threadid, text ="Thread %d (%s)" % (self.threadid,
# self.thread.getName())) self.thread.getName()))
#self.threadlabel.pack() self.threadlabel.pack()
self.setthread(currentThread())
self.account = "Unknown" self.account = "Unknown"
self.mailbox = "Unknown" self.mailbox = "Unknown"
self.loclabel = Label(self, foreground = '#0000FF', self.loclabel = Label(self,
text = "Account/mailbox information unknown") text = "Account/mailbox information unknown")
#self.loclabel.pack() #self.loclabel.pack()
self.updateloclabel() self.updateloclabel()
self.message = Label(self, text="Messages will appear here.\n") self.message = Label(self, text="Messages will appear here.\n",
self.message.pack(side = LEFT) 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): def setaccount(self, account):
self.account = account self.account = account
@ -150,6 +171,7 @@ class TkUI(UIBase):
return s.threadframes[threadid] return s.threadframes[threadid]
if len(s.availablethreadframes): if len(s.availablethreadframes):
tf = s.availablethreadframes.pop(0) tf = s.availablethreadframes.pop(0)
tf.setthread(currentThread())
else: else:
tf = ThreadFrame(s.top) tf = ThreadFrame(s.top)
s.threadframes[threadid] = tf s.threadframes[threadid] = tf
@ -167,6 +189,7 @@ class TkUI(UIBase):
if threadid in s.threadframes: if threadid in s.threadframes:
print "Removing thread %d" % threadid print "Removing thread %d" % threadid
tf = s.threadframes[threadid] tf = s.threadframes[threadid]
tf.setthread(None)
tf.setaccount("Unknown") tf.setaccount("Unknown")
tf.setmessage("Idle") tf.setmessage("Idle")
s.availablethreadframes.append(tf) s.availablethreadframes.append(tf)