mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-19 20:32:28 +12:00
Merge pull request #851 from belug23/fix_fullscreen_display_monitor
Fix #456 - Force the distraction free window on the display of the main window
This commit is contained in:
commit
48fa9e4427
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue