forked from toddkarin/pvtools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.py
93 lines (75 loc) · 2.31 KB
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"""
Main page for pvtools website. Run this script to start.
10/09/2023
toddkarin
baojie li
"""
from dash import dcc, html, Input, Output
import dash_bootstrap_components as dbc
from app import app
# Line is important for Heroku.w
server = app.server
# Load layouts for different pages
import home, iv_correction_tool, about
import string_length_calculator, pv_climate_stressors
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='page-content',children=[home.layout])
])
header = dbc.Container([
dbc.Row([
dbc.Col([
html.A(
html.Img(
src=app.get_asset_url('LBL_Masterbrand_logo_with_Tagline-01.jpg'),
style={'height': 50}),
href="https://www.lbl.gov/"
)
],width=9),
dbc.Col([
html.A(
html.Img(
src=app.get_asset_url('duramat_logo.png'),
style={'height': 50}),
href="https://www.duramat.org/"
)
],width=3)
],justify='between')
])
navbar = dbc.NavbarSimple(
children=[
dbc.DropdownMenu(
nav=True,
in_navbar=True,
label="Tools",
children=[
dbc.DropdownMenuItem("IV Curve Correction Tool",href='/iv-curve-correction-tool'),
dbc.DropdownMenuItem("String Length Calculator",href='/string-length-calculator'),
dbc.DropdownMenuItem("Photovoltaic Climate Stressors",href='/pv-climate-stressors'),
],
),
],
brand="PVTOOLS",
brand_href="/",
sticky="top",
)
@app.callback(Output('page-content', 'children'),
[Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/string-length-calculator':
body = string_length_calculator.layout
# body = home.layout
elif pathname == '/home':
body = home.layout
elif pathname == '/pv-climate-stressors':
body = pv_climate_stressors.layout
# body = home.layout
elif pathname == '/iv-curve-correction-tool':
body = iv_correction_tool.layout
elif pathname == '/':
body = home.layout
else:
body = '404'
return [header, navbar, body]
if __name__ == '__main__':
app.run_server(debug=True)