File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 55import nipanel
66
77panel = nipanel .StreamlitPanelValueAccessor (panel_id = "sample_panel" )
8+ panel .refresh ()
89
910st .title ("Sample Panel" )
1011
Original file line number Diff line number Diff line change 11STREAMLIT_PYTHON_PANEL_SERVICE = "ni.pythonpanel.v1.PythonPanelService"
2+ STREAMLIT_REFRESH_COMPONENT_URL = "http://localhost:42001/panels/refresh"
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3- from typing import final
3+ from typing import final , Any
44
55import grpc
6+ import streamlit .components .v1 as components
67from ni_measurement_plugin_sdk_service .discovery import DiscoveryClient
78from ni_measurement_plugin_sdk_service .grpc .channelpool import GrpcChannelPool
89
910from nipanel ._panel_value_accessor import PanelValueAccessor
10- from nipanel ._streamlit_constants import STREAMLIT_PYTHON_PANEL_SERVICE
11+ from nipanel ._streamlit_constants import (
12+ STREAMLIT_PYTHON_PANEL_SERVICE ,
13+ STREAMLIT_REFRESH_COMPONENT_URL ,
14+ )
1115
1216
1317@final
@@ -43,3 +47,11 @@ def __init__(
4347 grpc_channel_pool = grpc_channel_pool ,
4448 grpc_channel = grpc_channel ,
4549 )
50+
51+ def refresh (self ) -> Any :
52+ """Get the Streamlit component for refreshing the panel."""
53+ _panel_refresh_component = components .declare_component (
54+ "panelRefreshComponent" ,
55+ url = f"{ STREAMLIT_REFRESH_COMPONENT_URL } /{ self .panel_id } " ,
56+ )
57+ return _panel_refresh_component ()
You can’t perform that action at this time.
0 commit comments