Skip to content

Commit

Permalink
user parent() method
Browse files Browse the repository at this point in the history
  • Loading branch information
seird committed Jun 11, 2023
1 parent 10d1d7b commit 7ed6eb0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gotify_tray/gui/widgets/MessageWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def __init__(
icon: QtGui.QIcon | None = None,
):
super(MessageWidget, self).__init__(parent)
self._parent = parent
self.setupUi(self)
self.setAutoFillBackground(True)
self.message_item = message_item
Expand Down Expand Up @@ -108,8 +107,8 @@ def set_message_image(self, filename: str):
# Make sure the image fits within the listView
W = settings.value("MessageWidget/content_image/W_percentage", type=float)
H = settings.value("MessageWidget/content_image/H_percentage", type=float)
W *= self._parent.width() - self.label_image.width()
H *= self._parent.height()
W *= self.parent().width() - self.label_image.width()
H *= self.parent().height()

if pixmap.width() > W or pixmap.height() > H:
pixmap = pixmap.scaled(
Expand Down

0 comments on commit 7ed6eb0

Please sign in to comment.