File tree Expand file tree Collapse file tree 5 files changed +18
-2
lines changed
Expand file tree Collapse file tree 5 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1+ from typing import Any
2+
13from dashipy .lib import Contribution
24
35
46class Panel (Contribution ):
57 """Panel contribution"""
8+ def __init__ (self , name : str , title : str ):
9+ super ().__init__ (name )
10+ self .title = title
11+
12+ def to_dict (self ) -> dict [str , Any ]:
13+ return {
14+ ** super ().to_dict (),
15+ "title" : self .title
16+
17+ }
Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ def decorator(function: Callable) -> Callable:
4646
4747 return decorator
4848
49+ def __str__ (self ):
50+ return self .name
51+
4952
5053class Extension :
5154 """A UI Extension."""
Original file line number Diff line number Diff line change 1717DASHI_EXTENSIONS_KEY = "dashi.extensions"
1818DASHI_CONTRIBUTION_POINTS_KEY = "dashi.contribution_points"
1919
20+ # This would done by extension of xcube server
2021Extension .add_contrib_point ("panels" , Panel )
2122
2223
Original file line number Diff line number Diff line change 77from dashipy .lib import Output , Input , Component
88
99
10- panel = Panel (__name__ )
10+ panel = Panel (__name__ , title = "Panel A" )
1111
1212
1313@panel .layout ()
Original file line number Diff line number Diff line change 77from dashipy .lib import Output , Input , Component
88
99
10- panel = Panel (__name__ )
10+ panel = Panel (__name__ , title = "Panel B" )
1111
1212
1313@panel .layout ()
You can’t perform that action at this time.
0 commit comments