Reintroduce the display_on_monitor setting.

This commit is contained in:
Tomas Groth 2018-11-06 21:39:09 +01:00
parent d0eebc09df
commit 14a3239a6e
2 changed files with 24 additions and 12 deletions

View File

@ -114,7 +114,7 @@ class DisplayWindow(QtWidgets.QWidget):
from openlp.core.display.webengine import WebEngineView
self._is_initialised = False
self._fbo = None
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool) # | QtCore.Qt.WindowStaysOnTopHint
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.setAutoFillBackground(True)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
@ -139,8 +139,8 @@ class DisplayWindow(QtWidgets.QWidget):
self.update_from_screen(screen)
self.is_display = True
# Only make visible if setting enabled.
# if Settings().value('core/display on monitor'):
self.show()
if Settings().value('core/display on monitor'):
self.show()
def update_from_screen(self, screen):
"""
@ -338,10 +338,10 @@ class DisplayWindow(QtWidgets.QWidget):
"""
Show the display
"""
# if self.is_display:
# # Only make visible if setting enabled.
# if not Settings().value('core/display on monitor'):
# return
if self.is_display:
# Only make visible if setting enabled.
if not Settings().value('core/display on monitor'):
return
self.run_javascript('Display.show();')
# Check if setting for hiding logo on startup is enabled.
# If it is, display should remain hidden, otherwise logo is shown. (from def setup)
@ -365,10 +365,10 @@ class DisplayWindow(QtWidgets.QWidget):
:param mode: How the screen is to be hidden
"""
log.debug('hide_display mode = {mode:d}'.format(mode=mode))
# if self.is_display:
# # Only make visible if setting enabled.
# if not Settings().value('core/display on monitor'):
# return
if self.is_display:
# Only make visible if setting enabled.
if not Settings().value('core/display on monitor'):
return
if mode == HideMode.Screen:
self.setVisible(False)
elif mode == HideMode.Blank:

View File

@ -150,7 +150,6 @@ class ScreensTab(SettingsTab):
self.screen_button_group = QtWidgets.QButtonGroup(self.screen_frame)
self.screen_button_group.setExclusive(True)
self.screen_button_group.setObjectName('screen_button_group')
self.identify_button.clicked.connect(self.on_identify_button_clicked)
self._setup_spin_box(self.left_spin_box, 0, 9999, 0)
@ -158,6 +157,14 @@ class ScreensTab(SettingsTab):
self._setup_spin_box(self.width_spin_box, 0, 9999, 0)
self._setup_spin_box(self.height_spin_box, 0, 9999, 0)
self.generic_group_box = QtWidgets.QGroupBox(self)
self.generic_group_box.setObjectName('generic_group_box')
self.generic_group_layout = QtWidgets.QVBoxLayout(self.generic_group_box)
self.display_on_monitor_check = QtWidgets.QCheckBox(self.generic_group_box)
self.display_on_monitor_check.setObjectName('monitor_combo_box')
self.generic_group_layout.addWidget(self.display_on_monitor_check)
self.tab_layout.addWidget(self.generic_group_box)
self.retranslate_ui()
def retranslate_ui(self):
@ -171,6 +178,8 @@ class ScreensTab(SettingsTab):
self.height_label.setText(translate('OpenLP.ScreensTab', 'Height'))
self.screen_number_label.setText(translate('OpenLP.ScreensTab', '<strong>Screen 1</strong>'))
self.identify_button.setText(translate('OpenLP.ScreensTab', 'Identify Screens'))
self.generic_group_box.setTitle(translate('OpenLP.ScreensTab', 'Generic screen settings'))
self.display_on_monitor_check.setText(translate('OpenLP.ScreensTab', 'Display if a single screen'))
def resizeEvent(self, event=None):
"""
@ -242,6 +251,8 @@ class ScreensTab(SettingsTab):
self.screen_frame_layout.addWidget(screen_button)
self.screen_button_group.addButton(screen_button)
self.screen_frame_layout.addStretch()
# Load generic settings
self.display_on_monitor_check.setChecked(Settings().value('core/display on monitor'))
def save(self):
"""
@ -253,6 +264,7 @@ class ScreensTab(SettingsTab):
for screen in self.screens:
screen_settings[screen.number] = screen.to_dict()
settings.setValue('core/screens', screen_settings)
settings.setValue('core/display on monitor', self.display_on_monitor_check.isChecked())
# On save update the screens as well
self.settings_form.register_post_process('config_screen_changed')