Skip to content

Commit e3e9f38

Browse files
authored
Merge pull request #11 from dwave-examples/demo_v2
Demo v2
2 parents a6d7691 + 1211cc3 commit e3e9f38

File tree

52 files changed

+6361
-387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6361
-387
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
*.DS_Store
22
__pycache__
33
cache
4-
assets/__generated_theme.css
4+
tests/class_tests/blockchain_test/*
5+
tests/class_tests/score_tree_test/*
6+
venv/
7+
.venv/
8+
env/
9+
.env/

README.md

Lines changed: 123 additions & 55 deletions
Large diffs are not rendered by default.

app.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 D-Wave
1+
# Copyright 2026 D-Wave
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -17,15 +17,8 @@
1717
import argparse
1818

1919
import dash
20-
import diskcache
21-
from dash import DiskcacheManager
22-
23-
from demo_configs import APP_TITLE
24-
from demo_interface import create_interface
2520
import dash_mantine_components as dmc
26-
27-
# Essential for initializing callbacks. Do not remove.
28-
import demo_callbacks
21+
import diskcache
2922

3023
# Fix Dash long callbacks crashing on macOS 10.13+ (also potentially not working
3124
# on other POSIX systems), caused by https://bugs.python.org/issue33725
@@ -35,6 +28,12 @@
3528
# the `multiprocessing` library, but its fork, `multiprocess` still hasn't caught up.
3629
# (see docs: https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods)
3730
import multiprocess
31+
from dash import DiskcacheManager
32+
33+
# Essential for initializing callbacks. Do not remove.
34+
import demo_callbacks
35+
from demo_configs import APP_TITLE
36+
from demo_interface import create_interface
3837

3938
if multiprocess.get_start_method(allow_none=True) is None:
4039
multiprocess.set_start_method("spawn")

assets/__demo_variables.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Dash reads all css files contained in `/assets/` so no imports are necessary.
3838
--box-shadow: 0 0 1rem rgba(66, 82, 121, 0.2);
3939
--font: "proxima-nova", "Helvetica Neue", sans-serif;
4040
--banner-height: 3.5rem;
41-
--left-col-width: 26.25rem;
41+
--left-col-width: 25rem;
4242
--problem-details-height: 11.25rem;
4343
/*** Add new variables here ***/
4444
}

assets/demo.css

Lines changed: 164 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,178 @@ The following style rules can be altered or removed and any additional
2020
custom CSS can be added below.
2121
*******************************************************************/
2222

23-
.tab-content-wrapper {
24-
padding: 2rem 2rem 0;
23+
#button-group {
24+
margin-top: 2.5rem;
25+
}
26+
27+
#pause-button {
28+
width: 100%;
29+
}
30+
31+
#reset-button,
32+
#pause-button {
33+
background-color: var(--red-light);
34+
}
35+
36+
#reset-button:hover,
37+
#pause-button:hover {
38+
background-color: var(--red-dark);
39+
}
40+
41+
#reset-resume-buttons {
42+
display: flex;
43+
}
44+
45+
#reset-resume-buttons button {
46+
width: 100%;
47+
}
48+
49+
#reset-resume-buttons button:first-child {
50+
margin-right: 0.25rem;
51+
}
52+
53+
#reset-resume-buttons button:last-child {
54+
margin-left: 0.25rem;
55+
}
56+
57+
#miner-table-title {
58+
text-align: center;
59+
font-weight: bold;
60+
font-size: large;
61+
width: 100%
62+
}
63+
64+
#miner-status-table {
65+
margin: 0 auto 2rem;
66+
width: 100%;
67+
background-color: white;
68+
display: inline-block;
69+
overflow-y: auto;
70+
max-height: calc(50vw - var(--left-col-width)/2);
71+
}
72+
73+
#miner-status-table th,
74+
#miner-status-table td {
75+
padding: 0.15rem 0.5rem;
76+
border: 1px solid var(--grey-medium);
77+
white-space: nowrap;
78+
}
79+
80+
#miner-status-table td:first-child {
81+
font-weight: bold;
82+
}
83+
84+
#miner-status-table td.mined-cell {
85+
background-color: black;
86+
color: white;
87+
}
88+
89+
#miner-status-table td.validated-cell {
90+
background-color: hsl(213, 75%, 80%);
91+
}
92+
93+
#miner-status-table td.rejected-cell {
94+
background-color: hsl(25, 89%, 73%);
95+
}
96+
97+
#miner-status-table thead {
98+
background-color: var(--blue-dark);
99+
position: sticky;
100+
top: 0;
101+
z-index: 10;
102+
}
103+
104+
#miner-status-table th {
105+
font-weight: 600;
106+
color: white;
107+
font-size: 1.125rem;
108+
text-align: left;
109+
border: 1px solid var(--blue-dark);
110+
}
111+
112+
#intro-text,
113+
#prelim-text,
114+
#loading-text {
115+
text-align: center;
25116
display: flex;
26117
flex-direction: column;
27-
justify-content: space-between;
118+
height: 100%;
119+
justify-content: center;
120+
}
121+
122+
.right-column {
123+
padding: 2rem;
124+
}
125+
126+
.graph-loading {
127+
height: 100%;
128+
}
129+
130+
.graph-loading .graph-loading > div:not(.display-none) {
28131
height: 100%;
29132
}
30133

31-
.input, .results {
134+
.graph-table-wrapper {
32135
display: flex;
33-
justify-content: center;
34-
align-items: center;
136+
height: 100%;
137+
margin-top: 1rem;
138+
}
139+
140+
.graph-table-wrapper > div:first-child {
141+
height: calc(50vw - var(--left-col-width)/2);
142+
width: calc(50vw - var(--left-col-width)/2);
143+
margin-right: 2rem;
144+
position: relative;
145+
}
146+
147+
.graph-legend {
148+
position: absolute;
149+
bottom: 2px;
150+
left: 0.75rem;
151+
}
152+
153+
.graph-legend p {
154+
margin: 0.125rem 0;
155+
font-size: 0.875rem;
156+
font-weight: bold;
157+
}
158+
159+
.graph-legend span {
160+
border-radius: 50%;
161+
height: 1rem;
162+
width: 1rem;
163+
margin-right: 0.5rem;
164+
display: inline-block;
165+
vertical-align: middle;
166+
}
167+
168+
.graph-legend p:last-child span {
169+
border: 4px solid;
170+
}
171+
172+
.graph-wrapper {
173+
width: 100%;
35174
height: 100%;
36175
}
37176

38-
.problem-details-table {
39-
width: 15.5rem;
177+
#miner-graph-and-table {
178+
height: 100%;
179+
display: flex;
180+
flex-direction: column;
181+
}
182+
183+
#miner-graph-and-table .dropdown-wrapper {
184+
display: inline-block;
185+
width: 12rem;
186+
margin-right: 1rem;
187+
}
188+
189+
#miner-graph-and-table > div:first-child {
190+
display: flex;
191+
align-items: center;
40192
}
41193

42-
/****************************/
43-
/*** CUSTOM CSS GOES HERE ***/
44-
/****************************/
194+
#block-status {
195+
font-style: italic;
196+
margin-bottom: 0;
197+
}

0 commit comments

Comments
 (0)