24
24
from dash .exceptions import PreventUpdate
25
25
from dash import dcc
26
26
27
- print ("before sourced scripts" )
28
27
# SOURCED SCRIPTS
29
28
from definitions import CONNECT_TO_LAMBDA , PORT , ZARRPATH , s3
30
29
if CONNECT_TO_LAMBDA :
31
30
from msdlive_utils import get_bytes
32
31
from io import BytesIO
33
32
34
- print ("before more sourced scripts" )
35
33
from src .reader import open_as_raster
36
34
from src .deckgl2 import plot_map
37
- from layout import create_app , tech_pathways_df , src_meta , all_options
35
+ from layout import app , tech_pathways_df , src_meta , all_options
38
36
from layout import intro_text , section_headers , title_text , description_text , funding_text , data_text
39
37
40
38
# -------------------------------
62
60
# Right-hand panel.
63
61
# -------------------------------------------
64
62
65
- @callback (
63
+ @app . callback (
66
64
Output ('subtech-select' , 'options' ),
67
65
Input ('tech-select' , 'value' ))
68
66
def set_level2_options (tech ):
69
67
logger .info (f"Tech clicked. Input value: { tech } " )
70
68
return [{'label' : i , 'value' : i } for i in all_options [tech ]]
71
69
72
- @callback (
70
+ @app . callback (
73
71
Output ('subtech-select' , 'value' ),
74
72
Input ('subtech-select' , 'options' ))
75
73
def set_level2_value (available_options ):
76
74
return available_options [0 ]['value' ]
77
75
78
76
79
- @callback (
77
+ @app . callback (
80
78
Output ('feature-select' , 'options' ),
81
79
Input ('tech-select' , 'value' ),
82
80
Input ('subtech-select' , 'value' ))
@@ -85,14 +83,14 @@ def set_level2_options(tech, subtech):
85
83
return [{'label' : i , 'value' : i } for i in all_options [tech ][subtech ]]
86
84
87
85
88
- @callback (
86
+ @app . callback (
89
87
Output ('feature-select' , 'value' ),
90
88
Input ('feature-select' , 'options' ))
91
89
def set_level2_value (available_options ):
92
90
return available_options [0 ]['value' ]
93
91
94
92
95
- @callback (
93
+ @app . callback (
96
94
Output ('carbon-capture-select' , 'options' ),
97
95
Input ('tech-select' , 'value' ),
98
96
Input ('subtech-select' , 'value' ),
@@ -101,14 +99,14 @@ def set_level2_options(tech, subtech, feature):
101
99
logger .info (f"Feature clicked. Input value: { feature } " )
102
100
return [{'label' : i , 'value' : i } for i in all_options [tech ][subtech ][feature ]]
103
101
104
- @callback (
102
+ @app . callback (
105
103
Output ('carbon-capture-select' , 'value' ),
106
104
Input ('carbon-capture-select' , 'options' ))
107
105
def set_level2_value (available_options ):
108
106
return available_options [0 ]['value' ]
109
107
110
108
111
- @callback (
109
+ @app . callback (
112
110
Output ('cooling-type-select' , 'options' ),
113
111
Input ('tech-select' , 'value' ),
114
112
Input ('subtech-select' , 'value' ),
@@ -119,14 +117,14 @@ def set_level2_options(tech, subtech, feature, is_ccs):
119
117
logger .info (f"CCS clicked. Input value: { is_ccs } " )
120
118
return [{'label' : i , 'value' : i } for i in all_options [tech ][subtech ][feature ][is_ccs ]]
121
119
122
- @callback (
120
+ @app . callback (
123
121
Output ('cooling-type-select' , 'value' ),
124
122
Input ('cooling-type-select' , 'options' ))
125
123
def set_level2_value (available_options ):
126
124
return available_options [0 ]['value' ]
127
125
128
126
129
- @callback (
127
+ @app . callback (
130
128
Output ('capacity-factor-select' , 'options' ),
131
129
Input ('tech-select' , 'value' ),
132
130
Input ('subtech-select' , 'value' ),
@@ -141,14 +139,14 @@ def set_level2_options(tech, subtech, feature, is_ccs, cooling_type):
141
139
options = [options ]
142
140
return [{'label' : i , 'value' : i } for i in options ]
143
141
144
- @callback (
142
+ @app . callback (
145
143
Output ('capacity-factor-select' , 'value' ),
146
144
Input ('capacity-factor-select' , 'options' ))
147
145
def set_level2_value (available_options ):
148
146
return available_options [0 ]['value' ]
149
147
150
148
151
- @callback (
149
+ @app . callback (
152
150
[
153
151
Output (component_id = 'feature-select-container' , component_property = 'style' ),
154
152
Output (component_id = 'carbon-capture-select-container' , component_property = 'style' ),
@@ -191,7 +189,7 @@ def show_hide_element(feature, is_ccs, cooling, capacity_factor):
191
189
# DeckGL Mapping.
192
190
# -------------------------------------------
193
191
194
- @callback (
192
+ @app . callback (
195
193
# [,
196
194
# # Output('last-btn-pressed', 'children')
197
195
# ],
@@ -280,7 +278,7 @@ def map(year, ssp, tech, subtech, feature, is_ccs, coolingtype, capacity_factor,
280
278
# Map settings and tools.
281
279
# -------------------------------------------
282
280
283
- @callback (
281
+ @app . callback (
284
282
Output ('banner' , 'style' ),
285
283
Output ('page-body' , 'style' ),
286
284
Input ('btn-text' , 'children' )
@@ -330,7 +328,7 @@ def update_mode(value):
330
328
return header_banner , page_body
331
329
332
330
333
- @callback (
331
+ @app . callback (
334
332
[
335
333
Output ('button1' , 'className' ),
336
334
Output ('button2' , 'className' ),
@@ -354,7 +352,7 @@ def update_output(n_clicks1, n_clicks2):
354
352
else :
355
353
return "button-selected" , "button" , "button1" # initialize on the sun (check if only falls into here for this case, b/c otherwise could be this 'button', 'button-selected' )
356
354
357
- @callback (
355
+ @app . callback (
358
356
[Output (component_id = "expandable-box" , component_property = "style" ),
359
357
Output (component_id = "expandable-box" , component_property = "children" ),
360
358
],
@@ -420,7 +418,7 @@ def expand_box(expand_clicks, close_clicks):
420
418
# Older callbacks.
421
419
# -----------------------------------------------------------------------------
422
420
423
- # @callback(
421
+ # @app. callback(
424
422
# Output('adjust-mode', 'color'),
425
423
# # Output('output', 'children'),
426
424
# Input('adjust-mode', 'value')
@@ -432,7 +430,7 @@ def expand_box(expand_clicks, close_clicks):
432
430
# return 'blue'
433
431
434
432
435
- # @callback(
433
+ # @app. callback(
436
434
# Output("visibility", "src"),
437
435
# Input("visibility-btn", "n_clicks"),
438
436
# )
@@ -451,8 +449,8 @@ def expand_box(expand_clicks, close_clicks):
451
449
print ("Sending app to the get_wsgi_handler ... " )
452
450
else :
453
451
if __name__ == "__main__" :
454
- create_app ().run (debug = False )
455
- # app.run_server (port=PORT, debug=False#, use_reloader=True, dev_tools_ui=True,
456
- # # dev_tools_props_check=True,
457
- # # dev_tools_hot_reload=False,
458
- # ) # disabling hot reloading
452
+ # create_app().run(debug=False)
453
+ app .run (port = PORT , debug = False #, use_reloader=True, dev_tools_ui=True,
454
+ # dev_tools_props_check=True,
455
+ # dev_tools_hot_reload=False,
456
+ ) # disabling hot reloading
0 commit comments