2018-09-12 14:26:04 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-04-13 13:00:22 +00:00
|
|
|
##########################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# ---------------------------------------------------------------------- #
|
2022-02-01 10:10:57 +00:00
|
|
|
# Copyright (c) 2008-2022 OpenLP Developers #
|
2019-04-13 13:00:22 +00:00
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# This program is free software: you can redistribute it and/or modify #
|
|
|
|
# it under the terms of the GNU General Public License as published by #
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or #
|
|
|
|
# (at your option) any later version. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, #
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
|
|
# GNU General Public License for more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License #
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
|
|
|
##########################################################################
|
2018-09-12 14:26:04 +00:00
|
|
|
"""
|
|
|
|
The screen settings tab in the configuration dialog
|
|
|
|
"""
|
2018-11-10 06:26:19 +00:00
|
|
|
from PyQt5 import QtWidgets
|
2018-09-12 14:26:04 +00:00
|
|
|
|
|
|
|
from openlp.core.common.i18n import translate
|
|
|
|
from openlp.core.display.screens import ScreenList
|
|
|
|
from openlp.core.lib.settingstab import SettingsTab
|
2018-11-10 06:26:19 +00:00
|
|
|
from openlp.core.common.registry import Registry
|
2018-09-12 14:26:04 +00:00
|
|
|
from openlp.core.ui.icons import UiIcons
|
2018-11-10 06:26:19 +00:00
|
|
|
from openlp.core.widgets.widgets import ScreenSelectionWidget
|
2018-09-12 14:26:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ScreensTab(SettingsTab):
|
|
|
|
"""
|
|
|
|
ScreensTab is the screen settings tab in the configuration dialog
|
|
|
|
"""
|
|
|
|
def __init__(self, parent):
|
|
|
|
"""
|
|
|
|
Initialise the screen settings tab
|
|
|
|
"""
|
2019-04-09 17:21:35 +00:00
|
|
|
self.icon_path = UiIcons().desktop
|
2018-09-12 14:26:04 +00:00
|
|
|
screens_translated = translate('OpenLP.ScreensTab', 'Screens')
|
|
|
|
super(ScreensTab, self).__init__(parent, 'Screens', screens_translated)
|
|
|
|
self.settings_section = 'core'
|
|
|
|
|
|
|
|
def setup_ui(self):
|
|
|
|
"""
|
|
|
|
Set up the user interface elements
|
|
|
|
"""
|
|
|
|
self.setObjectName('self')
|
|
|
|
self.tab_layout = QtWidgets.QVBoxLayout(self)
|
|
|
|
self.tab_layout.setObjectName('tab_layout')
|
2018-11-10 06:26:19 +00:00
|
|
|
self.screen_selection_widget = ScreenSelectionWidget(self, ScreenList())
|
|
|
|
self.tab_layout.addWidget(self.screen_selection_widget)
|
2018-11-06 20:39:09 +00:00
|
|
|
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)
|
2018-11-10 06:26:19 +00:00
|
|
|
Registry().register_function('config_screen_changed', self.screen_selection_widget.load)
|
2018-09-12 14:26:04 +00:00
|
|
|
|
|
|
|
self.retranslate_ui()
|
|
|
|
|
|
|
|
def retranslate_ui(self):
|
2018-11-06 20:39:09 +00:00
|
|
|
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'))
|
2018-09-12 14:26:04 +00:00
|
|
|
|
2018-11-10 06:26:19 +00:00
|
|
|
def resizeEvent(self, event=None):
|
2018-09-12 14:26:04 +00:00
|
|
|
"""
|
2018-11-10 06:26:19 +00:00
|
|
|
Override resizeEvent() to adjust the position of the identify_button.
|
2018-10-02 06:00:25 +00:00
|
|
|
|
2018-11-10 06:26:19 +00:00
|
|
|
NB: Don't call SettingsTab's resizeEvent() because we're not using its widgets.
|
2018-09-12 14:26:04 +00:00
|
|
|
"""
|
2018-11-10 06:26:19 +00:00
|
|
|
QtWidgets.QWidget.resizeEvent(self, event)
|
2018-09-12 14:26:04 +00:00
|
|
|
|
|
|
|
def load(self):
|
|
|
|
"""
|
|
|
|
Load the settings to populate the tab
|
|
|
|
"""
|
2018-11-10 08:09:10 +00:00
|
|
|
self.screen_selection_widget.load()
|
2018-11-06 20:39:09 +00:00
|
|
|
# Load generic settings
|
2020-02-09 20:24:05 +00:00
|
|
|
self.display_on_monitor_check.setChecked(self.settings.value('core/display on monitor'))
|
2018-09-12 14:26:04 +00:00
|
|
|
|
2018-11-10 06:26:19 +00:00
|
|
|
def save(self):
|
|
|
|
self.screen_selection_widget.save()
|
2020-02-09 20:24:05 +00:00
|
|
|
self.settings.setValue('core/display on monitor', self.display_on_monitor_check.isChecked())
|
2018-09-12 14:26:04 +00:00
|
|
|
# On save update the screens as well
|
2022-01-16 13:15:09 +00:00
|
|
|
if self.tab_visited:
|
|
|
|
self.settings_form.register_post_process('config_screen_changed')
|
|
|
|
self.tab_visited = False
|