diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index 909db30..91ee08a 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -266,7 +266,6 @@ class BaseFolder(object): statusfolder.savemessage(uid, None, flags, rtime) return - self.ui.copyingmessage(uid, self, dstfolder) # If any of the destinations actually stores the message body, # load it up. if dstfolder.storesmessages(): @@ -331,15 +330,16 @@ class BaseFolder(object): copylist = filter(lambda uid: not \ statusfolder.uidexists(uid), self.getmessageuidlist()) - for uid in copylist: + num_to_copy = len(copylist) + for num, uid in enumerate(copylist): + self.ui.copyingmessage(uid, num+1, num_to_copy, self, dstfolder) # exceptions are caught in copymessageto() if self.suggeststhreads(): self.waitforthread() thread = threadutil.InstanceLimitedThread(\ self.getcopyinstancelimit(), target = self.copymessageto, - name = "Copy message %d from %s" % (uid, - self.getvisiblename()), + name = "Copy message from %s:%s" % (self.repository, self), args = (uid, dstfolder, statusfolder)) thread.setDaemon(1) thread.start() diff --git a/offlineimap/ui/Blinkenlights.py b/offlineimap/ui/Blinkenlights.py index f0dfec1..330b9a8 100644 --- a/offlineimap/ui/Blinkenlights.py +++ b/offlineimap/ui/Blinkenlights.py @@ -54,9 +54,10 @@ class BlinkenBase: s.gettf().setcolor('blue') s.__class__.__bases__[-1].syncingmessages(s, sr, sf, dr, df) - def copyingmessage(s, uid, src, destfolder): + def copyingmessage(s, uid, num, num_to_copy, src, destfolder): s.gettf().setcolor('orange') - s.__class__.__bases__[-1].copyingmessage(s, uid, src, destfolder) + s.__class__.__bases__[-1].copyingmessage(s, uid, num, num_to_copy, src, + destfolder) def deletingmessages(s, uidlist, destlist): s.gettf().setcolor('red') diff --git a/offlineimap/ui/Machine.py b/offlineimap/ui/Machine.py index 7a480ae..50a7f99 100644 --- a/offlineimap/ui/Machine.py +++ b/offlineimap/ui/Machine.py @@ -108,7 +108,7 @@ class MachineUI(UIBase): (s.getnicename(sr), sf.getname(), s.getnicename(dr), df.getname())) - def copyingmessage(self, uid, srcfolder, destfolder): + def copyingmessage(self, uid, num, num_to_copy, srcfolder, destfolder): self._printData('copyingmessage', "%d\n%s\n%s\n%s[%s]" % \ (uid, self.getnicename(srcfolder), srcfolder.getname(), self.getnicename(destfolder), destfolder)) diff --git a/offlineimap/ui/TTY.py b/offlineimap/ui/TTY.py index cba573f..48c468f 100644 --- a/offlineimap/ui/TTY.py +++ b/offlineimap/ui/TTY.py @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - from UIBase import UIBase from getpass import getpass import sys @@ -37,10 +36,7 @@ class TTYUI(UIBase): #if the next output comes from a different thread than our last one #add the info. #Most look like 'account sync foo' or 'Folder sync foo'. - try: - threadname = currentThread().name - except AttributeError: - threadname = currentThread().getName() + threadname = currentThread().getName() if (threadname == s._lastThreaddisplay \ or threadname == 'MainThread'): print " %s" % msg diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py index 77594f2..587b055 100644 --- a/offlineimap/ui/UIBase.py +++ b/offlineimap/ui/UIBase.py @@ -288,12 +288,11 @@ class UIBase: s.getnicename(dr), df.getname())) - def copyingmessage(self, uid, src, destfolder): + def copyingmessage(self, uid, num, num_to_copy, src, destfolder): """Output a log line stating which message we copy""" - if self.verbose >= 0: - self._msg("Copy message %d %s[%s] -> %s[%s]" % \ - (uid, self.getnicename(src), src, - self.getnicename(destfolder), destfolder)) + if self.verbose < 0: return + self._msg("Copy message %s (%d of %d) %s:%s -> %s" % (uid, num, + num_to_copy, src.repository, src, destfolder.repository)) def deletingmessage(s, uid, destlist): if s.verbose >= 0: