mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-12-22 21:52:15 +01:00
Moved blame.Blame.output_progress to terminal.output_progress.
This enables us to output progress from multiple modules.
This commit is contained in:
parent
6606d8b13c
commit
ce91c4176a
2 changed files with 9 additions and 8 deletions
|
@ -141,19 +141,14 @@ class Blame(object):
|
|||
thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(row), self.blames, row.strip())
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
Blame.output_progress(i, len(lines))
|
||||
|
||||
if format.is_interactive_format():
|
||||
terminal.output_progress(_(PROGRESS_TEXT), i, len(lines))
|
||||
|
||||
# Make sure all threads have completed.
|
||||
for i in range(0, NUM_THREADS):
|
||||
__thread_lock__.acquire()
|
||||
|
||||
@staticmethod
|
||||
def output_progress(pos, length):
|
||||
if sys.stdout.isatty() and format.is_interactive_format():
|
||||
terminal.clear_row()
|
||||
print(_(PROGRESS_TEXT).format(100 * pos / length), end="")
|
||||
sys.stdout.flush()
|
||||
|
||||
@staticmethod
|
||||
def is_revision(string):
|
||||
revision = re.search("([0-9a-f]{40})", string)
|
||||
|
|
|
@ -145,3 +145,9 @@ def ljust(string, pad):
|
|||
|
||||
def rjust(string, pad):
|
||||
return string.rjust(pad - get_excess_column_count(string))
|
||||
|
||||
def output_progress(text, pos, length):
|
||||
if sys.stdout.isatty():
|
||||
clear_row()
|
||||
print(text.format(100 * pos / length), end="")
|
||||
sys.stdout.flush()
|
||||
|
|
Loading…
Reference in a new issue