From: olivier Date: Wed, 10 Feb 2010 12:57:49 +0000 (+0000) Subject: fix migrator output when lines are longer than the term width X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=90e2ca8961cbea0e5dcd8a31fcb57c5f976c24ea;p=telemeta-data.git fix migrator output when lines are longer than the term width git-svn-id: http://svn.parisson.org/svn/crem@150 3bf09e05-f825-4182-b9bc-eedd7160adf0 --- diff --git a/trunk/import/migration/tasks/core.py b/trunk/import/migration/tasks/core.py index 521d486..b138d2a 100644 --- a/trunk/import/migration/tasks/core.py +++ b/trunk/import/migration/tasks/core.py @@ -235,7 +235,9 @@ class Logger(object): CBLUE = CESC + "34m" CCYAN = CESC + "36m" CDEFAULT = CESC + "0m" - CRESET = CDEFAULT + CCURSOR + CWRAP = CESC + "?7h" + CNOWRAP = CESC + "?7l" + CRESET = CDEFAULT + CCURSOR + CWRAP CUP = CESC + "1A" CREVERSENL= "\r" + CUP @@ -294,6 +296,7 @@ class Logger(object): for i in range(r, barwidth): p += ' ' + stdout.write(self.CNOWRAP) self.color1("\r" + msg) self.color1(" [%s] %d%%" % (p, ratio * 100)) if end: @@ -312,28 +315,10 @@ class Logger(object): if stats: stdout.write(self.CREVERSENL) + stdout.write(self.CWRAP) sys.stdout.flush() self.need_newline = True - def _print_progress(self, ratio, end = False): - self.color3("\r[%d%%]" % (ratio * 100)) - #if end: - # self.color2(" (%.2fs)" % (time.time() - self.start_time)) - - #self.color("\n%s" % self.task.__doc__) - #self.color3(" warnings: %d" % len(self.warnings)) - stats = self.task.get_stats() - if len(self.warnings): - stats['warnings'] = len(self.warnings) - if stats: - stdout.write(" %s" % self.fmt_stats(stats)) - - if end: - stdout.write("\n") - sys.stdout.flush() - self.need_newline = True - - def start(self, task, count = 1): self.start_time = time.time() self.task = task @@ -390,7 +375,6 @@ class Logger(object): def interrupt(self): self.color3("Interrupted\n") stdout.write(self.CRESET) - def terminate(self): self.color3(self.sep + "\n")