syd 1.0.1__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- syd/__init__.py +2 -10
- syd/flask_deployment/deployer.py +12 -3
- syd/flask_deployment/static/css/styles.css +26 -8
- syd/flask_deployment/static/css/viewer.css +90 -0
- syd/flask_deployment/static/js/viewer.js +394 -30
- syd/notebook_deployment/deployer.py +1 -3
- syd/notebook_deployment/widgets.py +45 -27
- syd/viewer.py +80 -5
- {syd-1.0.1.dist-info → syd-1.1.0.dist-info}/METADATA +30 -26
- syd-1.1.0.dist-info/RECORD +20 -0
- syd-1.0.1.dist-info/RECORD +0 -19
- {syd-1.0.1.dist-info → syd-1.1.0.dist-info}/WHEEL +0 -0
- {syd-1.0.1.dist-info → syd-1.1.0.dist-info}/licenses/LICENSE +0 -0
syd/__init__.py
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
from .viewer import Viewer
|
|
1
|
+
__version__ = "1.1.0"
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def make_viewer(plot_func: Optional[Callable] = None):
|
|
8
|
-
viewer = Viewer()
|
|
9
|
-
if plot_func is not None:
|
|
10
|
-
viewer.set_plot(plot_func)
|
|
11
|
-
return viewer
|
|
3
|
+
from .viewer import make_viewer, Viewer
|
syd/flask_deployment/deployer.py
CHANGED
|
@@ -48,7 +48,7 @@ class FlaskLayoutConfig:
|
|
|
48
48
|
"""Configuration for the Flask viewer layout."""
|
|
49
49
|
|
|
50
50
|
controls_position: str = "left" # Options are: 'left', 'top', 'right', 'bottom'
|
|
51
|
-
controls_width_percent: int =
|
|
51
|
+
controls_width_percent: int = 15
|
|
52
52
|
|
|
53
53
|
def __post_init__(self):
|
|
54
54
|
valid_positions = ["left", "top", "right", "bottom"]
|
|
@@ -73,12 +73,13 @@ class FlaskDeployer:
|
|
|
73
73
|
viewer: Viewer,
|
|
74
74
|
controls_position: str = "left",
|
|
75
75
|
fig_dpi: int = 300,
|
|
76
|
-
controls_width_percent: int =
|
|
76
|
+
controls_width_percent: int = 15,
|
|
77
77
|
suppress_warnings: bool = True,
|
|
78
78
|
debug: bool = False,
|
|
79
79
|
host: str = "127.0.0.1",
|
|
80
80
|
port: Optional[int] = None,
|
|
81
81
|
open_browser: bool = True,
|
|
82
|
+
update_threshold: float = 1.0,
|
|
82
83
|
):
|
|
83
84
|
"""
|
|
84
85
|
Initialize the Flask deployer.
|
|
@@ -107,10 +108,13 @@ class FlaskDeployer:
|
|
|
107
108
|
Port for the server. If None, finds an available port (default: None).
|
|
108
109
|
open_browser : bool, optional
|
|
109
110
|
Whether to open the web application in a browser tab (default: True).
|
|
111
|
+
update_threshold : float, optional
|
|
112
|
+
Time in seconds to wait before showing the loading indicator (default: 1.0)
|
|
110
113
|
"""
|
|
111
114
|
self.viewer = viewer
|
|
112
115
|
self.suppress_warnings = suppress_warnings
|
|
113
116
|
self._updating = False # Flag to check circular updates
|
|
117
|
+
self.update_threshold = update_threshold # Store update threshold
|
|
114
118
|
|
|
115
119
|
# Flask specific configurations
|
|
116
120
|
self.config = FlaskLayoutConfig(
|
|
@@ -167,12 +171,17 @@ class FlaskDeployer:
|
|
|
167
171
|
}
|
|
168
172
|
# Get the order of parameters
|
|
169
173
|
param_order = list(self.viewer.parameters.keys())
|
|
170
|
-
# Also include the initial state
|
|
174
|
+
# Also include the initial state and configuration
|
|
171
175
|
return jsonify(
|
|
172
176
|
{
|
|
173
177
|
"params": param_info,
|
|
174
178
|
"param_order": param_order,
|
|
175
179
|
"state": self.viewer.state,
|
|
180
|
+
"config": {
|
|
181
|
+
"controls_position": self.config.controls_position,
|
|
182
|
+
"controls_width_percent": self.config.controls_width_percent,
|
|
183
|
+
"update_threshold": self.update_threshold,
|
|
184
|
+
},
|
|
176
185
|
}
|
|
177
186
|
)
|
|
178
187
|
|
|
@@ -60,14 +60,14 @@ body {
|
|
|
60
60
|
#controls-container {
|
|
61
61
|
display: grid;
|
|
62
62
|
grid-template-columns: 1fr;
|
|
63
|
-
gap:
|
|
63
|
+
gap: 5px;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/* Control groups */
|
|
67
67
|
.control-group {
|
|
68
68
|
display: flex;
|
|
69
69
|
flex-direction: column;
|
|
70
|
-
padding:
|
|
70
|
+
padding: 7px;
|
|
71
71
|
border: 1px solid #eee;
|
|
72
72
|
border-radius: 4px;
|
|
73
73
|
background-color: white;
|
|
@@ -76,7 +76,7 @@ body {
|
|
|
76
76
|
|
|
77
77
|
.control-label {
|
|
78
78
|
font-weight: 600;
|
|
79
|
-
margin-bottom:
|
|
79
|
+
margin-bottom: 0px;
|
|
80
80
|
color: #333;
|
|
81
81
|
text-transform: capitalize;
|
|
82
82
|
}
|
|
@@ -87,7 +87,7 @@ input[type="number"] {
|
|
|
87
87
|
padding: 8px 12px;
|
|
88
88
|
border: 1px solid #ddd;
|
|
89
89
|
border-radius: 4px;
|
|
90
|
-
font-size:
|
|
90
|
+
font-size: 12px;
|
|
91
91
|
width: 100%;
|
|
92
92
|
box-sizing: border-box;
|
|
93
93
|
}
|
|
@@ -95,11 +95,11 @@ input[type="number"] {
|
|
|
95
95
|
/* Range inputs */
|
|
96
96
|
input[type="range"] {
|
|
97
97
|
width: 100%;
|
|
98
|
-
height:
|
|
98
|
+
height: 12px;
|
|
99
99
|
background: #ddd;
|
|
100
100
|
border-radius: 3px;
|
|
101
101
|
outline: none;
|
|
102
|
-
margin:
|
|
102
|
+
margin: 5px 0;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
input[type="range"]::-webkit-slider-thumb {
|
|
@@ -194,7 +194,7 @@ button.active {
|
|
|
194
194
|
.range-inputs {
|
|
195
195
|
display: flex;
|
|
196
196
|
justify-content: space-between;
|
|
197
|
-
margin-bottom:
|
|
197
|
+
margin-bottom: 5px;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
.range-input {
|
|
@@ -204,7 +204,7 @@ button.active {
|
|
|
204
204
|
|
|
205
205
|
.range-slider-container {
|
|
206
206
|
position: relative;
|
|
207
|
-
margin:
|
|
207
|
+
margin: 5px 0;
|
|
208
208
|
background: linear-gradient(to right,
|
|
209
209
|
#ddd 0%,
|
|
210
210
|
#ddd var(--min-pos, 0%),
|
|
@@ -277,4 +277,22 @@ button.active {
|
|
|
277
277
|
|
|
278
278
|
.max-slider {
|
|
279
279
|
z-index: 2;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
#status-display {
|
|
283
|
+
margin-top: 10px;
|
|
284
|
+
margin-bottom: 3px;
|
|
285
|
+
padding: 8px;
|
|
286
|
+
border-radius: 4px;
|
|
287
|
+
background-color: #ffffff;
|
|
288
|
+
border: 1px solid #e5e7eb;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.status-message {
|
|
292
|
+
background-color: #e0e0e0;
|
|
293
|
+
color: #000;
|
|
294
|
+
padding: 2px 6px;
|
|
295
|
+
border-radius: 4px;
|
|
296
|
+
font-size: 90%;
|
|
297
|
+
margin-left: 8px;
|
|
280
298
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#viewer-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
margin: 0;
|
|
5
|
+
padding: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
display: flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
#controls-container {
|
|
11
|
+
padding: 15px;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
overflow-y: auto;
|
|
14
|
+
max-height: 100vh;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#plot-container {
|
|
18
|
+
padding: 15px;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#plot-container img {
|
|
26
|
+
max-width: 100%;
|
|
27
|
+
height: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.system-controls {
|
|
31
|
+
margin: 10px 0px;
|
|
32
|
+
padding: 10px;
|
|
33
|
+
background-color: #ffffff;
|
|
34
|
+
border: 1px solid #e5e7eb;
|
|
35
|
+
border-radius: 4px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.parameter-controls {
|
|
39
|
+
padding: 10px;
|
|
40
|
+
background-color: #ffffff;
|
|
41
|
+
border: 1px solid #e5e7eb;
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.section-header {
|
|
46
|
+
margin-bottom: 15px;
|
|
47
|
+
font-size: 16px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Style all numeric controls consistently */
|
|
51
|
+
.numeric-control {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.numeric-control input[type="range"] {
|
|
57
|
+
flex: 1;
|
|
58
|
+
-webkit-appearance: none;
|
|
59
|
+
appearance: none;
|
|
60
|
+
height: 6px;
|
|
61
|
+
background: #ddd;
|
|
62
|
+
outline: none;
|
|
63
|
+
border-radius: 3px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.numeric-control input[type="range"]::-webkit-slider-thumb {
|
|
67
|
+
-webkit-appearance: none;
|
|
68
|
+
appearance: none;
|
|
69
|
+
width: 16px;
|
|
70
|
+
height: 16px;
|
|
71
|
+
background: #4a90e2;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
border-radius: 50%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.numeric-control input[type="range"]::-moz-range-thumb {
|
|
77
|
+
width: 16px;
|
|
78
|
+
height: 16px;
|
|
79
|
+
background: #4a90e2;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
border-radius: 50%;
|
|
82
|
+
border: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.numeric-control input[type="number"] {
|
|
86
|
+
width: 60px;
|
|
87
|
+
padding: 1px 1px;
|
|
88
|
+
border: 1px solid #ddd;
|
|
89
|
+
border-radius: 1px;
|
|
90
|
+
}
|