1616from .assets import (
1717 get_aggrid_css ,
1818 get_aggrid_js ,
19- get_openbb_icon ,
2019 get_plotly_js ,
20+ get_pywry_icon ,
2121)
2222from .callbacks import CallbackFunc , get_registry
2323from .config import PyWrySettings
@@ -448,7 +448,7 @@ def _show_login_page_and_wait(self, provider: Any, page_title: str) -> None:
448448
449449 click_event = threading .Event ()
450450
451- def _on_click (data : Any ) -> None :
451+ def _on_click (data : Any ) -> None : # pylint: disable=unused-argument
452452 click_event .set ()
453453
454454 self .show (
@@ -478,7 +478,7 @@ def _wire_logout_handler(
478478 """
479479 registry = get_registry ()
480480
481- def _handle_logout (data : Any , event_type : str , label : str ) -> None :
481+ def _handle_logout (data : Any , event_type : str , label : str ) -> None : # pylint: disable=unused-argument
482482 # Call developer's on_logout middleware
483483 if on_logout is not None :
484484 on_logout ()
@@ -1434,9 +1434,47 @@ def show_tvchart(
14341434 if provider is not None :
14351435 use_datafeed = True
14361436
1437- series_payload : list [dict [str , Any ]] = []
1437+ # In notebook/browser mode, delegate to inline.show_tvchart() which
1438+ # creates a PyWryTVChartWidget with the LightweightCharts library
1439+ # bundled in the ESM. The generic inline.show() path does not include
1440+ # tvchart assets, so the chart would never initialise.
1441+ is_browser_mode = isinstance (self ._mode , BrowserMode )
1442+ if should_use_inline_rendering () or is_browser_mode :
1443+ from . import inline as pywry_inline
1444+
1445+ plain_callbacks : dict [str , Any ] | None = None
1446+ if callbacks :
1447+ plain_callbacks = {
1448+ event : (cb .func if hasattr (cb , "func" ) else cb )
1449+ for event , cb in callbacks .items ()
1450+ }
1451+
1452+ widget_width = "100%" if width is None else f"{ width } px"
1453+
1454+ widget = pywry_inline .show_tvchart (
1455+ data = data ,
1456+ callbacks = plain_callbacks ,
1457+ title = title or "Chart" ,
1458+ width = widget_width ,
1459+ height = height or 700 ,
1460+ theme = "dark" if self ._theme == ThemeMode .DARK else "light" ,
1461+ chart_options = chart_options ,
1462+ series_options = series_options ,
1463+ symbol_col = symbol_col ,
1464+ max_bars = max_bars ,
1465+ toolbars = toolbars ,
1466+ modals = modals ,
1467+ open_browser = is_browser_mode ,
1468+ storage = storage ,
1469+ use_datafeed = use_datafeed ,
1470+ symbol = symbol ,
1471+ resolution = resolution ,
1472+ provider = provider ,
1473+ )
1474+ self ._register_inline_widget (widget )
1475+ return widget # type: ignore[no-any-return]
14381476 if use_datafeed :
1439- series_payload = [
1477+ series_payload : list [ dict [ str , Any ]] = [
14401478 {
14411479 "seriesId" : "main" ,
14421480 "symbol" : symbol or "" ,
@@ -1452,16 +1490,17 @@ def show_tvchart(
14521490
14531491 chart_data = normalize_ohlcv (data , symbol_col = symbol_col , max_bars = max_bars )
14541492
1455- for s in chart_data .series :
1456- series_payload .append (
1457- {
1458- "seriesId" : s .series_id ,
1459- "bars" : s .bars ,
1460- "volume" : s .volume ,
1461- "seriesType" : s .series_type .value .capitalize (),
1462- "seriesOptions" : series_options or {},
1463- }
1464- )
1493+ series_payload = []
1494+ series_payload .extend (
1495+ {
1496+ "seriesId" : s .series_id ,
1497+ "bars" : s .bars ,
1498+ "volume" : s .volume ,
1499+ "seriesType" : s .series_type .value .capitalize (),
1500+ "seriesOptions" : series_options or {},
1501+ }
1502+ for s in chart_data .series
1503+ )
14651504
14661505 from .state import is_deploy_mode
14671506
@@ -2524,7 +2563,7 @@ def get_icon(self) -> bytes:
25242563 bytes
25252564 Icon bytes.
25262565 """
2527- return get_openbb_icon ()
2566+ return get_pywry_icon ()
25282567
25292568 def get_lifecycle (self ) -> WindowLifecycle :
25302569 """Get the window lifecycle manager.
0 commit comments