Skip to content

Commit a6d7691

Browse files
authored
Merge pull request #3 from dwave-examples/update/template
Update to new template
2 parents 4053218 + 2de8dda commit a6d7691

17 files changed

+390
-722
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,17 @@ arguments or return values. For more information, see the
8484

8585
- [ ] **Requirements**: All requirements for running the demo have been listed in `requirements.txt`
8686
and are either pinned to a version supported by the latest Ocean SDK release or lower bounded.
87-
`dwave-ocean-sdk` is unpinned and lower bounded.
87+
`dwave-ocean-sdk` version specified has to be compatible with the latest release available.
8888

8989
- [ ] **LICENSE**: The demo complies with the Apache 2.0 License and the [`LICENSE`](LICENSE) file
9090
is included in the root directory. All files include a license header.
9191

9292
- [ ] **Tests**: All code included in the `/src/` directory has associated tests that are located in
9393
`/tests/` and discoverable through `python -m unittest discover`.
9494

95+
- [ ] **Accessibility**: The demo must be tested for accessibility standards and score at least
96+
80%. The base template provided scores 100%.
97+
9598
- [ ] **Codespaces**: The [`.devcontainer/`](.devcontainer/) directory is included in the demo's
9699
root directory to ensure the demo runs in
97100
[GitHub Codespaces](https://docs.github.com/en/codespaces/overview).

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ A clear description allows us to properly categorize your demo.
2424

2525
Please include a screenshot of your demo below.
2626

27-
![Demo Example](static/demo.png)
27+
![Demo Example](static/demo.png "Image of demo interface")
2828

2929
<!-- Below is boilerplate instructions to be included, as is, in the final demo. -->
3030

3131
## Installation
3232
You can run this example without installation in cloud-based IDEs that support the
33-
[Development Containers specification](https://containers.dev/supporting) (aka "devcontainers")
33+
[Development Containers Specification](https://containers.dev/supporting) (aka "devcontainers")
3434
such as GitHub Codespaces.
3535

3636
For development environments that do not support `devcontainers`, install requirements:
@@ -44,9 +44,9 @@ If you are cloning the repo to your local system, working in a
4444

4545
## Usage
4646
Your development environment should be configured to access the
47-
[Leap&trade; quantum cloud service](https://docs.ocean.dwavesys.com/en/stable/overview/sapi.html).
47+
[Leap&trade; quantum cloud service](https://docs.dwavequantum.com/en/latest/ocean/sapi_access_basic.html).
4848
You can see information about supported IDEs and authorizing access to your Leap account
49-
[here](https://docs.dwavesys.com/docs/latest/doc_leap_dev_env.html).
49+
[here](https://docs.dwavequantum.com/en/latest/ocean/leap_authorization.html).
5050

5151
Run the following terminal command to start the Dash application:
5252

app.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
import diskcache
2121
from dash import DiskcacheManager
2222

23-
from demo_configs import APP_TITLE, THEME_COLOR, THEME_COLOR_SECONDARY
23+
from demo_configs import APP_TITLE
2424
from demo_interface import create_interface
25+
import dash_mantine_components as dmc
2526

2627
# Essential for initializing callbacks. Do not remove.
2728
import demo_callbacks
@@ -51,6 +52,27 @@
5152

5253
app.config.suppress_callback_exceptions = True
5354

55+
app.index_string = """
56+
<!DOCTYPE html>
57+
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
58+
<head>
59+
{%metas%}
60+
<title>{%title%}</title>
61+
{%favicon%}
62+
<link rel="stylesheet" href="https://use.typekit.net/fyq0cum.css">
63+
{%css%}
64+
</head>
65+
<body>
66+
{%app_entry%}
67+
<footer>
68+
{%config%}
69+
{%scripts%}
70+
{%renderer%}
71+
</footer>
72+
</body>
73+
</html>
74+
"""
75+
5476
# Parse debug argument
5577
parser = argparse.ArgumentParser(description="Dash debug setting.")
5678
parser.add_argument(
@@ -65,26 +87,16 @@
6587
print(f"\nDebug has been set to: {DEBUG}")
6688
if not DEBUG:
6789
print(
68-
"The app will not show live code updates and the Dash debug menu will be hidden.",
69-
"If editting code while the app is running, run the app with `python app.py --debug`.\n",
90+
"Code changes will not be reflected in the app interface and the Dash debug menu will be hidden.",
91+
"If editing code while the app is running, run the app with `python app.py --debug`.\n",
7092
sep="\n",
7193
)
7294

73-
# Generates css file and variable using THEME_COLOR and THEME_COLOR_SECONDARY settings
74-
css = f"""/* Automatically generated theme settings css file, see app.py */
75-
:root {{
76-
--theme: {THEME_COLOR};
77-
--theme-secondary: {THEME_COLOR_SECONDARY};
78-
}}
79-
"""
80-
with open("assets/__generated_theme.css", "w") as f:
81-
f.write(css)
82-
8395

8496
if __name__ == "__main__":
8597
# Imports the Dash HTML code and sets it in the app.
8698
# Creates the visual layout and app (see `demo_interface.py`)
87-
app.layout = create_interface()
99+
app.layout = dmc.MantineProvider(create_interface())
88100

89101
# Run the server
90102
app.run(debug=DEBUG)

0 commit comments

Comments
 (0)