From 4520403387c0270be37e7cb08767d1d82fb35f1a Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 15 Apr 2016 19:06:14 +0300 Subject: [PATCH] - Added checkbox for controlling the visibility of Projectors panel in 1st time wiz. --- openlp/core/common/settings.py | 2 +- openlp/core/ui/firsttimeform.py | 1 - openlp/core/ui/firsttimewizard.py | 19 ++++++++++++++++++- openlp/core/ui/mainwindow.py | 15 ++++++++++++--- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index d43cf02b3..a379736e1 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -187,8 +187,8 @@ class Settings(QtCore.QSettings): 'user interface/main window state': QtCore.QByteArray(), 'user interface/preview panel': True, 'user interface/preview splitter geometry': QtCore.QByteArray(), - 'user interface/projectors hidden in wizard': True, 'user interface/layout preset enabled': False, + 'projector/show after wizard': False, 'projector/db type': 'sqlite', 'projector/db username': '', 'projector/db password': '', diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index c74ebfd3a..f2be3b29c 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -576,7 +576,6 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): self.progress_label.setText(translate('OpenLP.FirstTimeWizard', 'Click the %s button to start OpenLP.') % clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) - Settings().setValue('user interface/projectors hidden in wizard', True) self.finish_button.setVisible(True) self.finish_button.setEnabled(True) self.cancel_button.setVisible(False) diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 61b82780b..5b033d79b 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -24,7 +24,7 @@ The UI widgets for the first time wizard. """ from PyQt5 import QtCore, QtGui, QtWidgets -from openlp.core.common import translate, is_macosx, clean_button_text +from openlp.core.common import translate, is_macosx, clean_button_text, Settings from openlp.core.lib import build_icon from openlp.core.lib.ui import add_welcome_page @@ -136,6 +136,13 @@ class UiFirstTimeWizard(object): self.alert_check_box.setChecked(True) self.alert_check_box.setObjectName('alert_check_box') self.plugin_layout.addWidget(self.alert_check_box) + self.projectors_check_box = QtWidgets.QCheckBox(self.plugin_page) + # If visibility setting for projector panel is True, check the box. + if Settings().value('projector/show after wizard'): + self.projectors_check_box.setChecked(True) + self.projectors_check_box.setObjectName('projectors_check_box') + self.projectors_check_box.clicked.connect(self.on_projectors_check_box_clicked) + self.plugin_layout.addWidget(self.projectors_check_box) first_time_wizard.setPage(FirstTimePage.Plugins, self.plugin_page) # The song samples page self.songs_page = QtWidgets.QWizardPage() @@ -243,6 +250,9 @@ class UiFirstTimeWizard(object): self.remote_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Allow remote access')) self.song_usage_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Monitor Song Usage')) self.alert_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Allow Alerts')) + self.projectors_check_box.setText(translate('OpenLP.FirstTimeWizard', + 'Projectors - This allows OpenLP to control projectors in your' + ' network that are compatible with PJLink.')) self.no_internet_page.setTitle(translate('OpenLP.FirstTimeWizard', 'No Internet Connection')) self.no_internet_page.setSubTitle( translate('OpenLP.FirstTimeWizard', 'Unable to detect an Internet connection.')) @@ -277,3 +287,10 @@ class UiFirstTimeWizard(object): clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.FinishButton))) first_time_wizard.setButtonText(QtWidgets.QWizard.CustomButton2, clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.CancelButton))) + + def on_projectors_check_box_clicked(self): + # When clicking projectors_check box, change the visibility setting for Projectors panel. + if Settings().value('projector/show after wizard'): + Settings().setValue('projector/show after wizard', False) + else: + Settings().setValue('projector/show after wizard', True) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 0d947e641..87043858e 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -698,9 +698,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): return self.application.set_busy_cursor() self.first_time() - # if settings.value('%s/screen blank' % self.general_settings_section): - #if Settings().value('advanced/enable exit confirmation'): - if Settings().value('user interface/projectors hidden in wizard'): + # Check if Projectors panel should be visible or not after wizard. + if Settings().value('projector/show after wizard'): + self.projector_manager_dock.setVisible(True) + else: self.projector_manager_dock.setVisible(False) for plugin in self.plugin_manager.plugins: self.active_plugin = plugin @@ -1034,6 +1035,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): """ self.set_view_mode(True, True, True, True, True, True, 'default') Settings().setValue('user interface/layout preset enabled', True) + Settings().setValue('projector/show after wizard', True) def on_mode_setup_item_clicked(self): """ @@ -1041,6 +1043,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): """ self.set_view_mode(True, True, False, True, False, True, 'setup') Settings().setValue('user interface/layout preset enabled', True) + Settings().setValue('projector/show after wizard', True) def on_mode_live_item_clicked(self): """ @@ -1048,6 +1051,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): """ self.set_view_mode(False, True, False, False, True, True, 'live') Settings().setValue('user interface/layout preset enabled', True) + Settings().setValue('projector/show after wizard', True) def set_view_mode(self, media=True, service=True, theme=True, preview=True, live=True, projector=True, mode=''): """ @@ -1193,6 +1197,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): """ self.projector_manager_dock.setVisible(not self.projector_manager_dock.isVisible()) Settings().setValue('user interface/layout preset enabled', False) + # Check/uncheck checkbox on First time wizard based on visibility of this panel. + if not Settings().value('projector/show after wizard'): + Settings().setValue('projector/show after wizard', True) + else: + Settings().setValue('projector/show after wizard', False) def toggle_service_manager(self): """