MCPcopy
hub / github.com/hacksider/Deep-Live-Cam / _Switch

Class _Switch

modules/ui.py:439–460  ·  view source on GitHub ↗

Compact toggle switch with label + optional tooltip.

Source from the content-addressed store, hash-verified

437
438
439class _Switch(QWidget):
440 """Compact toggle switch with label + optional tooltip."""
441
442 toggled = Signal(bool)
443
444 def __init__(self, text: str, initial: bool, tooltip: str = ""):
445 super().__init__()
446 layout = QHBoxLayout(self)
447 layout.setContentsMargins(0, 0, 0, 0)
448 self._checkbox = QCheckBox(text)
449 self._checkbox.setChecked(initial)
450 self._checkbox.toggled.connect(self.toggled.emit)
451 if tooltip:
452 self._checkbox.setToolTip(tooltip)
453 layout.addWidget(self._checkbox)
454 layout.addStretch(1)
455
456 def isChecked(self) -> bool:
457 return self._checkbox.isChecked()
458
459 def setChecked(self, value: bool) -> None:
460 self._checkbox.setChecked(value)
461
462
463class MainWindow(QMainWindow):

Callers 2

makeMethod · 0.85
_build_options_cardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected