Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 61065ed3 authored by Samuël Weber's avatar Samuël Weber
Browse files

factorization: put layout in share component

parent e41cf4c4
......@@ -77,87 +77,7 @@ app = DjangoDash("app_PMall",
external_stylesheets=external_css,
)
app.layout = dbc.Container(
id="container-main",
fluid=True,
children=[
dbc.Row(
children=[
dbc.Col( # first column
id="first-column",
width=5,
children=[
html.Div(
[
sc.dropdown_component(
label="Station",
id="station-dropdown",
options=[{"label": l, "value": l} for l in
list_station],
default=[]
),
sc.dropdown_component(
label="Specie",
id="specie-dropdown",
default=[]
),
sc.dropdown_component(
label="PMF factor",
id="source-dropdown",
default=[]
),
]
),
dbc.Row(
[
dbc.Col(
width=8,
children=sc.get_map_component(list_station)
),
dbc.Col(
id="options",
width=4,
children=[sc.get_options_component(date=df["Date"])],
),
]
),
html.Div([
sc.datatable_component
]),
html.Br(),
html.Div([
sc.gettinghelp_component
])
],
), # end first column
dbc.Col(
id="second-column",
width=7,
children=[
dcc.Tabs(
id="tab-2-col",
value="1",
children=[
dcc.Tab(
label="Time series", value="1",
children=[sc.timeserie_component]
),
dcc.Tab(
label="Scatter plot", value="2",
children=[sc.scatterplot_component]
)
]
)
],
) # end second column
],
) # end row
],
)
app.layout = sc.get_layout(list_station=list_station, df=df)
external_css = [
......
......@@ -15,6 +15,90 @@ class SharedComponent():
"""Component shared by several app.
"""
def get_layout(self, list_station, df):
layout = dbc.Container(
id="container-main",
fluid=True,
children=[
dbc.Row(
children=[
dbc.Col( # first column
id="first-column",
width=5,
children=[
html.Div(
[
self.dropdown_component(
label="Station",
id="station-dropdown",
options=[{"label": l, "value": l} for l in
list_station],
default=[]
),
self.dropdown_component(
label="Specie",
id="specie-dropdown",
default=[]
),
self.dropdown_component(
label="PMF factor",
id="source-dropdown",
default=[]
),
]
),
dbc.Row(
[
dbc.Col(
width=8,
children=self.get_map_component(list_station)
),
dbc.Col(
id="options",
width=4,
children=[self.get_options_component(date=df["Date"])],
),
]
),
html.Div([
self.datatable_component
]),
html.Br(),
html.Div([
self.gettinghelp_component
])
],
), # end first column
dbc.Col(
id="second-column",
width=7,
children=[
dcc.Tabs(
id="tab-2-col",
value="1",
children=[
dcc.Tab(
label="Time series", value="1",
children=[self.timeserie_component]
),
dcc.Tab(
label="Scatter plot", value="2",
children=[self.scatterplot_component]
)
]
)
],
) # end second column
],
) # end row
],
)
return layout
def datetime2fractionaldate(self, date):
"""
Convert a datetime object to fractional date (2012.7)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment