From 0f1e15032bae95c2cb16e3ba377702e256cc4491 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 24 Mar 2021 19:20:47 +0100 Subject: [PATCH] toast fix (referenced from original repo) --- pesterchum.py | 4 ++-- toast.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pesterchum.py b/pesterchum.py index fcc8074..416ea1e 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -69,8 +69,8 @@ if vnum.find(".", vnum.find(".")+1) != -1: minor = int(vnum[vnum.find(".")+1:vnum.find(".", vnum.find(".")+1)]) else: minor = int(vnum[vnum.find(".")+1:]) -if not ((major > 4) or (major == 4 and minor >= 6)): - print("ERROR: Pesterchum requires Qt version >= 4.6") +if not ((major > 5) or (major == 5 and minor >= 0)): + print("ERROR: Pesterchum requires at least Qt version >= 5.0") print("You currently have version " + vnum + ". Please upgrade Qt.") exit() diff --git a/toast.py b/toast.py index 71b1ac9..454eee9 100644 --- a/toast.py +++ b/toast.py @@ -2,6 +2,7 @@ import inspect import threading import time, os import ostools +import logging from PyQt5 import QtCore, QtGui, QtWidgets try: @@ -178,7 +179,9 @@ class ToastMachine(object): class PesterToast(QtWidgets.QWidget, DefaultToast): def __init__(self, machine, title, msg, icon, time=3000, parent=None): - QtWidgets.QWidget.__init__(self, parent) + logging.info(isinstance(parent, QtWidgets.QWidget)) + kwds = dict(machine=machine, title=title, msg=msg, icon=icon) + super().__init__(parent, **kwds) self.machine = machine self.time = time @@ -243,7 +246,7 @@ class PesterToast(QtWidgets.QWidget, DefaultToast): o = QtWidgets.QApplication.desktop().screenGeometry(self).bottomRight() anim.setStartValue(p.y() - o.y()) anim.setEndValue(100) - anim.valueChanged[QVariant].connect(self.updateBottomLeftAnimation) + anim.valueChanged[QtCore.QVariant].connect(self.updateBottomLeftAnimation) self.byebye = False @@ -266,7 +269,7 @@ class PesterToast(QtWidgets.QWidget, DefaultToast): @QtCore.pyqtSlot() def reverseTrigger(self): if self.time >= 0: - QtCore.QTimer.singleShot(self.time, self, QtCore.SLOT('reverseStart()')) + QtCore.QTimer.singleShot(self.time, self.reverseStart) @QtCore.pyqtSlot() def reverseStart(self): @@ -283,7 +286,7 @@ class PesterToast(QtWidgets.QWidget, DefaultToast): def updateBottomLeftAnimation(self, value): p = QtWidgets.QApplication.desktop().availableGeometry(self).bottomRight() val = float(self.height())/100 - self.move(p.x()-self.width(), p.y() - (value.toInt()[0] * val) +1) + self.move(p.x()-self.width(), p.y() - (value * val) +1) self.layout().setSpacing(0) QtWidgets.QWidget.show(self)