forked from ampas/idt-calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
114 lines (102 loc) · 4.39 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
"""
Index
=====
"""
from dash.dcc import Link, Location, Markdown
from dash.dependencies import Input, Output
from dash.html import A, Div, H3, Main, P
from dash_bootstrap_components import Col, Container, 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
__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), Div(id="apps")])
@APP.callback(Output("apps", "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,
href=app_1.APP_PATH,
className="app-link",
),
]
),
Markdown(
app_1.APP_DESCRIPTION.replace(
"This app c", "C"
)
),
]
),
P(
[
H3(
[
Link(
app_2.APP_NAME,
href=app_2.APP_PATH,
className="app-link",
),
]
),
Markdown(
app_2.APP_DESCRIPTION.replace(
"This app c", "C"
)
),
]
),
]
)
]
)
]
)
]
)
if __name__ == "__main__":
APP.run_server(debug=True)