From d51910b6a0a3349c7c50451fd5a9aec0bed67adb Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Thu, 14 Apr 2016 03:59:24 +0300 Subject: [PATCH 01/10] In this commit: - Fixed bug 1565447 (Unable to save panel visibility if View mode is used) - Locking panel visibility now makes the Mode menu unavailable. --- openlp/core/common/settings.py | 1 + openlp/core/ui/mainwindow.py | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index efa251eec..ae201dfd6 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -187,6 +187,7 @@ 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/layout preset enabled': False, 'projector/db type': 'sqlite', 'projector/db username': '', 'projector/db password': '', diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 228969ad1..b320dc62d 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -639,12 +639,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): elif Settings().value(self.general_settings_section + '/auto open'): self.service_manager_contents.load_last_file() view_mode = Settings().value('%s/view mode' % self.general_settings_section) - if view_mode == 'default': + # Cherry + if view_mode == 'default' and Settings().value('user interface/layout preset enabled'): self.mode_default_item.setChecked(True) - elif view_mode == 'setup': + elif view_mode == 'setup' and Settings().value('user interface/layout preset enabled'): self.set_view_mode(True, True, False, True, False, True) self.mode_setup_item.setChecked(True) - elif view_mode == 'live': + elif view_mode == 'live' and Settings().value('user interface/layout preset enabled'): self.set_view_mode(False, True, False, False, True, True) self.mode_live_item.setChecked(True) @@ -1027,18 +1028,21 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): Put OpenLP into "Default" view mode. """ self.set_view_mode(True, True, True, True, True, True, 'default') + Settings().setValue('user interface/layout preset enabled', True) def on_mode_setup_item_clicked(self): """ Put OpenLP into "Setup" view mode. """ self.set_view_mode(True, True, False, True, False, True, 'setup') + Settings().setValue('user interface/layout preset enabled', True) def on_mode_live_item_clicked(self): """ Put OpenLP into "Live" view mode. """ self.set_view_mode(False, True, False, False, True, True, 'live') + Settings().setValue('user interface/layout preset enabled', True) def set_view_mode(self, media=True, service=True, theme=True, preview=True, live=True, projector=True, mode=''): """ @@ -1176,24 +1180,28 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): Toggle the visibility of the media manager """ self.media_manager_dock.setVisible(not self.media_manager_dock.isVisible()) + Settings().setValue('user interface/layout preset enabled', False) def toggle_projector_manager(self): """ Toggle visibility of the projector manager """ self.projector_manager_dock.setVisible(not self.projector_manager_dock.isVisible()) + Settings().setValue('user interface/layout preset enabled', False) def toggle_service_manager(self): """ Toggle the visibility of the service manager """ self.service_manager_dock.setVisible(not self.service_manager_dock.isVisible()) + Settings().setValue('user interface/layout preset enabled', False) def toggle_theme_manager(self): """ Toggle the visibility of the theme manager """ self.theme_manager_dock.setVisible(not self.theme_manager_dock.isVisible()) + Settings().setValue('user interface/layout preset enabled', False) def set_preview_panel_visibility(self, visible): """ @@ -1207,6 +1215,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): self.preview_controller.panel.setVisible(visible) Settings().setValue('user interface/preview panel', visible) self.view_preview_panel.setChecked(visible) + Settings().setValue('user interface/layout preset enabled', False) def set_lock_panel(self, lock): """ @@ -1217,6 +1226,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures) self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures) self.projector_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures) + self.view_mode_menu.setEnabled(False) self.view_media_manager_item.setEnabled(False) self.view_service_manager_item.setEnabled(False) self.view_theme_manager_item.setEnabled(False) @@ -1224,10 +1234,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): self.view_preview_panel.setEnabled(False) self.view_live_panel.setEnabled(False) else: + #Banana self.theme_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures) self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures) self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures) self.projector_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures) + self.view_mode_menu.setEnabled(True) self.view_media_manager_item.setEnabled(True) self.view_service_manager_item.setEnabled(True) self.view_theme_manager_item.setEnabled(True) @@ -1248,6 +1260,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): self.live_controller.panel.setVisible(visible) Settings().setValue('user interface/live panel', visible) self.view_live_panel.setChecked(visible) + Settings().setValue('user interface/layout preset enabled', False) def load_settings(self): """ From 217ecbbfb00fcdf9a5e53809da0d4f5c655d3802 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Thu, 14 Apr 2016 04:10:59 +0300 Subject: [PATCH 02/10] - Removed # Banana and # Cherry comments, which I created to find parts of the code. (Cherry was replaced with actual comment) --- openlp/core/ui/mainwindow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index b320dc62d..74f4e8797 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -638,8 +638,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): self.open_cmd_line_files(self.arguments) elif Settings().value(self.general_settings_section + '/auto open'): self.service_manager_contents.load_last_file() + # This will store currently used layout preset so it remains enabled on next startup. + # If any panel is enabled/disabled after preset is set, this setting is not saved. view_mode = Settings().value('%s/view mode' % self.general_settings_section) - # Cherry if view_mode == 'default' and Settings().value('user interface/layout preset enabled'): self.mode_default_item.setChecked(True) elif view_mode == 'setup' and Settings().value('user interface/layout preset enabled'): @@ -1234,7 +1235,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): self.view_preview_panel.setEnabled(False) self.view_live_panel.setEnabled(False) else: - #Banana self.theme_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures) self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures) self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures) From 2b3515693121d0b9c3b71081cc51718c90351eb3 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Thu, 14 Apr 2016 04:17:36 +0300 Subject: [PATCH 03/10] - Changed default setting from False to True for 'user interface/lock panel': True (This has caused countless cases of users messing up their UI and not knowing how to fix it) --- openlp/core/common/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index ae201dfd6..7da962f39 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -180,7 +180,7 @@ class Settings(QtCore.QSettings): 'themes/wrap footer': False, 'user interface/live panel': True, 'user interface/live splitter geometry': QtCore.QByteArray(), - 'user interface/lock panel': False, + 'user interface/lock panel': True, 'user interface/main window geometry': QtCore.QByteArray(), 'user interface/main window position': QtCore.QPoint(0, 0), 'user interface/main window splitter geometry': QtCore.QByteArray(), From c9065a286ad9ba8ada2f095bab148277c9657472 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Thu, 14 Apr 2016 10:19:59 +0300 Subject: [PATCH 04/10] Added a setting that hides/shows Projectors panel after first time wizard. This still needs a visual UI (Aka checkbox to wizard) --- openlp/core/common/settings.py | 1 + openlp/core/ui/firsttimeform.py | 1 + openlp/core/ui/mainwindow.py | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 7da962f39..d43cf02b3 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -187,6 +187,7 @@ 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/db type': 'sqlite', 'projector/db username': '', diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index f2be3b29c..c74ebfd3a 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -576,6 +576,7 @@ 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/mainwindow.py b/openlp/core/ui/mainwindow.py index 74f4e8797..0d947e641 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -698,6 +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'): + self.projector_manager_dock.setVisible(False) for plugin in self.plugin_manager.plugins: self.active_plugin = plugin old_status = self.active_plugin.status From 4520403387c0270be37e7cb08767d1d82fb35f1a Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 15 Apr 2016 19:06:14 +0300 Subject: [PATCH 05/10] - 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): """ From 9f5426abdc1b51af6e8f92a92f3f30d82cd3f953 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 15 Apr 2016 21:48:27 +0300 Subject: [PATCH 06/10] Added short descriptions for enabling/disabling plugins, improved the messages. --- openlp/core/ui/firsttimewizard.py | 32 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 5b033d79b..a87f55ac5 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -239,20 +239,28 @@ class UiFirstTimeWizard(object): 'downloaded.')) self.download_label.setText(translate('OpenLP.FirstTimeWizard', 'Please wait while OpenLP downloads the ' 'resource index file...')) - self.plugin_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Activate required Plugins')) - self.plugin_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select the Plugins you wish to use. ')) + self.plugin_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Select parts of the program you wish to use')) + self.plugin_page.setSubTitle(translate('OpenLP.FirstTimeWizard', + 'You can also change these settings after the Wizard.')) self.songs_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Songs')) - self.custom_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Custom Slides')) - self.bible_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Bible')) - self.image_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Images')) - self.presentation_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Presentations')) - self.media_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Media (Audio and Video)')) - 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.custom_check_box.setText(translate('OpenLP.FirstTimeWizard', + 'Custom Slides – Easier to manage than songs and they have their own' + ' list of slides')) + self.bible_check_box.setText(translate('OpenLP.FirstTimeWizard', + 'Bibles – Import and show Bibles')) + self.image_check_box.setText(translate('OpenLP.FirstTimeWizard', + 'Images – Show images or replace background with them')) + self.presentation_check_box.setText(translate('OpenLP.FirstTimeWizard', + 'Presentations – Show .ppt, .odp and .pdf presentations')) + self.media_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Media – Playback of Audio and Video files')) + self.remote_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Remote – Control OpenLP via browser or smart' + 'phone app')) + self.song_usage_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Song Usage Monitor')) + self.alert_check_box.setText(translate('OpenLP.FirstTimeWizard', + 'Alerts – Display informative messages while showing other slides')) self.projectors_check_box.setText(translate('OpenLP.FirstTimeWizard', - 'Projectors - This allows OpenLP to control projectors in your' - ' network that are compatible with PJLink.')) + 'Projectors – Allows OpenLP to control PJLink compatible projectors' + ' in your network')) 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.')) From 49dca3a0f91675dc1c4596078390f2b7ebcc88cf Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Sat, 16 Apr 2016 16:58:28 +0300 Subject: [PATCH 07/10] - Changed how preset enabled setting is called - Changed the Projectors desription - Changed Show .ppt .odp and pdf presentations to files. --- openlp/core/common/settings.py | 2 +- openlp/core/ui/firsttimewizard.py | 6 +++--- openlp/core/ui/mainwindow.py | 24 ++++++++++++------------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index a379736e1..80a101462 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -187,7 +187,7 @@ 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/layout preset enabled': False, + 'user interface/is preset layout': False, 'projector/show after wizard': False, 'projector/db type': 'sqlite', 'projector/db username': '', diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index a87f55ac5..9f740e5cf 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -251,7 +251,7 @@ class UiFirstTimeWizard(object): self.image_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Images – Show images or replace background with them')) self.presentation_check_box.setText(translate('OpenLP.FirstTimeWizard', - 'Presentations – Show .ppt, .odp and .pdf presentations')) + 'Presentations – Show .ppt, .odp and .pdf files')) self.media_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Media – Playback of Audio and Video files')) self.remote_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Remote – Control OpenLP via browser or smart' 'phone app')) @@ -259,8 +259,8 @@ class UiFirstTimeWizard(object): self.alert_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Alerts – Display informative messages while showing other slides')) self.projectors_check_box.setText(translate('OpenLP.FirstTimeWizard', - 'Projectors – Allows OpenLP to control PJLink compatible projectors' - ' in your network')) + 'Projectors – Control PJLink compatible projects on your network' + ' from OpenLP')) 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.')) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 87043858e..ac3c19aa4 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -641,12 +641,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): # This will store currently used layout preset so it remains enabled on next startup. # If any panel is enabled/disabled after preset is set, this setting is not saved. view_mode = Settings().value('%s/view mode' % self.general_settings_section) - if view_mode == 'default' and Settings().value('user interface/layout preset enabled'): + if view_mode == 'default' and Settings().value('user interface/is preset layout'): self.mode_default_item.setChecked(True) - elif view_mode == 'setup' and Settings().value('user interface/layout preset enabled'): + elif view_mode == 'setup' and Settings().value('user interface/is preset layout'): self.set_view_mode(True, True, False, True, False, True) self.mode_setup_item.setChecked(True) - elif view_mode == 'live' and Settings().value('user interface/layout preset enabled'): + elif view_mode == 'live' and Settings().value('user interface/is preset layout'): self.set_view_mode(False, True, False, False, True, True) self.mode_live_item.setChecked(True) @@ -1034,7 +1034,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): Put OpenLP into "Default" view mode. """ self.set_view_mode(True, True, True, True, True, True, 'default') - Settings().setValue('user interface/layout preset enabled', True) + Settings().setValue('user interface/is preset layout', True) Settings().setValue('projector/show after wizard', True) def on_mode_setup_item_clicked(self): @@ -1042,7 +1042,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): Put OpenLP into "Setup" view mode. """ self.set_view_mode(True, True, False, True, False, True, 'setup') - Settings().setValue('user interface/layout preset enabled', True) + Settings().setValue('user interface/is preset layout', True) Settings().setValue('projector/show after wizard', True) def on_mode_live_item_clicked(self): @@ -1050,7 +1050,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): Put OpenLP into "Live" view mode. """ self.set_view_mode(False, True, False, False, True, True, 'live') - Settings().setValue('user interface/layout preset enabled', True) + Settings().setValue('user interface/is preset layout', 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=''): @@ -1189,14 +1189,14 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): Toggle the visibility of the media manager """ self.media_manager_dock.setVisible(not self.media_manager_dock.isVisible()) - Settings().setValue('user interface/layout preset enabled', False) + Settings().setValue('user interface/is preset layout', False) def toggle_projector_manager(self): """ Toggle visibility of the projector manager """ self.projector_manager_dock.setVisible(not self.projector_manager_dock.isVisible()) - Settings().setValue('user interface/layout preset enabled', False) + Settings().setValue('user interface/is preset layout', 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) @@ -1208,14 +1208,14 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): Toggle the visibility of the service manager """ self.service_manager_dock.setVisible(not self.service_manager_dock.isVisible()) - Settings().setValue('user interface/layout preset enabled', False) + Settings().setValue('user interface/is preset layout', False) def toggle_theme_manager(self): """ Toggle the visibility of the theme manager """ self.theme_manager_dock.setVisible(not self.theme_manager_dock.isVisible()) - Settings().setValue('user interface/layout preset enabled', False) + Settings().setValue('user interface/is preset layout', False) def set_preview_panel_visibility(self, visible): """ @@ -1229,7 +1229,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): self.preview_controller.panel.setVisible(visible) Settings().setValue('user interface/preview panel', visible) self.view_preview_panel.setChecked(visible) - Settings().setValue('user interface/layout preset enabled', False) + Settings().setValue('user interface/is preset layout', False) def set_lock_panel(self, lock): """ @@ -1273,7 +1273,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): self.live_controller.panel.setVisible(visible) Settings().setValue('user interface/live panel', visible) self.view_live_panel.setChecked(visible) - Settings().setValue('user interface/layout preset enabled', False) + Settings().setValue('user interface/is preset layout', False) def load_settings(self): """ From 12b1d64b6a4682a48430d29e4111cbba6e8803e5 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Sat, 16 Apr 2016 18:13:19 +0300 Subject: [PATCH 08/10] - Started working on test. (This is currently broken, it asks "Are you sure you want to re-run wiz message"), wanted to see if it does it with jenkins. --- tests/functional/openlp_core_ui/test_mainwindow.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/functional/openlp_core_ui/test_mainwindow.py b/tests/functional/openlp_core_ui/test_mainwindow.py index a49ded25c..4608b0bea 100644 --- a/tests/functional/openlp_core_ui/test_mainwindow.py +++ b/tests/functional/openlp_core_ui/test_mainwindow.py @@ -189,3 +189,16 @@ class TestMainWindow(TestCase, TestMixin): # THEN: The media manager dock is made visible self.assertEqual(0, mocked_media_manager_dock.setVisible.call_count) mocked_widget.on_focus.assert_called_with() + + def on_first_time_wizard_clicked_projectors_visibility_true_test(self): + """ + Test that the focus is set on the widget when the search shortcut is triggered + """ + # GIVEN: A build main window set up for testing + + + # WHEN: The search shortcut is triggered + self.main_window.on_first_time_wizard_clicked() + + # THEN: The media manager dock is made visible + From 3639ad1bd4ed2fde2767448befbc316390b140c7 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Mon, 18 Apr 2016 20:18:04 +0300 Subject: [PATCH 09/10] Added two tests. One to check projectors panel is set visible after the wizard, the other for the opposite. --- .../openlp_core_ui/test_mainwindow.py | 61 ++++++++++++++++--- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/tests/functional/openlp_core_ui/test_mainwindow.py b/tests/functional/openlp_core_ui/test_mainwindow.py index 4608b0bea..f3a02e64a 100644 --- a/tests/functional/openlp_core_ui/test_mainwindow.py +++ b/tests/functional/openlp_core_ui/test_mainwindow.py @@ -26,6 +26,8 @@ import os from unittest import TestCase +from PyQt5 import QtWidgets + from openlp.core.ui.mainwindow import MainWindow from openlp.core.lib.ui import UiStrings from openlp.core.common.registry import Registry @@ -35,6 +37,7 @@ from tests.helpers.testmixin import TestMixin from tests.utils.constants import TEST_RESOURCES_PATH + class TestMainWindow(TestCase, TestMixin): def setUp(self): @@ -184,21 +187,63 @@ class TestMainWindow(TestCase, TestMixin): mocked_media_tool_box.currentWidget.return_value = mocked_widget # WHEN: The search shortcut is triggered + self.main_window.on_search_shortcut_triggered() # THEN: The media manager dock is made visible self.assertEqual(0, mocked_media_manager_dock.setVisible.call_count) mocked_widget.on_focus.assert_called_with() - def on_first_time_wizard_clicked_projectors_visibility_true_test(self): - """ - Test that the focus is set on the widget when the search shortcut is triggered - """ - # GIVEN: A build main window set up for testing + @patch('openlp.core.ui.mainwindow.MainWindow.plugin_manager') + @patch('openlp.core.ui.mainwindow.MainWindow.first_time') + @patch('openlp.core.ui.mainwindow.MainWindow.application') + @patch('openlp.core.ui.mainwindow.FirstTimeForm') + @patch('openlp.core.ui.mainwindow.QtWidgets.QMessageBox.warning') + @patch('openlp.core.ui.mainwindow.Settings') + def on_first_time_wizard_clicked_show_projectors_after_test(self, mocked_Settings, mocked_warning, + mocked_FirstTimeForm, mocked_application, + mocked_first_time, + mocked_plugin_manager): + # GIVEN: Main_window, patched things, patched "Yes" as confirmation to re-run wizard, settings to True. + mocked_Settings_obj = MagicMock() + mocked_Settings_obj.value.return_value = True + mocked_Settings.return_value = mocked_Settings_obj + mocked_warning.return_value = QtWidgets.QMessageBox.Yes + mocked_FirstTimeForm_obj = MagicMock() + mocked_FirstTimeForm_obj.was_cancelled = False + mocked_FirstTimeForm.return_value = mocked_FirstTimeForm_obj + mocked_plugin_manager.plugins = [] + self.main_window.projector_manager_dock = MagicMock() - - # WHEN: The search shortcut is triggered + # WHEN: on_first_time_wizard_clicked is called self.main_window.on_first_time_wizard_clicked() - # THEN: The media manager dock is made visible + # THEN: projector_manager_dock.setVisible should had been called once + self.main_window.projector_manager_dock.setVisible.assert_called_once_with(True) + @patch('openlp.core.ui.mainwindow.MainWindow.plugin_manager') + @patch('openlp.core.ui.mainwindow.MainWindow.first_time') + @patch('openlp.core.ui.mainwindow.MainWindow.application') + @patch('openlp.core.ui.mainwindow.FirstTimeForm') + @patch('openlp.core.ui.mainwindow.QtWidgets.QMessageBox.warning') + @patch('openlp.core.ui.mainwindow.Settings') + def on_first_time_wizard_clicked_hide_projectors_after_test(self, mocked_Settings, mocked_warning, + mocked_FirstTimeForm, mocked_application, + mocked_first_time, + mocked_plugin_manager): + # GIVEN: Main_window, patched things, patched "Yes" as confirmation to re-run wizard, settings to False. + mocked_Settings_obj = MagicMock() + mocked_Settings_obj.value.return_value = False + mocked_Settings.return_value = mocked_Settings_obj + mocked_warning.return_value = QtWidgets.QMessageBox.Yes + mocked_FirstTimeForm_obj = MagicMock() + mocked_FirstTimeForm_obj.was_cancelled = False + mocked_FirstTimeForm.return_value = mocked_FirstTimeForm_obj + mocked_plugin_manager.plugins = [] + self.main_window.projector_manager_dock = MagicMock() + + # WHEN: on_first_time_wizard_clicked is called + self.main_window.on_first_time_wizard_clicked() + + # THEN: projector_manager_dock.setVisible should had been called once + self.main_window.projector_manager_dock.setVisible.assert_called_once_with(False) From a0859a5694dcc0c98491e51d0cd3dae10297a338 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Mon, 18 Apr 2016 21:30:22 +0300 Subject: [PATCH 10/10] Noticed I had created 2 unneeded blank lines to test file. --- tests/functional/openlp_core_ui/test_mainwindow.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/functional/openlp_core_ui/test_mainwindow.py b/tests/functional/openlp_core_ui/test_mainwindow.py index f3a02e64a..19e4d01d5 100644 --- a/tests/functional/openlp_core_ui/test_mainwindow.py +++ b/tests/functional/openlp_core_ui/test_mainwindow.py @@ -37,7 +37,6 @@ from tests.helpers.testmixin import TestMixin from tests.utils.constants import TEST_RESOURCES_PATH - class TestMainWindow(TestCase, TestMixin): def setUp(self): @@ -187,7 +186,6 @@ class TestMainWindow(TestCase, TestMixin): mocked_media_tool_box.currentWidget.return_value = mocked_widget # WHEN: The search shortcut is triggered - self.main_window.on_search_shortcut_triggered() # THEN: The media manager dock is made visible