Skip to content

Commit 043ba9c

Browse files
LennyArchiveAcly
authored andcommitted
"seed_input" field of live.py now uses a QDoubleSpinBox as widget
1 parent 3c115e8 commit 043ba9c

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

ai_diffusion/ui/live.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from PyQt5.QtCore import QMetaObject, QRectF, Qt, QTimer
44
from PyQt5.QtGui import QColor, QFont, QPainter, QPen
55
from PyQt5.QtWidgets import (
6+
QDoubleSpinBox,
67
QHBoxLayout,
78
QLabel,
89
QSizePolicy,
9-
QSpinBox,
1010
QToolButton,
1111
QVBoxLayout,
1212
QWidget,
@@ -165,9 +165,10 @@ def __init__(self):
165165

166166
self.strength_slider = StrengthWidget(parent=self)
167167

168-
self.seed_input = QSpinBox(self)
168+
self.seed_input = QDoubleSpinBox(self)
169+
self.seed_input.setDecimals(0)
169170
self.seed_input.setMinimum(0)
170-
self.seed_input.setMaximum(2**31 - 1)
171+
self.seed_input.setMaximum(2**32 - 1)
171172
self.seed_input.setPrefix(_("Seed") + ": ")
172173
self.seed_input.setToolTip(
173174
_(
@@ -245,11 +246,15 @@ def model(self, model: Model):
245246
if self._model != model:
246247
Binding.disconnect_all(self._model_bindings)
247248
self._model = model
249+
self.seed_input.setValue(model.seed)
248250
self._model_bindings = [
249251
bind(model, "workspace", self.workspace_select, "value", Bind.one_way),
250252
bind(model, "style", self.style_select, "value"),
251253
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+
),
253258
bind(model, "error", self.error_box, "error", Bind.one_way),
254259
model.live.is_active_changed.connect(self.update_is_active),
255260
model.live.is_recording_changed.connect(self.update_is_recording),

0 commit comments

Comments
 (0)