From 14a3239a6e455f9890968f3eb5e980683034a4a2 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 6 Nov 2018 21:39:09 +0100 Subject: [PATCH] Reintroduce the display_on_monitor setting. --- openlp/core/display/window.py | 22 +++++++++++----------- openlp/core/ui/screenstab.py | 14 +++++++++++++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index fa0eb6b2b..a34a378c5 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -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: diff --git a/openlp/core/ui/screenstab.py b/openlp/core/ui/screenstab.py index c59ea90ae..75b08e6e9 100644 --- a/openlp/core/ui/screenstab.py +++ b/openlp/core/ui/screenstab.py @@ -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', 'Screen 1')) 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')