This repository has been archived by the owner on May 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusage.py
129 lines (105 loc) · 3.45 KB
/
usage.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
import grasia_dash_components
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
from threading import Timer
app = dash.Dash('')
app.scripts.config.serve_locally = True
def generate_card():
card_data = [
{'label': 'Contributors', 'data': '2 000 000'},
{'label': 'Editions', 'data': '90 000 000'},
{'label': 'Pages', 'data': ' 200 000'}
]
card_style = {'backgroundColor': '#004481',
'color': 'white',
'border': '1px lightgrey solid',
'height': '500px'}
return grasia_dash_components.Card(
id='test-card',
img='https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png',
data=card_data,
style=card_style,
url="https://www.wikipedia.org/",
description='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris quam mi, vehicula mollis libero at, congue tristique purus. Vivamus rhoncus tincidunt luctus.'
);
app.layout = html.Div([
grasia_dash_components.Import(src='https://codepen.io/akronix/pen/pVqzLZ.js'),
html.H2('Loading dialog'),
html.Button('Show Loading Dialog', id='button'),
grasia_dash_components.LoadingDialog(id="dialog", text="test", show=False),
html.Hr(),
html.H2('Card with image'),
generate_card(),
html.Hr(),
html.H2('Simple Accordions'),
grasia_dash_components.Accordion(
id="test-tree-view1",
label="See Options",
children=[
html.P('Option 1'),
html.P('Option 2'),
html.P('Option 3')
]
),
grasia_dash_components.Accordion(
id="test-tree-view2",
label="See Other Options",
children=[
html.P('Option 4'),
html.P('Option 5'),
html.P('Option 6')
]
),
html.Hr(),
html.H2('Accordion with a Checklist inside'),
grasia_dash_components.Accordion(
id="test-tree-view-2",
label="Checklist",
children=[
dcc.Checklist(
id='checklist',
options=[
{'label': 'New York City', 'value': 'NYC'},
{'label': 'Montréal', 'value': 'MTL'},
{'label': 'San Francisco', 'value': 'SF'}
],
values=['MTL', 'SF']
)
]
),
html.Hr(),
html.H2('Accordion with Cards inside'),
grasia_dash_components.Accordion(
id="test-tree-view-3",
label="Cards",
children=[
generate_card(),
generate_card(),
generate_card(),
],
defaultCollapsed=True
),
html.Hr(),
html.Div(
grasia_dash_components.Tabs(
tabs=[{'label': '123456789 More-text', 'value': 1},
{'label': '1234567890A More-text', 'value': 2}],
value=1,
id='tabs',
style={'font-weight':'bold'}
)
)
])
def hide_loading_dialog(show):
print('foo')
@app.callback(Output('dialog', 'show'),
[Input('button', 'n_clicks')])
def show_loading_dialog(n_clicks):
print(n_clicks);
return n_clicks != None and n_clicks % 2 == 1
if __name__ == '__main__':
print('Using version ' + dcc.__version__ + ' of Dash Core Components.')
print('Using version ' + grasia_dash_components.__version__ + ' of Grasia Dash Components.')
app.run_server(debug=True)