diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-07-14 02:52:55 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-07-14 02:52:55 +0100 |
commit | c7a68b99ae9cd01716f266032e55afe981fae749 (patch) | |
tree | e51f068baaf1f46a7f5b38f722d0ca93ba410501 /src | |
parent | 86336e792c9592f8c04bda79182353dfe0afd800 (diff) |
sisyphus-gui : rework window positioning, fix implicit float->int conversion assumption which is deprecated in python3.10
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/gui/sisyphus-gui.py | 24 |
1 files changed, 15 insertions, 9 deletions
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 |