Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG修复: 经验条可能为空的BUG #152

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/components/profile_level_icon_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ class ProgressArc(ProgressRing):
def __init__(self, parent=None, useAni=True, text="", fontSize=10):
self.text = text
self.fontSize = fontSize
self.drawVal = 0
super().__init__(parent, useAni=useAni)

def paintEvent(self, e):
self.drawVal = self.val or self.drawVal # 有值取值, 没值保持; self.val 在控件刚实例化时, 前几次update可能会为0
painter = QPainter(self)
painter.setRenderHints(QPainter.Antialiasing)

Expand All @@ -35,8 +37,7 @@ def paintEvent(self, e):
# draw bar
pen.setColor(themeColor())
painter.setPen(pen)
degree = int(self.val / (self.maximum() - self.minimum()) * 270)

degree = int(self.drawVal / (self.maximum() - self.minimum()) * 270)
painter.drawArc(rc, -135 * 16, -degree * 16)
painter.setFont(QFont('Microsoft YaHei', self.fontSize, QFont.Bold))
text_rect = QRectF(0, self.height() * 0.85,
Expand Down Expand Up @@ -74,7 +75,6 @@ def __init__(self,
self.paintXpUntilNextLevel = None
self.callUpdate = False

self.updateIcon(icon, xpSinceLastLevel, xpUntilNextLevel, text)

def paintEvent(self, event):
if self.paintXpSinceLastLevel != self.xpSinceLastLevel or self.paintXpUntilNextLevel != self.xpUntilNextLevel or self.callUpdate:
Expand Down