mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
Add a generic Progressbar which allows printing additional objects
This commit is contained in:
@@ -15,6 +15,7 @@ from freqtrade.util.formatters import decimals_per_coin, fmt_coin, round_value
|
||||
from freqtrade.util.ft_precise import FtPrecise
|
||||
from freqtrade.util.measure_time import MeasureTime
|
||||
from freqtrade.util.periodic_cache import PeriodicCache
|
||||
from freqtrade.util.rich_progress import CustomProgress
|
||||
from freqtrade.util.rich_tables import print_df_rich_table, print_rich_table
|
||||
from freqtrade.util.template_renderer import render_template, render_template_with_fallback # noqa
|
||||
|
||||
@@ -39,4 +40,5 @@ __all__ = [
|
||||
"MeasureTime",
|
||||
"print_rich_table",
|
||||
"print_df_rich_table",
|
||||
"CustomProgress",
|
||||
]
|
||||
|
||||
12
freqtrade/util/rich_progress.py
Normal file
12
freqtrade/util/rich_progress.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from rich.console import ConsoleRenderable, Group, RichCast
|
||||
from rich.progress import Progress
|
||||
|
||||
|
||||
class CustomProgress(Progress):
|
||||
def __init__(self, *args, cust_objs, **kwargs) -> None:
|
||||
self._cust_objs = cust_objs
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def get_renderable(self) -> ConsoleRenderable | RichCast | str:
|
||||
renderable = Group(*self._cust_objs, *self.get_renderables())
|
||||
return renderable
|
||||
Reference in New Issue
Block a user