forked from openlp/openlp
Stop the display window from minimizing when the OpenLP window is not active on macOS
This commit is contained in:
parent
ff0605cb21
commit
fa802a5f3b
@ -29,7 +29,7 @@ import re
|
|||||||
|
|
||||||
from PyQt5 import QtCore, QtWebChannel, QtWidgets
|
from PyQt5 import QtCore, QtWebChannel, QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import is_win
|
from openlp.core.common import is_win, is_macosx
|
||||||
from openlp.core.common.applocation import AppLocation
|
from openlp.core.common.applocation import AppLocation
|
||||||
from openlp.core.common.enum import ServiceItemType
|
from openlp.core.common.enum import ServiceItemType
|
||||||
from openlp.core.common.i18n import translate
|
from openlp.core.common.i18n import translate
|
||||||
@ -84,6 +84,8 @@ class DisplayWindow(QtWidgets.QWidget, RegistryProperties, LogMixin):
|
|||||||
flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint
|
flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint
|
||||||
if self.settings.value('advanced/x11 bypass wm'):
|
if self.settings.value('advanced/x11 bypass wm'):
|
||||||
flags |= QtCore.Qt.X11BypassWindowManagerHint
|
flags |= QtCore.Qt.X11BypassWindowManagerHint
|
||||||
|
if is_macosx():
|
||||||
|
self.setAttribute(QtCore.Qt.WA_MacAlwaysShowToolWindow, True)
|
||||||
# Need to import this inline to get around a QtWebEngine issue
|
# Need to import this inline to get around a QtWebEngine issue
|
||||||
from openlp.core.display.webengine import WebEngineView
|
from openlp.core.display.webengine import WebEngineView
|
||||||
self._is_initialised = False
|
self._is_initialised = False
|
||||||
|
@ -93,6 +93,36 @@ def test_x11_override_off(display_window_env, mock_settings):
|
|||||||
assert x11_bit != QtCore.Qt.X11BypassWindowManagerHint
|
assert x11_bit != QtCore.Qt.X11BypassWindowManagerHint
|
||||||
|
|
||||||
|
|
||||||
|
@patch('openlp.core.display.window.is_macosx')
|
||||||
|
def test_macos_toolwindow_attribute_set(mocked_is_macosx, mock_settings, display_window_env):
|
||||||
|
"""
|
||||||
|
Test that on macOS, the Qt.WA_MacAlwaysShowToolWindow attribute is set
|
||||||
|
"""
|
||||||
|
# GIVEN: We're on macOS
|
||||||
|
mocked_is_macosx.return_value = True
|
||||||
|
|
||||||
|
# WHEN: A DisplayWindow is created
|
||||||
|
display_window = DisplayWindow()
|
||||||
|
|
||||||
|
# THEN: The attribute is set
|
||||||
|
assert display_window.testAttribute(QtCore.Qt.WA_MacAlwaysShowToolWindow) is True
|
||||||
|
|
||||||
|
|
||||||
|
@patch('openlp.core.display.window.is_macosx')
|
||||||
|
def test_not_macos_toolwindow_attribute_set(mocked_is_macosx, mock_settings, display_window_env):
|
||||||
|
"""
|
||||||
|
Test that on systems other than macOS, the Qt.WA_MacAlwaysShowToolWindow attribute is NOT set
|
||||||
|
"""
|
||||||
|
# GIVEN: We're on macOS
|
||||||
|
mocked_is_macosx.return_value = False
|
||||||
|
|
||||||
|
# WHEN: A DisplayWindow is created
|
||||||
|
display_window = DisplayWindow()
|
||||||
|
|
||||||
|
# THEN: The attribute is set
|
||||||
|
assert display_window.testAttribute(QtCore.Qt.WA_MacAlwaysShowToolWindow) is False
|
||||||
|
|
||||||
|
|
||||||
def test_set_scale_not_initialised(display_window_env, mock_settings):
|
def test_set_scale_not_initialised(display_window_env, mock_settings):
|
||||||
"""
|
"""
|
||||||
Test that the scale js is not run if the page is not initialised
|
Test that the scale js is not run if the page is not initialised
|
||||||
|
Loading…
Reference in New Issue
Block a user