diff options
author | teh_coderer <me@tehcoderer.com> | 2023-03-06 08:30:41 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-06 09:30:41 -0500 |
commit | 9c582ad53f6b080320bd3ca058ebd9f59fbb7c0d (patch) | |
tree | b08fa411bb7fa6109349794d8b4ad894979107fe | |
parent | 7917ce30d1fbac795d910d1303dfe780877c88ad (diff) |
Hotfix/plotsbackend start (#4404)
* readd removed plots_backend().start() from merged PR
* Update backend.py
---------
Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
-rw-r--r-- | openbb_terminal/config_terminal.py | 8 | ||||
-rw-r--r-- | openbb_terminal/core/models/preferences_model.py | 2 | ||||
-rw-r--r-- | openbb_terminal/core/plots/backend.py | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/openbb_terminal/config_terminal.py b/openbb_terminal/config_terminal.py index 859c02db4ea..44d7a66830c 100644 --- a/openbb_terminal/config_terminal.py +++ b/openbb_terminal/config_terminal.py @@ -5,11 +5,12 @@ import os import i18n # IMPORTATION INTERNAL -from openbb_terminal.core.config.paths import MISCELLANEOUS_DIRECTORY from openbb_terminal.base_helpers import load_env_vars, strtobool +from openbb_terminal.core.config.paths import MISCELLANEOUS_DIRECTORY +from openbb_terminal.core.plots.backend import plots_backend from openbb_terminal.core.session.current_user import get_current_user -from .helper_classes import TerminalStyle as _TerminalStyle +from .helper_classes import TerminalStyle as _TerminalStyle # # Terminal UX section current_user = get_current_user() @@ -19,6 +20,9 @@ theme = _TerminalStyle( current_user.preferences.RICH_STYLE, ) +# Start Backend for plotting +plots_backend().start(load_env_vars("DEBUG_MODE", strtobool, False)) + # Logging section # USE IN LOG LINES + FOR FOLDER NAME INSIDE S3 BUCKET diff --git a/openbb_terminal/core/models/preferences_model.py b/openbb_terminal/core/models/preferences_model.py index 8196ca55004..5c2e381771f 100644 --- a/openbb_terminal/core/models/preferences_model.py +++ b/openbb_terminal/core/models/preferences_model.py @@ -30,6 +30,8 @@ class PreferencesModel: PLOT_WIDTH: PositiveInt = 800 PLOT_HEIGHT_PERCENTAGE: PositiveFloat = 50.0 PLOT_WIDTH_PERCENTAGE: PositiveFloat = 70.0 + # Whether to open plot image exports after they are created + PLOT_OPEN_EXPORT: bool = False # FEATURE FLAGS SYNC_ENABLED: bool = True diff --git a/openbb_terminal/core/plots/backend.py b/openbb_terminal/core/plots/backend.py index b10b48c15b9..12ea1253291 100644 --- a/openbb_terminal/core/plots/backend.py +++ b/openbb_terminal/core/plots/backend.py @@ -179,7 +179,7 @@ class Backend(pywry.PyWry): img_path.unlink(missing_ok=True) renderPDF.drawToFile(drawing, str(export_image)) - if strtobool(os.environ.get("OPENBB_PLOT_OPEN_EXPORT", False)): + if get_current_user().preferences.PLOT_OPEN_EXPORT: if sys.platform == "win32": os.startfile(export_image) # nosec: B606 else: |