Fix #456 - Force the distraction free window to be display on the same screen as the main window

This commit is contained in:
Belug 2021-04-07 20:43:37 -04:00
parent 83fae3f286
commit 696678e25d
2 changed files with 13 additions and 4 deletions

View file

@ -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 QFontMetrics, QColor, QBrush, QPalette, QPainter, QPixmap, QCursor
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QFrame, QWidget, QPushButton, qApp, QStyle, QComboBox, QLabel, QScrollBar, \ 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 # Spell checker support
from manuskript import settings from manuskript import settings
@ -21,7 +21,7 @@ from manuskript.functions import Spellchecker
class fullScreenEditor(QWidget): class fullScreenEditor(QWidget):
def __init__(self, index, parent=None): def __init__(self, index, parent=None, screenNumber=None):
QWidget.__init__(self, parent) QWidget.__init__(self, parent)
self.setAttribute(Qt.WA_DeleteOnClose, True) self.setAttribute(Qt.WA_DeleteOnClose, True)
self._background = None self._background = None
@ -162,6 +162,12 @@ class fullScreenEditor(QWidget):
self.topPanel.setAutoHideVariable('autohide-top') self.topPanel.setAutoHideVariable('autohide-top')
self.leftPanel.setAutoHideVariable('autohide-left') 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 # Connection
self._index.model().dataChanged.connect(self.dataChanged) self._index.model().dataChanged.connect(self.dataChanged)

View file

@ -5,7 +5,7 @@ import locale
from PyQt5.QtCore import QModelIndex, QRect, QPoint from PyQt5.QtCore import QModelIndex, QRect, QPoint
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap, QPainter, QIcon 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 import settings
from manuskript.enums import Outline from manuskript.enums import Outline
@ -379,7 +379,10 @@ class mainEditor(QWidget, Ui_mainEditor):
def showFullScreen(self): def showFullScreen(self):
if self.currentEditor(): 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 # DICT AND STUFF LIKE THAT