-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.py
111 lines (94 loc) · 2.74 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
"""
Main page for pvtools website. Run this script to start.
04/09/2019
toddkarin
"""
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
# # import dash_table
# import plotly.colors
# import plotly.graph_objs as go
# # import plotly.plotly as py
# from flask_caching import Cache
from dash.dependencies import Input, Output, State
# import numpy as np
# import pvlib
# import nsrdbtools
# import pandas as pd
# import uuid
# import os
# import flask
# import json
# import time
# import datetime
from app import app
# Line is important for Heroku.w
server = app.server
# Load layouts for different pages
import home, pvcz, about, 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=4),
dbc.Col([
html.A(
html.Img(
src=app.get_asset_url('duramat_logo.png'),
style={'height': 50}),
href="https://www.duramat.org/"
)
],width=4)
],justify='between')
])
navbar = dbc.NavbarSimple(
children=[
dbc.DropdownMenu(
nav=True,
in_navbar=True,
label="Tools",
children=[
dbc.DropdownMenuItem("String Length Calculator",href='/string-length-calculator'),
dbc.DropdownMenuItem("Photovoltaic Climate Stressors",href='/pv-climate-stressors'),
# dbc.DropdownMenuItem(divider=True),
# dbc.DropdownMenuItem("Documentation"),
],
),
# dbc.NavItem(dbc.NavLink("Contact", href="#")),
],
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 = pvcz.layout
body = string_length_calculator.layout
elif pathname == '/pvcz':
body = pvcz.layout
elif pathname == '/about':
body = about.layout
elif pathname == '/home':
body = home.layout
elif pathname == '/pv-climate-stressors':
body = pv_climate_stressors.layout
elif pathname == '/':
body = home.layout
else:
body = '404'
return [header, navbar, body]
if __name__ == '__main__':
app.run_server(debug=True)