|
3 | 3 | from PyQt5.QtCore import QMetaObject, QRectF, Qt, QTimer |
4 | 4 | from PyQt5.QtGui import QColor, QFont, QPainter, QPen |
5 | 5 | from PyQt5.QtWidgets import ( |
| 6 | + QDoubleSpinBox, |
6 | 7 | QHBoxLayout, |
7 | 8 | QLabel, |
8 | 9 | QSizePolicy, |
9 | | - QSpinBox, |
10 | 10 | QToolButton, |
11 | 11 | QVBoxLayout, |
12 | 12 | QWidget, |
@@ -165,9 +165,10 @@ def __init__(self): |
165 | 165 |
|
166 | 166 | self.strength_slider = StrengthWidget(parent=self) |
167 | 167 |
|
168 | | - self.seed_input = QSpinBox(self) |
| 168 | + self.seed_input = QDoubleSpinBox(self) |
| 169 | + self.seed_input.setDecimals(0) |
169 | 170 | self.seed_input.setMinimum(0) |
170 | | - self.seed_input.setMaximum(2**31 - 1) |
| 171 | + self.seed_input.setMaximum(2**32 - 1) |
171 | 172 | self.seed_input.setPrefix(_("Seed") + ": ") |
172 | 173 | self.seed_input.setToolTip( |
173 | 174 | _( |
@@ -245,11 +246,15 @@ def model(self, model: Model): |
245 | 246 | if self._model != model: |
246 | 247 | Binding.disconnect_all(self._model_bindings) |
247 | 248 | self._model = model |
| 249 | + self.seed_input.setValue(model.seed) |
248 | 250 | self._model_bindings = [ |
249 | 251 | bind(model, "workspace", self.workspace_select, "value", Bind.one_way), |
250 | 252 | bind(model, "style", self.style_select, "value"), |
251 | 253 | bind(model.live, "strength", self.strength_slider, "value"), |
252 | | - bind(model, "seed", self.seed_input, "value"), |
| 254 | + model.seed_changed.connect(lambda: self.seed_input.setValue(self._model.seed)), |
| 255 | + self.seed_input.valueChanged.connect( |
| 256 | + lambda v: setattr(self._model, "seed", int(v)) |
| 257 | + ), |
253 | 258 | bind(model, "error", self.error_box, "error", Bind.one_way), |
254 | 259 | model.live.is_active_changed.connect(self.update_is_active), |
255 | 260 | model.live.is_recording_changed.connect(self.update_is_recording), |
|
0 commit comments