/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(\
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()

View File

@ -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()

View File

@ -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)