-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.py
155 lines (140 loc) · 5.1 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
"""
Index
=====
"""
import logging
from dash.dcc import Link, Location, Markdown
from dash.dependencies import Input, Output
from dash.html import H3, A, Div, Img, Main, P
from dash_bootstrap_components import (
Col,
Container,
NavbarSimple,
NavItem,
NavLink,
Row,
)
import apps.idt_calculator_p_2013_001 as app_1
import apps.idt_calculator_prosumer_camera as app_2
from app import APP, SERVER # noqa: F401
__author__ = "Alex Forsythe, Gayle McAdams, Thomas Mansencal, Nick Shaw"
__copyright__ = "Copyright 2020 Academy of Motion Picture Arts and Sciences"
__license__ = "Academy of Motion Picture Arts and Sciences License Terms"
__maintainer__ = "Academy of Motion Picture Arts and Sciences"
__email__ = "[email protected]"
__status__ = "Production"
__all__ = ["load_app"]
APP.layout = Container(
[
Location(id="url", refresh=False),
NavbarSimple(
children=[
NavItem(
NavLink(
app_1.APP_NAME_SHORT,
href=app_1.APP_PATH,
)
),
NavItem(
NavLink(
app_2.APP_NAME_SHORT,
href=app_2.APP_PATH,
)
),
],
brand=Img(
id="aces-logo",
src="/assets/aces-logo.png",
),
brand_href="https://acescentral.com",
color="primary",
dark=True,
),
Div(id="toc"),
],
id="apps",
fluid=True,
)
@APP.callback(Output("toc", "children"), [Input("url", "pathname")])
def load_app(app):
"""
Load given app into the appropriate :class:`Div` class instance.
Parameters
----------
app : str
App path.
Returns
-------
Div
:class:`Div` class instance of the app layout.
"""
if app == app_1.APP_PATH:
return app_1.LAYOUT
elif app == app_2.APP_PATH:
return app_2.LAYOUT
else:
return Container(
[
Main(
[
Row(
[
Col(
[
P(
[
"Various A.M.P.A.S. colour science ",
A(
"Dash",
href="https://dash.plot.ly/",
target="_blank",
),
" apps.",
]
),
P(
[
H3(
[
Link(
app_1.APP_NAME_LONG,
href=app_1.APP_PATH,
),
]
),
Markdown(
app_1.APP_DESCRIPTION.replace(
"This app c", "C"
)
),
]
),
P(
[
H3(
[
Link(
app_2.APP_NAME_LONG,
href=app_2.APP_PATH,
),
]
),
Markdown(
app_2.APP_DESCRIPTION.replace(
"This app c", "C"
)
),
]
),
]
)
]
)
]
)
]
)
if __name__ == "__main__":
logging.basicConfig()
logging.getLogger().setLevel(logging.INFO)
APP.run_server(debug=True)