Skip to content

Commit

Permalink
Merge pull request #41 from EIT-ALIVE/031_workshop_preparation_wbacci…
Browse files Browse the repository at this point in the history
…nelli

031 workshop preparation wbaccinelli
  • Loading branch information
DaniBodor authored Apr 17, 2024
2 parents 4357153 + cede861 commit 754719b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 29 deletions.
42 changes: 26 additions & 16 deletions eit_dash/callbacks/load_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def create_info_card(dataset: Sequence, file_type: int) -> dbc.Card:
html.H4(dataset.label, className="card-title"),
html.H6(InputFiletypes(file_type).name, className="card-subtitle"),
]
card_list += [dbc.Row(f"{data}: {value}", style=styles.INFO_CARD) for data, value in info_data.items()]
card_list += [
dbc.Row(f"{data}: {value}", style=styles.INFO_CARD)
for data, value in info_data.items()
]

return dbc.Card(dbc.CardBody(card_list), id="card-1")

Expand Down Expand Up @@ -281,21 +284,26 @@ def list_cwd_files(cwd):
full_path = Path(cwd) / filepath

is_dir = Path(full_path).is_dir()
link = html.A(
[
html.Span(
file,
id={"type": "listed_file", "index": i},
title=str(full_path),
style={"fontWeight": "bold"} if is_dir else {},
),
],
href="#",
extension = (
filepath.suffix if not filepath.name.startswith(".") else filepath.name
)
prepend = "" if not is_dir else "📂"
cwd_files.append(prepend)
cwd_files.append(link)
cwd_files.append(html.Br())

if is_dir or extension in [".bin", ".txt", ".zri"]:
link = html.A(
[
html.Span(
file,
id={"type": "listed_file", "index": i},
title=str(full_path),
style={"fontWeight": "bold"} if is_dir else {},
),
],
href="#",
)
prepend = "🖹" if not is_dir else "📂"
cwd_files.append(prepend)
cwd_files.append(link)
cwd_files.append(html.Br())
return cwd_files


Expand All @@ -309,4 +317,6 @@ def store_clicked_file(n_clicks, title):
if not n_clicks or set(n_clicks) == {None}:
raise PreventUpdate
index = ctx.triggered_id["index"]
return title[index]
for state in ctx.states_list[0]:
if state["id"]["index"] == index:
return state["value"]
1 change: 1 addition & 0 deletions eit_dash/definitions/layout_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
GRAPH = {}
INFO_CARD = {"margin-left": 10}
LOAD_RESULTS = {"textAlign": "center"}
PAGES_LINK = {"fontWeight": "bold", "color": "blue"}
SUMMARY_ELEMENT = {"textAlign": "center"}
SECTION_TITLE = {"margin-top": "50px"}
4 changes: 0 additions & 4 deletions eit_dash/definitions/option_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class InputFiletypes(Enum):
Timpel = 0
Draeger = 1
Sentec = 2
Biopac = 3
Poly5 = 4


# create the filters enum, according to what has been defined in the filters module
Expand All @@ -34,8 +32,6 @@ class PeriodsSelectMethods(Enum):
"""One hot encoding of period selection methods."""

Manual = 0
AutomatedStablePeriods = 1
AutomatedPEEP = 2


class SynchMethods(Enum):
Expand Down
28 changes: 23 additions & 5 deletions eit_dash/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,34 @@

from eit_dash.app import app
from eit_dash.callbacks import load_callbacks, preprocessing_callbacks # noqa: F401
from eit_dash.definitions import layout_styles as styles

app.layout = html.Div(
[
html.H1(id="test-id", children="EIT-ALIVE dashboard", style={"textAlign": "center"}),
html.H1(
id="test-id",
children="EIT-ALIVE dashboard",
style={"textAlign": "center"},
),
dbc.Row(
[
dbc.Col(dbc.NavLink("Load", href="/load")),
dbc.Col(dbc.NavLink("Pre-processing", href="/preprocessing")),
dbc.Col(dbc.NavLink("Analyze", href="/dummy")),
dbc.Col(dbc.NavLink("Summarize", href="/dummy")),
dbc.Col(
html.H2(dbc.NavLink("LOAD", href="/", style=styles.PAGES_LINK)),
),
dbc.Col(
html.H2(
dbc.NavLink(
"PRE-PROCESSING",
href="/preprocessing",
style=styles.PAGES_LINK,
),
),
),
dbc.Col(
html.H2(
dbc.NavLink("ANALYZE", href="/dummy", style=styles.PAGES_LINK),
),
),
],
style={"textAlign": "center"},
),
Expand Down
11 changes: 8 additions & 3 deletions eit_dash/pages/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import eit_dash.definitions.layout_styles as styles
from eit_dash.definitions.option_lists import InputFiletypes

register_page(__name__, path="/load")
register_page(__name__, path="/")

summary = dbc.Col([html.H2("Summary", style=styles.COLUMN_TITLE)])

Expand All @@ -22,7 +22,10 @@
[
dbc.Select(
id=ids.INPUT_TYPE_SELECTOR,
options=[{"label": filetype.name, "value": filetype.value} for filetype in InputFiletypes],
options=[
{"label": filetype.name, "value": filetype.value}
for filetype in InputFiletypes
],
value=str(InputFiletypes.Sentec.value),
),
html.P(),
Expand All @@ -40,7 +43,9 @@
html.P(),
html.H5("Signal selections", style=styles.SECTION_TITLE),
dbc.Row(
dcc.Checklist(id=ids.CHECKBOX_SIGNALS, inputStyle=styles.CHECKBOX_INPUT),
dcc.Checklist(
id=ids.CHECKBOX_SIGNALS, inputStyle=styles.CHECKBOX_INPUT
),
),
html.H5("Pre selection", style=styles.SECTION_TITLE),
dcc.Graph(id=ids.FILE_LENGTH_SLIDER),
Expand Down
2 changes: 1 addition & 1 deletion eit_dash/pages/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
html.P(),
dbc.Row(
dbc.Button(
"Select data range(s)",
"Select stable periods",
id=ids.OPEN_SELECT_PERIODS_BUTTON,
disabled=False,
),
Expand Down

0 comments on commit 754719b

Please sign in to comment.