From 696678e25d36df33f394c3ac7aabef03c86e67f3 Mon Sep 17 00:00:00 2001 From: Belug Date: Wed, 7 Apr 2021 20:43:37 -0400 Subject: [PATCH] Fix #456 - Force the distraction free window to be display on the same screen as the main window --- manuskript/ui/editors/fullScreenEditor.py | 10 ++++++++-- manuskript/ui/editors/mainEditor.py | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/manuskript/ui/editors/fullScreenEditor.py b/manuskript/ui/editors/fullScreenEditor.py index b2cc75ed..42941f9d 100644 --- a/manuskript/ui/editors/fullScreenEditor.py +++ b/manuskript/ui/editors/fullScreenEditor.py @@ -6,7 +6,7 @@ from PyQt5.QtCore import Qt, QSize, QPoint, QRect, QEvent, QTime, QTimer from PyQt5.QtGui import QFontMetrics, QColor, QBrush, QPalette, QPainter, QPixmap, QCursor from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QFrame, QWidget, QPushButton, qApp, QStyle, QComboBox, QLabel, QScrollBar, \ - QStyleOptionSlider, QHBoxLayout, QVBoxLayout, QMenu, QAction + QStyleOptionSlider, QHBoxLayout, QVBoxLayout, QMenu, QAction, QDesktopWidget # Spell checker support from manuskript import settings @@ -21,7 +21,7 @@ from manuskript.functions import Spellchecker class fullScreenEditor(QWidget): - def __init__(self, index, parent=None): + def __init__(self, index, parent=None, screenNumber=None): QWidget.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose, True) self._background = None @@ -162,6 +162,12 @@ class fullScreenEditor(QWidget): self.topPanel.setAutoHideVariable('autohide-top') self.leftPanel.setAutoHideVariable('autohide-left') + # Set the screen to the same screen as the main window + if screenNumber is not None: + screenres = QDesktopWidget().screenGeometry(screenNumber); + self.move(QPoint(screenres.x(), screenres.y())); + self.resize(screenres.width(), screenres.height()); + # Connection self._index.model().dataChanged.connect(self.dataChanged) diff --git a/manuskript/ui/editors/mainEditor.py b/manuskript/ui/editors/mainEditor.py index 8b629aa2..d8a5c67d 100644 --- a/manuskript/ui/editors/mainEditor.py +++ b/manuskript/ui/editors/mainEditor.py @@ -5,7 +5,7 @@ import locale from PyQt5.QtCore import QModelIndex, QRect, QPoint from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap, QPainter, QIcon -from PyQt5.QtWidgets import QWidget, qApp +from PyQt5.QtWidgets import QWidget, qApp, QDesktopWidget from manuskript import settings from manuskript.enums import Outline @@ -379,7 +379,10 @@ class mainEditor(QWidget, Ui_mainEditor): def showFullScreen(self): if self.currentEditor(): - self._fullScreen = fullScreenEditor(self.currentEditor().currentIndex) + currentScreenNumber = QDesktopWidget().screenNumber(widget=self) + self._fullScreen = fullScreenEditor( + self.currentEditor().currentIndex, + screenNumber=currentScreenNumber) ############################################################################### # DICT AND STUFF LIKE THAT