mirror of
https://github.com/codingo/Interlace.git
synced 2025-12-17 06:44:23 +01:00
Merge pull request #45 from codingo/progress-bar-dev
Progress bar fixes
This commit is contained in:
@@ -1 +1 @@
|
|||||||
__version__ = '1.5.1'
|
__version__ = '1.5.2'
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ class InputParser(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--no-bar', '--sober', dest='sober', action='store_true', default=True,
|
'--no-bar', '--sober', dest='sober', action='store_true', default=False,
|
||||||
help='If set then progress bar will be stripped out'
|
help='If set then progress bar will be stripped out'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -12,14 +12,15 @@ class OutputHelper(object):
|
|||||||
|
|
||||||
self.verbose = arguments.verbose
|
self.verbose = arguments.verbose
|
||||||
self.silent = arguments.silent
|
self.silent = arguments.silent
|
||||||
self.seperator = "================================================================================="
|
self.seperator = "====================================================="
|
||||||
|
|
||||||
def print_banner(self):
|
def print_banner(self):
|
||||||
if self.silent:
|
if self.silent:
|
||||||
return
|
return
|
||||||
|
|
||||||
print(self.seperator)
|
print(self.seperator)
|
||||||
print("Interlace v%s\tby Michael Skelton (@codingo_) & Sajeeb Lohani (@sml555_)" % __version__)
|
print("Interlace v%s\tby Michael Skelton (@codingo_)" % __version__)
|
||||||
|
print(" & Sajeeb Lohani (@sml555_)")
|
||||||
print(self.seperator)
|
print(self.seperator)
|
||||||
|
|
||||||
def terminal(self, level, target, command, message=""):
|
def terminal(self, level, target, command, message=""):
|
||||||
|
|||||||
@@ -16,17 +16,22 @@ class Worker(object):
|
|||||||
try:
|
try:
|
||||||
# get task from queue
|
# get task from queue
|
||||||
task = self.queue.pop(0)
|
task = self.queue.pop(0)
|
||||||
if self.tqdm:
|
if isinstance(self.tqdm, tqdm):
|
||||||
self.tqdm.update(1)
|
self.tqdm.update(1)
|
||||||
# run task
|
# run task
|
||||||
self.run_task(task, self.tqdm)
|
self.run_task(task, self.tqdm)
|
||||||
|
else:
|
||||||
|
self.run_task(task)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
break
|
break
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run_task(task, t):
|
def run_task(task, t=False):
|
||||||
|
if t:
|
||||||
s = subprocess.Popen(task, shell=True, stdout=subprocess.PIPE)
|
s = subprocess.Popen(task, shell=True, stdout=subprocess.PIPE)
|
||||||
t.write(s.stdout.readline().decode("utf-8"))
|
t.write(s.stdout.readline().decode("utf-8"))
|
||||||
|
else:
|
||||||
|
subprocess.Popen(task, shell=True)
|
||||||
|
|
||||||
|
|
||||||
class Pool(object):
|
class Pool(object):
|
||||||
@@ -48,10 +53,10 @@ class Pool(object):
|
|||||||
self.output = output
|
self.output = output
|
||||||
self.max_workers = max_workers
|
self.max_workers = max_workers
|
||||||
|
|
||||||
if progress_bar:
|
if not progress_bar:
|
||||||
self.tqdm = tqdm(total=len(queue))
|
self.tqdm = tqdm(total=len(queue))
|
||||||
else:
|
else:
|
||||||
self.tqdm = False
|
self.tqdm = True
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user