From fea616ee90cd65cf9ca647ddc8ddd1000f06d4cb Mon Sep 17 00:00:00 2001 From: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Date: Fri, 10 Mar 2023 14:29:27 +0000 Subject: [PATCH] Move start plot backend (#4454) * move start plot backend * update sdk helper --- openbb_terminal/config_terminal.py | 5 ++++- openbb_terminal/core/sdk/sdk_helpers.py | 1 + openbb_terminal/sdk.py | 1 + openbb_terminal/terminal_controller.py | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/openbb_terminal/config_terminal.py b/openbb_terminal/config_terminal.py index 7d16a1b2af5..105a70ad981 100644 --- a/openbb_terminal/config_terminal.py +++ b/openbb_terminal/config_terminal.py @@ -21,8 +21,11 @@ theme = _TerminalStyle( current_user.preferences.RICH_STYLE, ) + # Start the plots backend -plots_backend().start(load_env_vars("DEBUG_MODE", strtobool, False)) +def start_plot_backend(): + """Starts the plot backend""" + plots_backend().start(load_env_vars("DEBUG_MODE", strtobool, False)) def start_required_configurations(): diff --git a/openbb_terminal/core/sdk/sdk_helpers.py b/openbb_terminal/core/sdk/sdk_helpers.py index 00c003c1b03..8c21a43dfa6 100644 --- a/openbb_terminal/core/sdk/sdk_helpers.py +++ b/openbb_terminal/core/sdk/sdk_helpers.py @@ -353,6 +353,7 @@ from openbb_terminal.core.session.current_user import is_local from openbb_terminal.terminal_helper import is_auth_enabled cfg.start_required_configurations() +cfg.start_plot_backend() logger = logging.getLogger(__name__) theme.applyMPLstyle() diff --git a/openbb_terminal/sdk.py b/openbb_terminal/sdk.py index 2c45976beb6..ec4265cb0c8 100644 --- a/openbb_terminal/sdk.py +++ b/openbb_terminal/sdk.py @@ -24,6 +24,7 @@ from openbb_terminal.core.session.current_user import is_local from openbb_terminal.terminal_helper import is_auth_enabled cfg.start_required_configurations() +cfg.start_plot_backend() logger = logging.getLogger(__name__) theme.applyMPLstyle() diff --git a/openbb_terminal/terminal_controller.py b/openbb_terminal/terminal_controller.py index 043f84aa8fb..efbdd6f76b3 100644 --- a/openbb_terminal/terminal_controller.py +++ b/openbb_terminal/terminal_controller.py @@ -23,6 +23,7 @@ from prompt_toolkit.formatted_text import HTML from prompt_toolkit.styles import Style from rich import panel +import openbb_terminal.config_terminal as cfg from openbb_terminal.common import feedparser_view from openbb_terminal.core.config.paths import ( HOME_DIRECTORY, @@ -1236,6 +1237,8 @@ def main( if debug: os.environ["DEBUG_MODE"] = "true" + cfg.start_plot_backend() + if isinstance(path_list, list) and path_list[0].endswith(".openbb"): run_routine(file=path_list[0], routines_args=routines_args) elif path_list: