|
33 | 33 | TimeRemainingColumn, TaskID
|
34 | 34 |
|
35 | 35 |
|
| 36 | +DEFAULT_STYLE = [TextColumn("[progress.description]{task.description}"), |
| 37 | + BarColumn(complete_style="rgb(114,156,31)", |
| 38 | + finished_style="rgb(0,255,0)"), |
| 39 | + MofNCompleteColumn(), |
| 40 | + TimeRemainingColumn(compact=True, elapsed_when_finished=True) |
| 41 | + ] |
| 42 | + |
| 43 | +BROKEN_STYLE = [TextColumn("[progress.description]{task.description}"), |
| 44 | + BarColumn(complete_style="rgb(255,0,0)"), |
| 45 | + MofNCompleteColumn(), |
| 46 | + TimeRemainingColumn(compact=True, elapsed_when_finished=True) |
| 47 | + ] |
| 48 | + |
| 49 | + |
36 | 50 | class ProgressCounts:
|
37 | 51 | def __init__(self,
|
38 | 52 | description: str,
|
@@ -74,13 +88,7 @@ def __init__(self,
|
74 | 88 | self.progress_counts = {}
|
75 | 89 | if display_progress:
|
76 | 90 | if self.overall_progress or not provided_progress:
|
77 |
| - self.progress = TranformStatusProgress( |
78 |
| - TextColumn("[progress.description]{task.description}"), |
79 |
| - BarColumn(complete_style="rgb(114,156,31)", |
80 |
| - finished_style="rgb(0,255,0)"), |
81 |
| - MofNCompleteColumn(), |
82 |
| - TimeRemainingColumn(compact=True, elapsed_when_finished=True) |
83 |
| - ) |
| 91 | + self.progress = TranformStatusProgress(*DEFAULT_STYLE) |
84 | 92 |
|
85 | 93 | if provided_progress:
|
86 | 94 | self.progress = provided_progress if isinstance(provided_progress, Progress) \
|
@@ -190,10 +198,7 @@ class TranformStatusProgress(Progress):
|
190 | 198 | def get_renderables(self):
|
191 | 199 | for task in self.tasks:
|
192 | 200 | if task.fields.get("bar") == "failure":
|
193 |
| - self.columns = [ |
194 |
| - TextColumn("[progress.description]{task.description}"), |
195 |
| - BarColumn(complete_style="rgb(255,0,0)"), |
196 |
| - MofNCompleteColumn(), |
197 |
| - TimeRemainingColumn(compact=True, elapsed_when_finished=True) |
198 |
| - ] |
| 201 | + self.columns = BROKEN_STYLE |
| 202 | + else: |
| 203 | + self.columns = DEFAULT_STYLE |
199 | 204 | yield self.make_tasks_table([task])
|
0 commit comments