Output progress indication when copying files
Output (2 of 500) when logging message copying. This required moving of self.ui.copyingmessage into a different function where we actually have the information about the progress handy. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
		| @@ -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() | ||||
|   | ||||
| @@ -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') | ||||
|   | ||||
| @@ -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)) | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sebastian Spaeth
					Sebastian Spaeth