From c7a68b99ae9cd01716f266032e55afe981fae749 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 14 Jul 2022 02:52:55 +0100 Subject: sisyphus-gui : rework window positioning, fix implicit float->int conversion assumption which is deprecated in python3.10 --- src/frontend/gui/sisyphus-gui.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 3aa72ef..75c4bc2 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -100,9 +100,11 @@ class Sisyphus(QtWidgets.QMainWindow): self.exitButton.clicked.connect(self.sisyphusExit) def centerOnScreen(self): - resolution = QtWidgets.QDesktopWidget().screenGeometry() - self.move((resolution.width() / 2) - (self.frameSize().width() / 2), - (resolution.height() / 2) - (self.frameSize().height() / 2)) + screenGeometry = QtWidgets.QDesktopWidget().screenGeometry() + windowGeometry = self.geometry() + horizontalPosition = int(( screenGeometry.width() - windowGeometry.width() ) / 2) + verticalPosition = int(( screenGeometry.height() - windowGeometry.height() ) / 2) + self.move(horizontalPosition, verticalPosition) def rowClicked(self): Sisyphus.pkgSelect = len(self.databaseTable.selectionModel().selectedRows()) @@ -309,9 +311,11 @@ class MirrorConfiguration(QtWidgets.QMainWindow): self.mirrorCombo.activated.connect(self.setMirrorList) def centerOnScreen(self): - resolution = QtWidgets.QDesktopWidget().screenGeometry() - self.move((resolution.width() / 2) - (self.frameSize().width() / 2), - (resolution.height() / 2) - (self.frameSize().height() / 2)) + screenGeometry = QtWidgets.QDesktopWidget().screenGeometry() + windowGeometry = self.geometry() + horizontalPosition = int(( screenGeometry.width() - windowGeometry.width() ) / 2) + verticalPosition = int(( screenGeometry.height() - windowGeometry.height() ) / 2) + self.move(horizontalPosition, verticalPosition) def updateMirrorList(self): model = QtGui.QStandardItemModel() @@ -345,9 +349,11 @@ class LicenseInformation(QtWidgets.QMainWindow): self.centerOnScreen() def centerOnScreen(self): - resolution = QtWidgets.QDesktopWidget().screenGeometry() - self.move((resolution.width() / 2) - (self.frameSize().width() / 2), - (resolution.height() / 2) - (self.frameSize().height() / 2)) + screenGeometry = QtWidgets.QDesktopWidget().screenGeometry() + windowGeometry = self.geometry() + horizontalPosition = int(( screenGeometry.width() - windowGeometry.width() ) / 2) + verticalPosition = int(( screenGeometry.height() - windowGeometry.height() ) / 2) + self.move(horizontalPosition, verticalPosition) # worker/multithreading class -- cgit v1.2.3