Change colors fix context manager

This commit is contained in:
Roland Thomas Jr 2024-06-05 19:37:23 -04:00
parent c84ce4ca72
commit 3f0338f11d
Signed by: roland
GPG Key ID: 7C3C2B085A4C2872
3 changed files with 26 additions and 27 deletions

View File

@ -10,16 +10,16 @@ from prompt_toolkit.styles import Style
style = Style.from_dict(
{
"title": "#D08770 underline",
"title": "#FF8400 underline",
"label": "#D8DEE9 bold",
"percentage": "#D08770",
"bar-a": "bg:#D08770 #D08770",
"bar-b": "bg:#D08770 #2E3440",
"percentage": "#FF8400",
"bar-a": "bg:#FF8400 #FF8400",
"bar-b": "bg:#FF8400 #2E3440",
"bar-c": "#D8DEE9",
"current": "#D8DEE9",
"total": "#D08770",
"total": "#FF8400",
"time-elapsed": "#D8DEE9",
"time-left": "#D08770",
"time-left": "#FF8400",
}
)

View File

@ -38,12 +38,12 @@ class JQLLexer(RegexLexer):
nord_style = Style.from_dict({
'pygments.whitespace': '#FFFFFF',
'pygments.operator': '#B48EAD',
'pygments.operator': '#EBCB8B',
'pygments.keyword': '#81A1C1 bold',
'pygments.punctuation': '#BF616A',
'pygments.name.attribute': '#A3BE8C',
'pygments.name.function': '#B48EAD',
'pygments.string': '#EBCB8B',
'pygments.string': '#D8DEE9',
'pygments.text': '#D8DEE9',
})

View File

@ -83,32 +83,31 @@ class Forge:
print(f"Fast tasks: {self.fast_task_count}")
print(f"Slow tasks: {self.slow_task_count}")
print(f"Total tasks: {self.total_tasks}")
with patch_stdout():
with ProgressBar(
with patch_stdout(), ProgressBar(
title="Forge",
formatters=custom_formatters,
style=style,
bottom_toolbar=get_toolbar,
key_bindings=self.kb,
) as pb:
task_progress = pb(range(self.total_tasks), label="Tasks")
slow_progress = pb(range(self.slow_task_count), label="Slow tasks")
for _ in range(self.slow_task_count):
slow_tasks.append(asyncio.create_task(self.slow_task()))
) as pb:
task_progress = pb(range(self.total_tasks), label="Tasks")
slow_progress = pb(range(self.slow_task_count), label="Slow tasks")
for _ in range(self.slow_task_count):
slow_tasks.append(asyncio.create_task(self.slow_task()))
fast_progress = pb(range(self.fast_task_count), label="Fast tasks")
for _ in range(self.fast_task_count):
fast_tasks.append(asyncio.create_task(self.fast_task()))
fast_progress = pb(range(self.fast_task_count), label="Fast tasks")
for _ in range(self.fast_task_count):
fast_tasks.append(asyncio.create_task(self.fast_task()))
while not (fast_progress.done and slow_progress.done):
await asyncio.sleep(0.1)
slow_progress.items_completed = self.slow_tasks_done
fast_progress.items_completed = self.fast_tasks_done
task_progress.items_completed = self.slow_tasks_done + self.fast_tasks_done
if self.fast_tasks_done == self.fast_task_count:
fast_progress.done = True
if self.slow_tasks_done == self.slow_task_count:
slow_progress.done = True
while not (fast_progress.done and slow_progress.done):
await asyncio.sleep(0.1)
slow_progress.items_completed = self.slow_tasks_done
fast_progress.items_completed = self.fast_tasks_done
task_progress.items_completed = self.slow_tasks_done + self.fast_tasks_done
if self.fast_tasks_done == self.fast_task_count:
fast_progress.done = True
if self.slow_tasks_done == self.slow_task_count:
slow_progress.done = True
result = await confirm("Do you want to print the data?")