MCPcopy Create free account
hub / github.com/DIMFLIX/Spectrum-Security / __init__

Method __init__

ui/widgets/toggleswitch.py:69–91  ·  view source on GitHub ↗
(self, text="", onColor=QColor(189, 147, 249), offColor=QColor(136, 136, 136), handleColor=QColor(255, 255, 255),on=False, width=25, radius=23)

Source from the content-addressed store, hash-verified

67 toggled = Signal()
68
69 def __init__(self, text="", onColor=QColor(189, 147, 249), offColor=QColor(136, 136, 136), handleColor=QColor(255, 255, 255),on=False, width=25, radius=23):
70 super().__init__()
71
72 self.text = text
73
74 self.on = on
75
76 self.opacity = QGraphicsOpacityEffect(self)
77 self.opacity.setOpacity(1)
78 self.setGraphicsEffect(self.opacity)
79
80 self.onColor = onColor
81 self.offColor = offColor
82 self.handleAlpha = False
83 self.handleColor = handleColor
84 self.width = width
85 self.radius = radius
86
87
88 self.setMinimumSize(self.width + (self.radius*2) + (len(self.text)*10), self.radius+2)
89
90 self.anim = AnimationHandler(self, 0, self.width, lambda x: 1 - ((1 - x)**3))
91 if self.on: self.anim.value = 1
92
93 def isToggled(self):
94 return not self.on

Callers

nothing calls this directly

Calls 1

AnimationHandlerClass · 0.85

Tested by

no test coverage detected