Fix #504 disconnected monitor bug

This commit is contained in:
Etoh 2022-02-12 10:39:58 +00:00 committed by GitHub
parent 27c74e3fe1
commit 5082dca8f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2057,7 +2057,12 @@ class MainWindow(QtWidgets.QMainWindow):
settings = QSettings("Syncplay", "MainWindow") settings = QSettings("Syncplay", "MainWindow")
settings.beginGroup("MainWindow") settings.beginGroup("MainWindow")
self.resize(settings.value("size", QSize(700, 500))) self.resize(settings.value("size", QSize(700, 500)))
self.move(settings.value("pos", QPoint(200, 200))) movePos = settings.value("pos", QPoint(200, 200))
windowGeometry = QtWidgets.QApplication.desktop().availableGeometry(self)
posIsOnScreen = windowGeometry.contains(QtCore.QRect(movePos.x(), movePos.y(), 1, 1))
if not posIsOnScreen:
movePos = QPoint(200,200)
self.move(movePos)
if settings.value("showPlaybackButtons", "false") == "true": if settings.value("showPlaybackButtons", "false") == "true":
self.playbackAction.setChecked(True) self.playbackAction.setChecked(True)
self.updatePlaybackFrameVisibility() self.updatePlaybackFrameVisibility()