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

Method paintEvent

ui/widgets/circular_progress.py:30–74  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

28 self.update()
29
30 def paintEvent(self, event):
31 width = self.width - self.progress_width
32 height = self.height - self.progress_width
33 margin = self.progress_width / 2
34 value = self.value * 360 / self.max_value
35
36 paint = QPainter()
37 paint.begin(self)
38 paint.setRenderHint(QPainter.Antialiasing)
39
40 font = QFont()
41 font.setFamily(u"Segoe UI")
42 font.setPointSize(17)
43 font.setBold(True)
44 font.setWeight(75)
45 paint.setFont(font)
46
47 rect = QRect(0, 0, self.width, self.height)
48 paint.setPen(Qt.NoPen)
49 paint.drawRect(rect)
50
51 pen = QPen()
52 pen.setColor(QColor(self.progress_color))
53 pen.setWidth(self.progress_width)
54
55 if self.progress_rounded_cap:
56 pen.setCapStyle(Qt.RoundCap)
57
58 if self.enable_bg:
59 pen.setColor(QColor(self.bg_color))
60 paint.setPen(pen)
61 paint.drawArc(margin, margin, width, height, 0, 360 * 16)
62
63 pen.setColor(QColor(self.progress_color))
64 paint.setPen(pen)
65 paint.drawArc(margin, margin, width, height, 90*16, -value*16)
66
67
68 if self.enable_text:
69 pen.setColor(self.text_color)
70 paint.setPen(pen)
71 paint.drawText(rect, Qt.AlignCenter, f"{self.value}{self.suffix}")
72
73
74 paint.end()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected