MCPcopy
hub / github.com/tonquer/JMComic-qt / SetLike

Method SetLike

src/component/widget/comment_item_widget.py:59–70  ·  view source on GitHub ↗
(self, isLike=True)

Source from the content-addressed store, hash-verified

57 return self.linkLabel.text()
58
59 def SetLike(self, isLike=True):
60 p = QPixmap()
61 if isLike:
62 p.load(":/png/icon/icon_comment_liked.png")
63 else:
64 p.load(":/png/icon/icon_comment_like.png")
65 nums = re.findall("\d+", self.starButton.text())
66 if nums:
67 num = int(nums[0]) + 1 if isLike else int(nums[0]) - 1
68 self.starButton.setText("({})".format(str(num)))
69 self.starButton.setIcon(QIcon(p.scaled(50, 50, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
70 self.starButton.setChecked(isLike)
71
72 def SetPicture(self, data):
73 self.pictureData = data

Callers

nothing calls this directly

Calls 3

textMethod · 0.80
setTextMethod · 0.80
setIconMethod · 0.45

Tested by

no test coverage detected