-
I'd love to have two Is there some way around this? Or do I just need to come up with a column structure that works for both progress bars? Thanks in advance! 🙏🏻 Phil |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
ps. I did read the docs about customisation using the |
Beta Was this translation helpful? Give feedback.
-
Hi Phil, There's currently no straightforward way of having multiple Progress instances running at the same time, but there is a current PR to factor out the Progress renderable so that you could add multiple progress bars (with different layouts) to a Live display. Will |
Beta Was this translation helpful? Give feedback.
-
Ok thanks! And I guess that there is no way to have customisation of the progress bar columns on a task-level instead of Progress instance level? No problem, just knowing that I'm not missing something is enough for me. I'll figure out a workaround with some custom column variables or something. Thanks for the help! |
Beta Was this translation helpful? Give feedback.
-
You could implement Something along these lines: class MyProgress(Progress):
def get_renderables(self) -> Iterable[RenderableType]:
for task in self.task:
task_renderable = render_task(task)
yield task_renderable When you add a task, you can set arbitrary fields .e.g |
Beta Was this translation helpful? Give feedback.
-
Ah, fantastic - thanks! I hadn’t quite twigged that the example in the docs was an internal rich function name and not an arbitrary example name (like |
Beta Was this translation helpful? Give feedback.
-
Ok great, I have it working! In the end it was super simple - I just overwrite class MyProgress(Progress):
def get_renderables(self):
for task in self.tasks:
if task.fields.get("progress_type") == "mygreenbar":
self.columns = ("[green]Rich is awesome!", BarColumn())
if task.fields.get("progress_type") == "mybluebar":
self.columns = (
"[blue]Another bar with a different layout",
BarColumn(bar_width=None),
"•",
DownloadColumn(),
)
yield self.make_tasks_table([task])
with MyProgress() as progress:
taskone = progress.add_task("taskone", progress_type="mygreenbar")
tasktwo = progress.add_task("tasktwo", progress_type="mybluebar") Note that this change means that you get multiple tables, one for each progress bar, instead of a single table with a row for each status bar. But the whole point is to have varying progress bar columns so I don't think that should matter. Commit with real code where I implemented this: ewels/nf-core-tools@616d913 Looks awesome! 🎉 Many thanks for the help @willmcgugan - you got me on the right track 😀 Hopefully this might be useful for others too. |
Beta Was this translation helpful? Give feedback.
Ok great, I have it working! In the end it was super simple - I just overwrite
self.columns
within a customProgress.get_renderables
function depending on a task key. Simplified example: