Change colors fix context manager
This commit is contained in:
		| @@ -10,16 +10,16 @@ from prompt_toolkit.styles import Style | |||||||
|  |  | ||||||
| style = Style.from_dict( | style = Style.from_dict( | ||||||
|     { |     { | ||||||
|         "title": "#D08770 underline", |         "title": "#FF8400 underline", | ||||||
|         "label": "#D8DEE9 bold", |         "label": "#D8DEE9 bold", | ||||||
|         "percentage": "#D08770", |         "percentage": "#FF8400", | ||||||
|         "bar-a": "bg:#D08770 #D08770", |         "bar-a": "bg:#FF8400 #FF8400", | ||||||
|         "bar-b": "bg:#D08770 #2E3440", |         "bar-b": "bg:#FF8400 #2E3440", | ||||||
|         "bar-c": "#D8DEE9", |         "bar-c": "#D8DEE9", | ||||||
|         "current": "#D8DEE9", |         "current": "#D8DEE9", | ||||||
|         "total": "#D08770", |         "total": "#FF8400", | ||||||
|         "time-elapsed": "#D8DEE9", |         "time-elapsed": "#D8DEE9", | ||||||
|         "time-left": "#D08770", |         "time-left": "#FF8400", | ||||||
|     } |     } | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -38,12 +38,12 @@ class JQLLexer(RegexLexer): | |||||||
|  |  | ||||||
| nord_style = Style.from_dict({ | nord_style = Style.from_dict({ | ||||||
|     'pygments.whitespace': '#FFFFFF', |     'pygments.whitespace': '#FFFFFF', | ||||||
|     'pygments.operator': '#B48EAD', |     'pygments.operator': '#EBCB8B', | ||||||
|     'pygments.keyword': '#81A1C1 bold', |     'pygments.keyword': '#81A1C1 bold', | ||||||
|     'pygments.punctuation': '#BF616A', |     'pygments.punctuation': '#BF616A', | ||||||
|     'pygments.name.attribute': '#A3BE8C', |     'pygments.name.attribute': '#A3BE8C', | ||||||
|     'pygments.name.function': '#B48EAD', |     'pygments.name.function': '#B48EAD', | ||||||
|     'pygments.string': '#EBCB8B', |     'pygments.string': '#D8DEE9', | ||||||
|     'pygments.text': '#D8DEE9', |     'pygments.text': '#D8DEE9', | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -83,32 +83,31 @@ class Forge: | |||||||
|         print(f"Fast tasks: {self.fast_task_count}") |         print(f"Fast tasks: {self.fast_task_count}") | ||||||
|         print(f"Slow tasks: {self.slow_task_count}") |         print(f"Slow tasks: {self.slow_task_count}") | ||||||
|         print(f"Total tasks: {self.total_tasks}") |         print(f"Total tasks: {self.total_tasks}") | ||||||
|         with patch_stdout(): |         with patch_stdout(), ProgressBar( | ||||||
|             with ProgressBar( |  | ||||||
|                 title="Forge", |                 title="Forge", | ||||||
|                 formatters=custom_formatters, |                 formatters=custom_formatters, | ||||||
|                 style=style, |                 style=style, | ||||||
|                 bottom_toolbar=get_toolbar, |                 bottom_toolbar=get_toolbar, | ||||||
|                 key_bindings=self.kb, |                 key_bindings=self.kb, | ||||||
|             ) as pb: |                 ) as pb: | ||||||
|                 task_progress = pb(range(self.total_tasks), label="Tasks") |             task_progress = pb(range(self.total_tasks), label="Tasks") | ||||||
|                 slow_progress = pb(range(self.slow_task_count), label="Slow tasks") |             slow_progress = pb(range(self.slow_task_count), label="Slow tasks") | ||||||
|                 for _ in range(self.slow_task_count): |             for _ in range(self.slow_task_count): | ||||||
|                     slow_tasks.append(asyncio.create_task(self.slow_task())) |                 slow_tasks.append(asyncio.create_task(self.slow_task())) | ||||||
|  |  | ||||||
|                 fast_progress = pb(range(self.fast_task_count), label="Fast tasks") |             fast_progress = pb(range(self.fast_task_count), label="Fast tasks") | ||||||
|                 for _ in range(self.fast_task_count): |             for _ in range(self.fast_task_count): | ||||||
|                     fast_tasks.append(asyncio.create_task(self.fast_task())) |                 fast_tasks.append(asyncio.create_task(self.fast_task())) | ||||||
|  |  | ||||||
|                 while not (fast_progress.done and slow_progress.done): |             while not (fast_progress.done and slow_progress.done): | ||||||
|                     await asyncio.sleep(0.1) |                 await asyncio.sleep(0.1) | ||||||
|                     slow_progress.items_completed = self.slow_tasks_done |                 slow_progress.items_completed = self.slow_tasks_done | ||||||
|                     fast_progress.items_completed = self.fast_tasks_done |                 fast_progress.items_completed = self.fast_tasks_done | ||||||
|                     task_progress.items_completed = self.slow_tasks_done + 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: |                 if self.fast_tasks_done == self.fast_task_count: | ||||||
|                         fast_progress.done = True |                     fast_progress.done = True | ||||||
|                     if self.slow_tasks_done == self.slow_task_count: |                 if self.slow_tasks_done == self.slow_task_count: | ||||||
|                         slow_progress.done = True |                     slow_progress.done = True | ||||||
|  |  | ||||||
|         result = await confirm("Do you want to print the data?") |         result = await confirm("Do you want to print the data?") | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user