Skip to content

Commit

Permalink
Fix initial state of queue popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Acly committed Dec 30, 2023
1 parent faf2366 commit bdbf52d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ai_diffusion/ui/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class QueuePopup(QMenu):

def __init__(self, supports_batch=True, parent: QWidget | None = None):
super().__init__(parent)
self._model = root.active_model
self._connections = []

palette = self.palette()
Expand Down Expand Up @@ -85,14 +84,12 @@ def __init__(self, supports_batch=True, parent: QWidget | None = None):
self._seed_input.setMinimum(0)
self._seed_input.setMaximum(2**31 - 1)
self._seed_input.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
self._seed_input.setEnabled(False)
self._seed_input.setToolTip(
"The seed controls the random part of the output. A fixed seed value will always"
" produce the same result for the same inputs."
)
self._randomize_seed = QToolButton(self)
self._randomize_seed.setIcon(theme.icon("random"))
self._randomize_seed.setEnabled(False)
seed_layout = QHBoxLayout()
seed_layout.addWidget(self._seed_check)
seed_layout.addWidget(self._seed_input)
Expand All @@ -110,6 +107,8 @@ def __init__(self, supports_batch=True, parent: QWidget | None = None):
cancel_layout.addWidget(self._cancel_all)
self._layout.addLayout(cancel_layout, 2, 1)

self._model = root.active_model

@property
def model(self):
return self._model
Expand All @@ -118,6 +117,9 @@ def model(self):
def model(self, model: Model):
Binding.disconnect_all(self._connections)
self._model = model
self._randomize_seed.setEnabled(self._model.fixed_seed)
self._seed_input.setEnabled(self._model.fixed_seed)
self._batch_label.setText(str(self._model.batch_count))
self._connections = [
bind(self._model, "batch_count", self._batch_slider, "value"),
model.batch_count_changed.connect(lambda v: self._batch_label.setText(str(v))),
Expand Down

0 comments on commit bdbf52d

Please sign in to comment.