From 3151e20c813992b98713bba15c711c612f40a0a4 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 4 Feb 2023 12:14:02 +1300 Subject: [PATCH 1/2] Improve layout. --- ...urspace_chromatically_adapted_primaries.py | 190 ++++++++-------- apps/rgb_colourspace_transformation_matrix.py | 202 ++++++++++-------- index.py | 4 +- 3 files changed, 208 insertions(+), 188 deletions(-) diff --git a/apps/rgb_colourspace_chromatically_adapted_primaries.py b/apps/rgb_colourspace_chromatically_adapted_primaries.py index efe9488..91e6750 100644 --- a/apps/rgb_colourspace_chromatically_adapted_primaries.py +++ b/apps/rgb_colourspace_chromatically_adapted_primaries.py @@ -90,112 +90,122 @@ def _uid(id_): LAYOUT: Div = Div( [ - Location(id=_uid("url"), refresh=False), - H3([Link(APP_NAME, href=APP_PATH)], className="text-center"), + Div(className="col-2"), Div( [ - Markdown(APP_DESCRIPTION), - H5(children="Colourspace"), - Dropdown( - id=_uid("colourspace"), - options=OPTIONS_RGB_COLOURSPACE, - value=STATE_DEFAULT["colourspace"], - clearable=False, - className="app-widget", - ), - H5(children="Illuminant"), - Dropdown( - id=_uid("illuminant"), - options=OPTIONS_ILLUMINANTS, - value=STATE_DEFAULT["illuminant"], - clearable=False, - className="app-widget", - ), - H5(children="Chromatic Adaptation Transform"), - Dropdown( - id=_uid("chromatic-adaptation-transform"), - options=OPTIONS_CHROMATIC_ADAPTATION_TRANSFORM, - value=STATE_DEFAULT["chromatic_adaptation_transform"], - clearable=False, - className="app-widget", - ), - H5(children="Formatter"), - Dropdown( - id=_uid("formatter"), - options=[ - {"label": "str", "value": "str"}, - {"label": "repr", "value": "repr"}, - ], - value=STATE_DEFAULT["formatter"], - clearable=False, - className="app-widget", - ), - H5(children="Decimals"), - Slider( - id=_uid("decimals"), - min=1, - max=15, - step=1, - value=STATE_DEFAULT["decimals"], - marks={i + 1: str(i + 1) for i in range(15)}, - className="app-widget", - ), - Button( - "Copy to Clipboard", - id=_uid("copy-to-clipboard-button"), - n_clicks=0, - style={"width": "100%"}, - ), - Pre( - [ - Code( - id=_uid("primaries-output"), className="code shell" - ) - ], - className="app-widget app-output", - ), - Ul( + Location(id=_uid("url"), refresh=False), + H3([Link(APP_NAME, href=APP_PATH)], className="text-center"), + Div( [ - Li( - [ - Link( - "Back to index...", - href="/", - className="app-link", - ) + Markdown(APP_DESCRIPTION), + H5(children="Colourspace"), + Dropdown( + id=_uid("colourspace"), + options=OPTIONS_RGB_COLOURSPACE, + value=STATE_DEFAULT["colourspace"], + clearable=False, + className="app-widget", + ), + H5(children="Illuminant"), + Dropdown( + id=_uid("illuminant"), + options=OPTIONS_ILLUMINANTS, + value=STATE_DEFAULT["illuminant"], + clearable=False, + className="app-widget", + ), + H5(children="Chromatic Adaptation Transform"), + Dropdown( + id=_uid("chromatic-adaptation-transform"), + options=OPTIONS_CHROMATIC_ADAPTATION_TRANSFORM, + value=STATE_DEFAULT[ + "chromatic_adaptation_transform" + ], + clearable=False, + className="app-widget", + ), + H5(children="Formatter"), + Dropdown( + id=_uid("formatter"), + options=[ + {"label": "str", "value": "str"}, + {"label": "repr", "value": "repr"}, ], - className="list-inline-item", + value=STATE_DEFAULT["formatter"], + clearable=False, + className="app-widget", + ), + H5(children="Decimals"), + Slider( + id=_uid("decimals"), + min=1, + max=15, + step=1, + value=STATE_DEFAULT["decimals"], + marks={i + 1: str(i + 1) for i in range(15)}, + className="app-widget", + ), + Button( + "Copy to Clipboard", + id=_uid("copy-to-clipboard-button"), + n_clicks=0, + style={"width": "100%"}, ), - Li( + Pre( [ - A( - "Permalink", - href=urllib.parse.urljoin( - str(SERVER_URL), APP_PATH - ), - target="_blank", + Code( + id=_uid("primaries-output"), + className="code shell", ) ], - className="list-inline-item", + className="app-widget app-output", ), - Li( + Ul( [ - A( - "colour-science.org", - href="https://www.colour-science.org", - target="_blank", - ) + Li( + [ + Link( + "Back to index...", + href="/", + className="app-link", + ) + ], + className="list-inline-item", + ), + Li( + [ + A( + "Permalink", + href=urllib.parse.urljoin( + str(SERVER_URL), APP_PATH + ), + target="_blank", + ) + ], + className="list-inline-item", + ), + Li( + [ + A( + "colour-science.org", + href="https://www.colour-science.org", + target="_blank", + ) + ], + className="list-inline-item", + ), ], - className="list-inline-item", + className="list-inline text-center", ), + Div(id=_uid("dev-null"), style={"display": "none"}), ], - className="list-inline text-center", ), - Div(id=_uid("dev-null"), style={"display": "none"}), ], - className="col-6 mx-auto", + className="col-6", ), - ] + Div(className="col-2"), + ], + Div(className="row"), ) """ App layout, i.e. :class:`Div` class instance. diff --git a/apps/rgb_colourspace_transformation_matrix.py b/apps/rgb_colourspace_transformation_matrix.py index 794d131..ef50404 100644 --- a/apps/rgb_colourspace_transformation_matrix.py +++ b/apps/rgb_colourspace_transformation_matrix.py @@ -94,118 +94,130 @@ def _uid(id_): LAYOUT: Div = Div( [ - Location(id=_uid("url"), refresh=False), - H3([Link(APP_NAME, href=APP_PATH)], className="text-center"), + Div(className="col-2"), Div( [ - Markdown(APP_DESCRIPTION), - H5(children="Input Colourspace"), - Dropdown( - id=_uid("input-colourspace"), - options=OPTIONS_RGB_COLOURSPACE, - value=STATE_DEFAULT["input_colourspace"], - clearable=False, - className="app-widget", - ), - H5(children="Output Colourspace"), - Dropdown( - id=_uid("output-colourspace"), - options=OPTIONS_RGB_COLOURSPACE, - value=STATE_DEFAULT["output_colourspace"], - clearable=False, - className="app-widget", - ), - H5(children="Chromatic Adaptation Transform"), - Dropdown( - id=_uid("chromatic-adaptation-transform"), - options=OPTIONS_CHROMATIC_ADAPTATION_TRANSFORM, - value=STATE_DEFAULT["chromatic_adaptation_transform"], - clearable=False, - className="app-widget", - ), - H5(children="Formatter"), - Dropdown( - id=_uid("formatter"), - options=[ - {"label": "str", "value": "str"}, - {"label": "repr", "value": "repr"}, - {"label": "Nuke", "value": "nuke"}, - {"label": "OpenColorIO", "value": "opencolorio"}, - {"label": "Spimtx", "value": "spimtx"}, - ], - value=STATE_DEFAULT["formatter"], - clearable=False, - className="app-widget", - ), - H5(children="Decimals"), - Slider( - id=_uid("decimals"), - min=1, - max=15, - step=1, - value=STATE_DEFAULT["decimals"], - marks={i + 1: str(i + 1) for i in range(15)}, - className="app-widget", - ), - Button( - "Copy to Clipboard", - id=_uid("copy-to-clipboard-button"), - n_clicks=0, - style={"width": "100%"}, - ), - Pre( - [ - Code( - id=_uid( - "rgb-colourspace-transformation-matrix-output" - ), - className="code shell", - ) - ], - className="app-widget app-output", - ), - Ul( + Location(id=_uid("url"), refresh=False), + H3([Link(APP_NAME, href=APP_PATH)], className="text-center"), + Div( [ - Li( - [ - Link( - "Back to index...", - href="/", - className="app-link", - ) + Markdown(APP_DESCRIPTION), + H5(children="Input Colourspace"), + Dropdown( + id=_uid("input-colourspace"), + options=OPTIONS_RGB_COLOURSPACE, + value=STATE_DEFAULT["input_colourspace"], + clearable=False, + className="app-widget", + ), + H5(children="Output Colourspace"), + Dropdown( + id=_uid("output-colourspace"), + options=OPTIONS_RGB_COLOURSPACE, + value=STATE_DEFAULT["output_colourspace"], + clearable=False, + className="app-widget", + ), + H5(children="Chromatic Adaptation Transform"), + Dropdown( + id=_uid("chromatic-adaptation-transform"), + options=OPTIONS_CHROMATIC_ADAPTATION_TRANSFORM, + value=STATE_DEFAULT[ + "chromatic_adaptation_transform" + ], + clearable=False, + className="app-widget", + ), + H5(children="Formatter"), + Dropdown( + id=_uid("formatter"), + options=[ + {"label": "str", "value": "str"}, + {"label": "repr", "value": "repr"}, + {"label": "Nuke", "value": "nuke"}, + { + "label": "OpenColorIO", + "value": "opencolorio", + }, + {"label": "Spimtx", "value": "spimtx"}, ], - className="list-inline-item", + value=STATE_DEFAULT["formatter"], + clearable=False, + className="app-widget", + ), + H5(children="Decimals"), + Slider( + id=_uid("decimals"), + min=1, + max=15, + step=1, + value=STATE_DEFAULT["decimals"], + marks={i + 1: str(i + 1) for i in range(15)}, + className="app-widget", + ), + Button( + "Copy to Clipboard", + id=_uid("copy-to-clipboard-button"), + n_clicks=0, + style={"width": "100%"}, ), - Li( + Pre( [ - A( - "Permalink", - href=urllib.parse.urljoin( - str(SERVER_URL), APP_PATH + Code( + id=_uid( + "rgb-colourspace-transformation-matrix-output" ), - target="_blank", + className="code shell", ) ], - className="list-inline-item", + className="app-widget app-output", ), - Li( + Ul( [ - A( - "colour-science.org", - href="https://www.colour-science.org", - target="_blank", - ) + Li( + [ + Link( + "Back to index...", + href="/", + className="app-link", + ) + ], + className="list-inline-item", + ), + Li( + [ + A( + "Permalink", + href=urllib.parse.urljoin( + str(SERVER_URL), APP_PATH + ), + target="_blank", + ) + ], + className="list-inline-item", + ), + Li( + [ + A( + "colour-science.org", + href="https://www.colour-science.org", + target="_blank", + ) + ], + className="list-inline-item", + ), ], - className="list-inline-item", + className="list-inline text-center", ), + Div(id=_uid("dev-null"), style={"display": "none"}), ], - className="list-inline text-center", ), - Div(id=_uid("dev-null"), style={"display": "none"}), ], - className="col-6 mx-auto", + className="col-8", ), - ] + Div(className="col-2"), + ], + Div(className="row"), ) """ App layout, i.e. :class:`Div` class instance. diff --git a/index.py b/index.py index eff7678..774044d 100644 --- a/index.py +++ b/index.py @@ -20,9 +20,7 @@ __all__ = ["load_app"] -APP.layout = Div( - [Location(id="url", refresh=False), Div(id="apps", className="row")] -) +APP.layout = Div([Location(id="url", refresh=False), Div(id="apps")]) @APP.callback(Output("apps", "children"), [Input("url", "pathname")]) From e0c139119cb48763dba3afa06c9bf98881e6ea67 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 4 Feb 2023 12:14:39 +1300 Subject: [PATCH 2/2] Raise app version to 0.2.3. --- app.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 6466d1e..a07a370 100644 --- a/app.py +++ b/app.py @@ -20,7 +20,7 @@ __major_version__ = "0" __minor_version__ = "2" -__change_version__ = "2" +__change_version__ = "3" __version__ = ".".join( (__major_version__, __minor_version__, __change_version__) ) diff --git a/pyproject.toml b/pyproject.toml index 0ff7121..1d12ced 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "colour-dash" -version = "0.2.2" +version = "0.2.3" description = "Various colour science Dash apps built on top of Colour" license = "BSD-3-Clause" authors = [ "Colour Developers " ]