python 3.10: explicitly cast some numbers to int

These currently raise deprecation warnings, but will no longer get
autoconverted in python 3.10

- Some Qt functions expect int, not float, and got truncated automatically.
- The QSocketNotifier is sip.voidptr wrapping an int file descriptor
This commit is contained in:
Eli Schwartz 2021-06-22 23:04:00 -04:00
parent 298ede817b
commit d395a910e5
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
3 changed files with 3 additions and 3 deletions

View File

@ -1221,7 +1221,7 @@ class Application(QApplication):
def signal_received(self):
try:
os.read(self.signal_notifier.socket(), 1024)
os.read(int(self.signal_notifier.socket()), 1024)
except OSError:
return
self.shutdown_signal_received.emit()

View File

@ -430,7 +430,7 @@ class CoverDelegate(QStyledItemDelegate):
width = 0.75 * height
else:
width *= self.parent().logicalDpiX() * CM_TO_INCH
self.cover_size = QSize(width, height)
self.cover_size = QSize(int(width), int(height))
self.title_height = 0
if show_title:
f = self.parent().font()

View File

@ -31,7 +31,7 @@ class ImageDelegate(QStyledItemDelegate):
dpr = img.devicePixelRatio()
scaled, nw, nh = fit_image(img.width(), img.height(), w, h)
if scaled:
img = img.scaled(nw*dpr, nh*dpr, Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation)
img = img.scaled(int(nw*dpr), int(nh*dpr), Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation)
iw, ih = int(img.width()/dpr), int(img.height()/dpr)
dx, dy = (option.rect.width() - iw) // 2, (option.rect.height() - ih) // 2
painter.drawPixmap(option.rect.adjusted(dx, dy, -dx, -dy), img)