(self, text="", onColor=QColor(189, 147, 249), offColor=QColor(136, 136, 136), handleColor=QColor(255, 255, 255),on=False, width=25, radius=23)
| 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 |
nothing calls this directly
no test coverage detected