From 66f83835d9eac189f8674859cd1efa8e82f96e0e Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Thu, 11 Jul 2024 16:56:01 -0700 Subject: [PATCH] use bootstrap for layout --- meshtastic/analysis/__main__.py | 5 ++++- poetry.lock | 21 +++++++++++++++++++-- pyproject.toml | 7 ++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/meshtastic/analysis/__main__.py b/meshtastic/analysis/__main__.py index 1fe8ef7..7d080b5 100644 --- a/meshtastic/analysis/__main__.py +++ b/meshtastic/analysis/__main__.py @@ -8,6 +8,7 @@ import plotly.graph_objects as go import pyarrow as pa import pyarrow.feather as feather from dash import Dash, Input, Output, callback, dash_table, dcc, html +import dash_bootstrap_components as dbc from .. import mesh_pb2, powermon_pb2 @@ -83,7 +84,9 @@ pmon_raises = pmon_events[pmon_events["pm_raises"].notnull()] def create_dash(): """Create a Dash application for visualizing power consumption data.""" - app = Dash() + app = Dash( + external_stylesheets=[dbc.themes.BOOTSTRAP] + ) def set_legend(f, name): f["data"][0]["showlegend"] = True diff --git a/poetry.lock b/poetry.lock index c49ad98..4995f5a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -716,6 +716,23 @@ dev = ["PyYAML (>=5.4.1)", "coloredlogs (>=15.0.1)", "fire (>=0.4.0)"] diskcache = ["diskcache (>=5.2.1)", "multiprocess (>=0.70.12)", "psutil (>=5.8.0)"] testing = ["beautifulsoup4 (>=4.8.2)", "cryptography", "dash-testing-stub (>=0.0.2)", "lxml (>=4.6.2)", "multiprocess (>=0.70.12)", "percy (>=2.0.2)", "psutil (>=5.8.0)", "pytest (>=6.0.2)", "requests[security] (>=2.21.0)", "selenium (>=3.141.0,<=4.2.0)", "waitress (>=1.4.4)"] +[[package]] +name = "dash-bootstrap-components" +version = "1.6.0" +description = "Bootstrap themed components for use in Plotly Dash" +optional = true +python-versions = "<4,>=3.8" +files = [ + {file = "dash_bootstrap_components-1.6.0-py3-none-any.whl", hash = "sha256:97f0f47b38363f18863e1b247462229266ce12e1e171cfb34d3c9898e6e5cd1e"}, + {file = "dash_bootstrap_components-1.6.0.tar.gz", hash = "sha256:960a1ec9397574792f49a8241024fa3cecde0f5930c971a3fc81f016cbeb1095"}, +] + +[package.dependencies] +dash = ">=2.0.0" + +[package.extras] +pandas = ["numpy", "pandas"] + [[package]] name = "dash-core-components" version = "2.0.0" @@ -4014,10 +4031,10 @@ doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linke test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"] [extras] -analysis = ["dash"] +analysis = ["dash", "dash-bootstrap-components"] tunnel = ["pytap2"] [metadata] lock-version = "2.0" python-versions = "^3.9,<3.13" -content-hash = "ebe9b93c7e4215f86530f11c1375eff6c955a438310f189cc4e52511dcb29aab" +content-hash = "c8a40e0cc2ceeef6297713527b8b878e29b763a3343e0bdfb456995f9303c09e" diff --git a/pyproject.toml b/pyproject.toml index 6b08d23..05cf219 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-only" readme = "README.md" [tool.poetry.dependencies] -python = "^3.9,<3.13" # 3.9 is needed for pandas, bleak requires a max of 3.13 for some reason +python = "^3.9,<3.13" # 3.9 is needed for pandas, bleak requires a max of 3.13 for some reason pyserial = "^3.5" protobuf = ">=5.26.0" dotmap = "^1.3.30" @@ -29,6 +29,7 @@ platformdirs = "^4.2.2" print-color = "^0.4.6" dash = { version = "^2.17.1", optional = true } pytap2 = { version = "^2.3.0", optional = true } +dash-bootstrap-components = { version = "^1.6.0", optional = true } [tool.poetry.group.dev.dependencies] hypothesis = "^6.103.2" @@ -47,7 +48,7 @@ types-setuptools = "^69.5.0.20240423" types-pyyaml = "^6.0.12.20240311" pyarrow-stubs = "^10.0.1.7" -# If you are doing power analysis you probably want these extra devtools +# If you are doing power analysis you might want these extra devtools [tool.poetry.group.analysis] optional = true @@ -60,7 +61,7 @@ jupyterlab-widgets = "^3.0.11" [tool.poetry.extras] tunnel = ["pytap2"] -analysis = [ "dash" ] +analysis = ["dash", "dash-bootstrap-components"] [tool.poetry.scripts] meshtastic = "meshtastic.__main__:main"