Hotfix/Interactive in featflags menu (#4500)

* added `USE_INTERACTIVE_DF` to `featflags` menu, `console.print` changed value

* Got things working

---------

Co-authored-by: colin99d <colin99delahunty@gmail.com>
This commit is contained in:
teh_coderer
2023-03-16 11:09:12 -05:00
committed by GitHub
parent da5665af6f
commit 1fe786b79b
9 changed files with 27 additions and 10 deletions

View File

@@ -40,7 +40,7 @@ class PreferencesModel:
RETRY_WITH_LOAD: bool = False
USE_TABULATE_DF: bool = True
# Use interactive window to display dataframes with options to sort, filter, etc.
USE_INTERACTIVE_DF = True
USE_INTERACTIVE_DF: bool = True
USE_CLEAR_AFTER_CMD: bool = False
USE_COLOR: bool = True
USE_DATETIME: bool = True

View File

@@ -7,6 +7,7 @@ from typing import Union
from dotenv import set_key
# IMPORTS INTERNAL
from openbb_terminal.base_helpers import console
from openbb_terminal.core.config.paths import SETTINGS_ENV_FILE
from openbb_terminal.core.session.current_user import (
get_current_user,
@@ -54,3 +55,5 @@ def set_preference(
type_="settings",
auth_header=current_user.profile.get_auth_header(),
)
console.print(f"[yellow]{name}[/] [green]has been set to[/] {value}")

View File

@@ -28,6 +28,7 @@ class FeatureFlagsController(BaseController):
CHOICES_COMMANDS: List[str] = [
"retryload",
"tab",
"interactive",
"cls",
"color",
"ion",
@@ -63,6 +64,7 @@ class FeatureFlagsController(BaseController):
mt.add_raw("\n")
mt.add_setting("retryload", current_user.preferences.RETRY_WITH_LOAD)
mt.add_setting("tab", current_user.preferences.USE_TABULATE_DF)
mt.add_setting("interactive", current_user.preferences.USE_INTERACTIVE_DF)
mt.add_setting("cls", current_user.preferences.USE_CLEAR_AFTER_CMD)
mt.add_setting("color", current_user.preferences.USE_COLOR)
mt.add_setting("promptkit", current_user.preferences.USE_PROMPT_TOOLKIT)
@@ -104,6 +106,13 @@ class FeatureFlagsController(BaseController):
"USE_TABULATE_DF", not get_current_user().preferences.USE_TABULATE_DF
)
@log_start_end(log=logger)
def call_interactive(self, _):
"""Process interactive command"""
set_preference(
"USE_INTERACTIVE_DF", not get_current_user().preferences.USE_INTERACTIVE_DF
)
@log_start_end(log=logger)
def call_cls(self, _):
"""Process cls command"""

View File

@@ -47,6 +47,7 @@ en:
featflags/_info_: Feature flags through environment variables
featflags/retryload: retry misspelled commands with load first
featflags/tab: use tabulate to print dataframes
featflags/interactive: open dataframes in interactive window
featflags/cls: clear console after each command
featflags/color: use coloring features
featflags/promptkit: enable prompt toolkit (autocomplete and history)

View File

@@ -28,15 +28,15 @@ def display_quote(symbol: str, export: str = "", sheet_name: Optional[str] = Non
quote = stocks_model.get_quote(symbol)
if quote.empty:
console.print("[red]Data not found[/red]\n")
else:
print_rich_table(
quote,
headers=["Value"],
title=f"{symbol.upper()} Quote",
index_name="Info",
show_index=True,
export=bool(export),
)
return
print_rich_table(
quote,
headers=["Value"],
title=f"{symbol.upper()} Quote",
index_name="Info",
show_index=True,
export=bool(export),
)
export_data(
export,

View File

@@ -1,2 +1,3 @@
SYNC_ENABLED has been set to True
[info]sync:[/info] OFF
['--on']

View File

@@ -1,2 +1,3 @@
SYNC_ENABLED has been set to False
[info]sync:[/info] ON
['--off']

View File

@@ -1,2 +1,3 @@
SYNC_ENABLED has been set to True
[info]sync:[/info] ON
['--on']

View File

@@ -1,2 +1,3 @@
SYNC_ENABLED has been set to False
[info]sync:[/info] OFF
['--off']