Skip to content

Commit

Permalink
notebookstarter
Browse files Browse the repository at this point in the history
  • Loading branch information
maf-hbdx committed Feb 22, 2024
1 parent 87111a6 commit 4e74d33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = [{ name = "Maurice Frank", email = "mfrank@hb-dx.com" }]
maintainers = [{ name = "Maurice Frank", email = "mfrank@hb-dx.com" }]


dependencies = ["dash", "dash-daq", "colorlover", "paramiko", "natsort"]
dependencies = ["dash", "dash-daq", "colorlover", "paramiko", "natsort", "dash-mantine-components", "dash-iconify"]

[project.urls]
"Homepage" = "https://github.com/gitHBDX/dash-hummingbird-components"
Expand Down
17 changes: 12 additions & 5 deletions src/dash_hummingbird_components/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
from typing import Any, Dict, List

import dash_daq
import dash_mantine_components as dmc
import pandas as pd
import plotly.io as pio
from dash import (ALL, MATCH, Input, Output, State, callback, ctx, dash_table,
dcc, get_asset_url, html, no_update)
from dash_iconify import DashIconify

from . import DATA_PATH, DATASETS, exec

Expand Down Expand Up @@ -44,17 +46,18 @@ def __new__(_, name, parameters={}):
id_ = f"{name}__{param_string}"

return html.A(
[html.Img(src=get_asset_url("Jupyter_logo.svg")), "Generate notebook"],
dmc.Button(
"Generate notebook",
leftIcon=DashIconify(icon="logos:jupyter"),
),
id={"module": "notebookstarter", "id": id_},
className="button icon",
n_clicks=0,
target="_blank",
)


@callback(
Output({"module": "notebookstarter", "id": MATCH}, "children"),
Output({"module": "notebookstarter", "id": MATCH}, "className"),
Output({"module": "notebookstarter", "id": MATCH}, "href"),
Input({"module": "notebookstarter", "id": MATCH}, "n_clicks"),
State({"module": "notebookstarter", "id": MATCH}, "id"),
Expand All @@ -67,7 +70,11 @@ def __create_notebook(n_clicks, id_, className):
name = id_.split("__")[0]
parameters = json.loads(id_[len(name) + 2 :])
link = exec.start_notebook(name, parameters)
return [html.Img(src=get_asset_url("Jupyter_logo.svg")), "Open notebook"], "button icon activated", link

return (
dmc.Button("Open notebook", leftIcon=DashIconify(icon="logos:jupyter"), color="lime"),
link,
)


class DataSetPicker:
Expand Down Expand Up @@ -227,7 +234,7 @@ def from_dataframe(data: pd.DataFrame, titelized: bool = False, header: bool = T
row.append(html.Td(HTMLTable._value(value)))
tbody.append(html.Tr(row, **tr_kwargs.get(idx, {})))
table.append(html.Tbody(tbody))
return html.Table(table, className="infotable", style=style)
return dmc.Table(table, style=style)


class PueueLog:
Expand Down

0 comments on commit 4e74d33

Please sign in to comment.