Skip to content

Commit cf1b18b

Browse files
committed
fix(setup): center toggle, grey full block (buttons too), use recommend orange
User feedback iteration: - Remove "Active variant:" header — toggle position + variant grey-out tell the story already. - Center the FP32 / toggle / INT8 row horizontally within the Parakeet box (addStretch before and after). - Grey out the WHOLE inactive variant block, including the Install/Delete/ Cancel buttons (style "QPushButton { color: #888; }"). Buttons remain functionally enabled so the user can re-install or delete the non-active variant at will — only their colour is dimmed. - Recommendation footer ("★ Recommended for your hardware: ...") now uses the same orange (#d8a000) as the inline ★ Recommended badge on the variant row, creating a visual link between the two cues. - Recommended variant name uppercased ("FP32" / "INT8") in the footer for consistency with the variant titles. Toggle behaviour: grey style is applied at build time AND refreshed live by _refresh_tdt_active_badge() on every toggled signal — both the label text and the button stylesheets follow the toggle position.
1 parent be4f0cd commit cf1b18b

1 file changed

Lines changed: 34 additions & 13 deletions

File tree

dictee-setup.py

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8177,20 +8177,34 @@ def _make_model_label_html(self, model, active_quant, recommended_quant):
81778177
)
81788178

81798179
def _refresh_tdt_active_badge(self):
8180-
"""Live-update TDT model labels when the toggle flips: the selected
8181-
variant stays at full colour, the other goes grey. Called by
8182-
ToggleSwitch.toggled — no need to wait for Apply."""
8180+
"""Live-update TDT model rows when the toggle flips:
8181+
- Selected variant: full colour (label + buttons + progress)
8182+
- Other variant: greyed out (label text + buttons styled grey)
8183+
The buttons stay functionally enabled (user can still re-install or
8184+
delete the non-active variant), only their colour is dimmed.
8185+
Called by ToggleSwitch.toggled — no need to wait for Apply."""
81838186
if not hasattr(self, 'tgl_quant'):
81848187
return
81858188
new_active = "int8" if self.tgl_quant.isChecked() else "fp32"
81868189
recommended = suggest_parakeet_quant()
81878190
for model in ASR_MODELS:
8188-
if model.get("quant") not in ("fp32", "int8"):
8191+
model_quant = model.get("quant")
8192+
if model_quant not in ("fp32", "int8"):
81898193
continue
8194+
is_active = (model_quant == new_active)
81908195
widgets = self._model_widgets.get(model["id"])
8191-
if widgets and widgets.get("desc_label"):
8196+
if not widgets:
8197+
continue
8198+
# 1) Refresh the description label (title + sub-line greyed)
8199+
if widgets.get("desc_label"):
81928200
widgets["desc_label"].setText(
81938201
self._make_model_label_html(model, new_active, recommended))
8202+
# 2) Grey out the buttons (still clickable, just visually dimmed)
8203+
dim_style = "" if is_active else "QPushButton { color: #888; }"
8204+
for k in ("button", "btn_delete", "btn_cancel"):
8205+
btn = widgets.get(k)
8206+
if btn:
8207+
btn.setStyleSheet(dim_style)
81948208

81958209
def _build_parakeet_options(self, parent_layout):
81968210
"""Build Parakeet + Sortformer model download UI.
@@ -8267,6 +8281,13 @@ def _build_model_row(layout, model):
82678281
"button": btn, "btn_delete": btn_del,
82688282
"btn_cancel": btn_cancel, "progress": progress, "model": model,
82698283
}
8284+
# Apply initial grey style on buttons if this TDT variant is not active
8285+
model_quant = model.get("quant")
8286+
if model_quant in ("fp32", "int8") and model_quant != active_quant:
8287+
dim_style = "QPushButton { color: #888; }"
8288+
btn.setStyleSheet(dim_style)
8289+
btn_del.setStyleSheet(dim_style)
8290+
btn_cancel.setStyleSheet(dim_style)
82708291

82718292
# === Parakeet group box (no subtitle — the ASR backend combobox already
82728293
# identifies the model family). Just "Parakeet TDT" as section anchor. ===
@@ -8286,13 +8307,12 @@ def _build_model_row(layout, model):
82868307
and model_is_installed(ASR_MODELS[1])
82878308
)
82888309

8289-
# Toggle switch: unchecked = FP32 (left), checked = INT8 (right).
8290-
# The variants above are greyed out when not selected, so the toggle
8291-
# state is visually obvious without extra side labels.
8310+
# Toggle switch centered horizontally: "FP32 [━━●] INT8".
8311+
# Variants above are greyed out when not selected, so the toggle state
8312+
# is visually obvious without a header label.
82928313
toggle_row = QHBoxLayout()
82938314
toggle_row.setContentsMargins(0, 6, 0, 0)
8294-
toggle_row.addWidget(QLabel("<b>" + _("Active variant:") + "</b>"))
8295-
toggle_row.addSpacing(12)
8315+
toggle_row.addStretch() # left padding to center
82968316
toggle_row.addWidget(QLabel("FP32"))
82978317

82988318
self.tgl_quant = ToggleSwitch("")
@@ -8308,7 +8328,7 @@ def _build_model_row(layout, model):
83088328
toggle_row.addWidget(self.tgl_quant)
83098329

83108330
toggle_row.addWidget(QLabel("INT8"))
8311-
toggle_row.addStretch()
8331+
toggle_row.addStretch() # right padding to center
83128332
parakeet_lay.addLayout(toggle_row)
83138333

83148334
# Hardware recommendation footer
@@ -8320,9 +8340,10 @@ def _build_model_row(layout, model):
83208340
else:
83218341
reason = _("No GPU detected — int8 is ~34 % faster on CPU (AVX-VNNI)")
83228342
lbl_reco = QLabel(
8323-
f"<p style='font-size: 9pt; color: #7a7; padding-left: 4px;'>★ "
8343+
# Same orange as the ★ Recommended badge on the variant row for visual link
8344+
f"<p style='font-size: 9pt; color: #d8a000; padding-left: 4px;'>★ "
83248345
+ _("Recommended for your hardware:")
8325-
+ f" <b>{recommended_quant}</b> &mdash; {reason}</p>"
8346+
+ f" <b>{recommended_quant.upper()}</b> &mdash; {reason}</p>"
83268347
)
83278348
lbl_reco.setWordWrap(True)
83288349
parakeet_lay.addWidget(lbl_reco)

0 commit comments

Comments
 (0)