Skip to content

Commit eda35d7

Browse files
authored
Merge pull request #45 from codingo/progress-bar-dev
Progress bar fixes
2 parents 24b899e + 387225e commit eda35d7

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

Interlace/lib/core/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.5.1'
1+
__version__ = '1.5.2'

Interlace/lib/core/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def setup_parser():
355355
)
356356

357357
parser.add_argument(
358-
'--no-bar', '--sober', dest='sober', action='store_true', default=True,
358+
'--no-bar', '--sober', dest='sober', action='store_true', default=False,
359359
help='If set then progress bar will be stripped out'
360360
)
361361

Interlace/lib/core/output.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ def __init__(self, arguments):
1212

1313
self.verbose = arguments.verbose
1414
self.silent = arguments.silent
15-
self.seperator = "================================================================================="
15+
self.seperator = "====================================================="
1616

1717
def print_banner(self):
1818
if self.silent:
1919
return
2020

2121
print(self.seperator)
22-
print("Interlace v%s\tby Michael Skelton (@codingo_) & Sajeeb Lohani (@sml555_)" % __version__)
22+
print("Interlace v%s\tby Michael Skelton (@codingo_)" % __version__)
23+
print(" & Sajeeb Lohani (@sml555_)")
2324
print(self.seperator)
2425

2526
def terminal(self, level, target, command, message=""):

Interlace/lib/threader.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,22 @@ def __call__(self):
1616
try:
1717
# get task from queue
1818
task = self.queue.pop(0)
19-
if self.tqdm:
19+
if isinstance(self.tqdm, tqdm):
2020
self.tqdm.update(1)
21-
# run task
22-
self.run_task(task, self.tqdm)
21+
# run task
22+
self.run_task(task, self.tqdm)
23+
else:
24+
self.run_task(task)
2325
except IndexError:
2426
break
2527

2628
@staticmethod
27-
def run_task(task, t):
28-
s = subprocess.Popen(task, shell=True, stdout=subprocess.PIPE)
29-
t.write(s.stdout.readline().decode("utf-8"))
29+
def run_task(task, t=False):
30+
if t:
31+
s = subprocess.Popen(task, shell=True, stdout=subprocess.PIPE)
32+
t.write(s.stdout.readline().decode("utf-8"))
33+
else:
34+
subprocess.Popen(task, shell=True)
3035

3136

3237
class Pool(object):
@@ -48,10 +53,10 @@ def __init__(self, max_workers, queue, timeout, output, progress_bar):
4853
self.output = output
4954
self.max_workers = max_workers
5055

51-
if progress_bar:
56+
if not progress_bar:
5257
self.tqdm = tqdm(total=len(queue))
5358
else:
54-
self.tqdm = False
59+
self.tqdm = True
5560

5661
def run(self):
5762

0 commit comments

Comments
 (0)