From a73c42ac3471cf6dec9889579240c7e502d63d2b Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Tue, 15 Mar 2016 21:39:51 +0200 Subject: [PATCH 01/14] Added: "Do not show anything on startup" as an option for disabling default image and background. (By default OpenLP logo and white bg color are shown on primary Live monitor (At the moment it's only possible to change the color/image but not disable them.) --- openlp/core/common/settings.py | 1 + openlp/core/ui/advancedtab.py | 7 +++++ openlp/core/ui/maindisplay.py | 51 +++++++++++++++++++--------------- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 8ef2b3c8b..d083cae7a 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -121,6 +121,7 @@ class Settings(QtCore.QSettings): 'advanced/double click live': False, 'advanced/enable exit confirmation': True, 'advanced/expand service item': False, + 'advanced/show nothing default': False, 'advanced/hide mouse': True, 'advanced/is portable': False, 'advanced/max recent files': 20, diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 4421b432f..69647a046 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -196,6 +196,9 @@ class AdvancedTab(SettingsTab): self.default_file_layout.addWidget(self.default_browse_button) self.default_file_layout.addWidget(self.default_revert_button) self.default_image_layout.addRow(self.default_file_label, self.default_file_layout) + self.default_show_nothing_check_box = QtWidgets.QCheckBox(self.ui_group_box) + self.default_show_nothing_check_box.setObjectName('default_default_show_nothing_check_box') + self.default_image_layout.addRow(self.default_show_nothing_check_box) self.right_layout.addWidget(self.default_image_group_box) # Hide mouse self.hide_mouse_group_box = QtWidgets.QGroupBox(self.right_column) @@ -299,6 +302,8 @@ class AdvancedTab(SettingsTab): self.default_file_label.setText(translate('OpenLP.AdvancedTab', 'Image file:')) self.default_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.')) self.default_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.')) + self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', + 'Do not show anything on startup')) self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:')) self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:')) self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab', @@ -353,6 +358,7 @@ class AdvancedTab(SettingsTab): self.x11_bypass_check_box.setChecked(settings.value('x11 bypass wm')) self.default_color = settings.value('default color') self.default_file_edit.setText(settings.value('default image')) + self.default_show_nothing_check_box.setChecked(settings.value('show nothing default')) self.slide_limits = settings.value('slide limits') self.is_search_as_you_type_enabled = settings.value('search as type') self.search_as_type_check_box.setChecked(self.is_search_as_you_type_enabled) @@ -426,6 +432,7 @@ class AdvancedTab(SettingsTab): settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked()) settings.setValue('default color', self.default_color) settings.setValue('default image', self.default_file_edit.text()) + settings.setValue('show nothing default', self.default_show_nothing_check_box.isChecked()) settings.setValue('slide limits', self.slide_limits) if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'): settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked()) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index d9a9a6468..c5cc6fbd5 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -252,29 +252,34 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): self.setVisible(False) Display.setup(self) if self.is_live: - # Build the initial frame. - background_color = QtGui.QColor() - background_color.setNamedColor(Settings().value('advanced/default color')) - if not background_color.isValid(): - background_color = QtCore.Qt.white - image_file = Settings().value('advanced/default image') - splash_image = QtGui.QImage(image_file) - self.initial_fame = QtGui.QImage( - self.screen['size'].width(), - self.screen['size'].height(), - QtGui.QImage.Format_ARGB32_Premultiplied) - painter_image = QtGui.QPainter() - painter_image.begin(self.initial_fame) - painter_image.fillRect(self.initial_fame.rect(), background_color) - painter_image.drawImage( - (self.screen['size'].width() - splash_image.width()) // 2, - (self.screen['size'].height() - splash_image.height()) // 2, - splash_image) - service_item = ServiceItem() - service_item.bg_image_bytes = image_to_byte(self.initial_fame) - self.web_view.setHtml(build_html(service_item, self.screen, self.is_live, None, - plugins=self.plugin_manager.plugins)) - self._hide_mouse() + # If "Show no Logo or Image on startup" is enabled, display transparent background instead. + if Settings().value('advanced/show nothing default'): + self.setAttribute(QtCore.Qt.WA_TranslucentBackground) + self.setStyleSheet(TRANSPARENT_STYLESHEET) + else: + # Build the initial frame. + background_color = QtGui.QColor() + background_color.setNamedColor(Settings().value('advanced/default color')) + if not background_color.isValid(): + background_color = QtCore.Qt.white + image_file = Settings().value('advanced/default image') + splash_image = QtGui.QImage(image_file) + self.initial_fame = QtGui.QImage( + self.screen['size'].width(), + self.screen['size'].height(), + QtGui.QImage.Format_ARGB32_Premultiplied) + painter_image = QtGui.QPainter() + painter_image.begin(self.initial_fame) + painter_image.fillRect(self.initial_fame.rect(), background_color) + painter_image.drawImage( + (self.screen['size'].width() - splash_image.width()) // 2, + (self.screen['size'].height() - splash_image.height()) // 2, + splash_image) + service_item = ServiceItem() + service_item.bg_image_bytes = image_to_byte(self.initial_fame) + self.web_view.setHtml(build_html(service_item, self.screen, self.is_live, None, + plugins=self.plugin_manager.plugins)) + self._hide_mouse() def text(self, slide, animate=True): """ From 432c7a6380d97a76beaa4d24610e1ef27a3b6924 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Tue, 15 Mar 2016 22:12:37 +0200 Subject: [PATCH 02/14] Visual ident pep8 fix. If there are other's after this, they are part of trunk? --- openlp/core/ui/advancedtab.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 69647a046..f95da5595 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -302,8 +302,7 @@ class AdvancedTab(SettingsTab): self.default_file_label.setText(translate('OpenLP.AdvancedTab', 'Image file:')) self.default_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.')) self.default_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.')) - self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', - 'Do not show anything on startup')) + self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', 'Do not show anything on startup')) self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:')) self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:')) self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab', From dd70dbe515224a43abb497d124ce66e39a2ba70b Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Wed, 16 Mar 2016 19:37:54 +0200 Subject: [PATCH 03/14] Changed word order from "show nothing default" to "default show nothing" to better match other settings in the set. --- openlp/core/common/settings.py | 2 +- openlp/core/ui/advancedtab.py | 4 ++-- openlp/core/ui/maindisplay.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index d083cae7a..691bd2a69 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -121,7 +121,7 @@ class Settings(QtCore.QSettings): 'advanced/double click live': False, 'advanced/enable exit confirmation': True, 'advanced/expand service item': False, - 'advanced/show nothing default': False, + 'advanced/default show nothing': False, 'advanced/hide mouse': True, 'advanced/is portable': False, 'advanced/max recent files': 20, diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index f95da5595..2ffeb20ba 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -357,7 +357,7 @@ class AdvancedTab(SettingsTab): self.x11_bypass_check_box.setChecked(settings.value('x11 bypass wm')) self.default_color = settings.value('default color') self.default_file_edit.setText(settings.value('default image')) - self.default_show_nothing_check_box.setChecked(settings.value('show nothing default')) + self.default_show_nothing_check_box.setChecked(settings.value('default show nothing')) self.slide_limits = settings.value('slide limits') self.is_search_as_you_type_enabled = settings.value('search as type') self.search_as_type_check_box.setChecked(self.is_search_as_you_type_enabled) @@ -431,7 +431,7 @@ class AdvancedTab(SettingsTab): settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked()) settings.setValue('default color', self.default_color) settings.setValue('default image', self.default_file_edit.text()) - settings.setValue('show nothing default', self.default_show_nothing_check_box.isChecked()) + settings.setValue('default show nothing', self.default_show_nothing_check_box.isChecked()) settings.setValue('slide limits', self.slide_limits) if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'): settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked()) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index c5cc6fbd5..301cf5041 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -253,7 +253,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): Display.setup(self) if self.is_live: # If "Show no Logo or Image on startup" is enabled, display transparent background instead. - if Settings().value('advanced/show nothing default'): + if Settings().value('advanced/default show nothing'): self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setStyleSheet(TRANSPARENT_STYLESHEET) else: From a95f72c93a63058296d438b0cc24774475a6aa4c Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Wed, 30 Mar 2016 19:50:12 +0300 Subject: [PATCH 04/14] Now using self.setVisible(False) instead of transparency for hiding the logo. Renamed the visual text for the setting to: "Don't show Logo" --- openlp/core/ui/advancedtab.py | 2 +- openlp/core/ui/maindisplay.py | 58 +++++++++++++++++------------------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 2ffeb20ba..e3f226d1c 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -302,7 +302,7 @@ class AdvancedTab(SettingsTab): self.default_file_label.setText(translate('OpenLP.AdvancedTab', 'Image file:')) self.default_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.')) self.default_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.')) - self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', 'Do not show anything on startup')) + self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', 'Don\'t show Logo ')) self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:')) self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:')) self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab', diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 301cf5041..e4cc43e07 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -251,35 +251,33 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): self.screen = self.screens.current self.setVisible(False) Display.setup(self) + # If "Show no Logo or Image on startup" is enabled, keep display hidden instead. if self.is_live: - # If "Show no Logo or Image on startup" is enabled, display transparent background instead. if Settings().value('advanced/default show nothing'): - self.setAttribute(QtCore.Qt.WA_TranslucentBackground) - self.setStyleSheet(TRANSPARENT_STYLESHEET) - else: - # Build the initial frame. - background_color = QtGui.QColor() - background_color.setNamedColor(Settings().value('advanced/default color')) - if not background_color.isValid(): - background_color = QtCore.Qt.white - image_file = Settings().value('advanced/default image') - splash_image = QtGui.QImage(image_file) - self.initial_fame = QtGui.QImage( - self.screen['size'].width(), - self.screen['size'].height(), - QtGui.QImage.Format_ARGB32_Premultiplied) - painter_image = QtGui.QPainter() - painter_image.begin(self.initial_fame) - painter_image.fillRect(self.initial_fame.rect(), background_color) - painter_image.drawImage( - (self.screen['size'].width() - splash_image.width()) // 2, - (self.screen['size'].height() - splash_image.height()) // 2, - splash_image) - service_item = ServiceItem() - service_item.bg_image_bytes = image_to_byte(self.initial_fame) - self.web_view.setHtml(build_html(service_item, self.screen, self.is_live, None, - plugins=self.plugin_manager.plugins)) - self._hide_mouse() + self.setVisible(False) + # Build the initial frame. + background_color = QtGui.QColor() + background_color.setNamedColor(Settings().value('advanced/default color')) + if not background_color.isValid(): + background_color = QtCore.Qt.white + image_file = Settings().value('advanced/default image') + splash_image = QtGui.QImage(image_file) + self.initial_fame = QtGui.QImage( + self.screen['size'].width(), + self.screen['size'].height(), + QtGui.QImage.Format_ARGB32_Premultiplied) + painter_image = QtGui.QPainter() + painter_image.begin(self.initial_fame) + painter_image.fillRect(self.initial_fame.rect(), background_color) + painter_image.drawImage( + (self.screen['size'].width() - splash_image.width()) // 2, + (self.screen['size'].height() - splash_image.height()) // 2, + splash_image) + service_item = ServiceItem() + service_item.bg_image_bytes = image_to_byte(self.initial_fame) + self.web_view.setHtml(build_html(service_item, self.screen, self.is_live, None, + plugins=self.plugin_manager.plugins)) + self._hide_mouse() def text(self, slide, animate=True): """ @@ -528,12 +526,14 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): if not Settings().value('core/display on monitor'): return self.frame.evaluateJavaScript('show_blank("show");') - if self.isHidden(): + # Check if setting for hiding default background image and color is enabled. + # If so, display should remain hidden, otherwise default logo is shown. (from def setup) + if self.isHidden() and not Settings().value('advanced/default show nothing'): self.setVisible(True) self.hide_mode = None # Trigger actions when display is active again. if self.is_live: - Registry().execute('live_display_active') + #Registry().execute('live_display_active') # Workaround for bug #1531319, should not be needed with PyQt 5.6. if is_win(): self.shake_web_view() From 16077a855f55044f5f68694b897521827cf0dfcb Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Wed, 30 Mar 2016 20:04:10 +0300 Subject: [PATCH 05/14] Removed # which was added in search for solution from: Registry().execute('live_display_active') (This was noticed while looking at the diff) --- openlp/core/ui/maindisplay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index e4cc43e07..392b617c5 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -533,7 +533,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): self.hide_mode = None # Trigger actions when display is active again. if self.is_live: - #Registry().execute('live_display_active') + Registry().execute('live_display_active') # Workaround for bug #1531319, should not be needed with PyQt 5.6. if is_win(): self.shake_web_view() From 005cf541160a6ee81d9b417afb91e24d50740e26 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Wed, 30 Mar 2016 20:33:56 +0300 Subject: [PATCH 06/14] Removed duplicate check for this setting from def setup, realized it is overridden by later check anyways. --- openlp/core/ui/maindisplay.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 392b617c5..0e5215d89 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -251,10 +251,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): self.screen = self.screens.current self.setVisible(False) Display.setup(self) - # If "Show no Logo or Image on startup" is enabled, keep display hidden instead. if self.is_live: - if Settings().value('advanced/default show nothing'): - self.setVisible(False) # Build the initial frame. background_color = QtGui.QColor() background_color.setNamedColor(Settings().value('advanced/default color')) From 3aa7851c7df002b27fa3f257653daba7e542a6e6 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Thu, 31 Mar 2016 23:35:04 +0300 Subject: [PATCH 07/14] Added two tests for this. The other to check if visibility is changed to "True" for logo, the other for the opposite. To do: How to name this new setting? / Old "Default image" settings. --- openlp/core/ui/advancedtab.py | 2 +- .../openlp_core_ui/test_maindisplay.py | 42 ++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 5f37ff2d0..163c9ccd0 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -307,7 +307,7 @@ class AdvancedTab(SettingsTab): self.default_file_label.setText(translate('OpenLP.AdvancedTab', 'Image file:')) self.default_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.')) self.default_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.')) - self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', 'Don\'t show Logo ')) + self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', 'Don\'t show image or background')) self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:')) self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:')) self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab', diff --git a/tests/functional/openlp_core_ui/test_maindisplay.py b/tests/functional/openlp_core_ui/test_maindisplay.py index 9c80740f2..fc7ae4910 100644 --- a/tests/functional/openlp_core_ui/test_maindisplay.py +++ b/tests/functional/openlp_core_ui/test_maindisplay.py @@ -26,7 +26,7 @@ from unittest import TestCase, skipUnless from PyQt5 import QtCore -from openlp.core.common import Registry, is_macosx +from openlp.core.common import Registry, is_macosx, Settings from openlp.core.lib import ScreenList from openlp.core.ui import MainDisplay from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET @@ -183,3 +183,43 @@ class TestMainDisplay(TestCase, TestMixin): 'Window level should be NSMainMenuWindowLevel + 2') self.assertEqual(pyobjc_nsview.window().collectionBehavior(), NSWindowCollectionBehaviorManaged, 'Window collection behavior should be NSWindowCollectionBehaviorManaged') + + @patch(u'openlp.core.ui.maindisplay.Settings') + def show_display_startup_logo_test(self, MockedSettings): + # GIVEN: Mocked show_display, setting for logo visibility + display = MagicMock() + main_display = MainDisplay(display) + main_display.frame = MagicMock() + main_display.isHidden = MagicMock() + main_display.isHidden.return_value = True + main_display.setVisible = MagicMock() + mocked_settings = MagicMock() + mocked_settings.value.return_value = False + MockedSettings.return_value = mocked_settings + main_display.shake_web_view = MagicMock() + + # WHEN: show_display is called. + main_display.show_display() + + # THEN: setVisible should had been called with "True" + main_display.setVisible.assert_called_once_with(True) + + @patch(u'openlp.core.ui.maindisplay.Settings') + def show_display_hide_startup_logo_test(self, MockedSettings): + # GIVEN: Mocked show_display, setting for logo visibility + display = MagicMock() + main_display = MainDisplay(display) + main_display.frame = MagicMock() + main_display.isHidden = MagicMock() + main_display.isHidden.return_value = False + main_display.setVisible = MagicMock() + mocked_settings = MagicMock() + mocked_settings.value.return_value = False + MockedSettings.return_value = mocked_settings + main_display.shake_web_view = MagicMock() + + # WHEN: show_display is called. + main_display.show_display() + + # THEN: setVisible should had not been called + main_display.setVisible.assert_not_called() From 79724872fd8470d31e992521ecbf88e931bc5130 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 1 Apr 2016 03:54:33 +0300 Subject: [PATCH 08/14] In this branch: - Renamed "Default image" and related settings to "Logo" etc. - Moved these settings to General tab from Advanced tab - Re-wired these settings to code functions To do: - Remove these from advanced tab. - Verify tests still work --- openlp/core/common/settings.py | 9 ++- openlp/core/ui/advancedtab.py | 110 ++++++++++++++++----------------- openlp/core/ui/generaltab.py | 76 ++++++++++++++++++++++- openlp/core/ui/maindisplay.py | 6 +- 4 files changed, 139 insertions(+), 62 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 1ffda0abd..a241650ea 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -109,8 +109,8 @@ class Settings(QtCore.QSettings): 'advanced/alternate rows': not is_win(), 'advanced/current media plugin': -1, 'advanced/data path': '', - 'advanced/default color': '#ffffff', - 'advanced/default image': ':/graphics/openlp-splash-screen.png', + 'advanced/logo background color': '#ffffff', + 'advanced/logo file': ':/graphics/openlp-splash-screen.png', # 7 stands for now, 0 to 6 is Monday to Sunday. 'advanced/default service day': 7, 'advanced/default service enabled': True, @@ -121,7 +121,7 @@ class Settings(QtCore.QSettings): 'advanced/double click live': False, 'advanced/enable exit confirmation': True, 'advanced/expand service item': False, - 'advanced/default show nothing': False, + 'advanced/logo hide on startup': False, 'advanced/hide mouse': True, 'advanced/is portable': False, 'advanced/max recent files': 20, @@ -152,6 +152,9 @@ class Settings(QtCore.QSettings): 'core/save prompt': False, 'core/screen blank': False, 'core/show splash': True, + 'core/logo background color': '#ffffff', + 'core/logo file': ':/graphics/openlp-splash-screen.png', + 'core/logo hide on startup': False, 'core/songselect password': '', 'core/songselect username': '', 'core/update check': True, diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 163c9ccd0..fc65c9dff 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -45,8 +45,8 @@ class AdvancedTab(SettingsTab): """ Initialise the settings tab """ - self.default_image = ':/graphics/openlp-splash-screen.png' - self.default_color = '#ffffff' + self.logo_file = ':/graphics/openlp-splash-screen.png' + self.logo_background_color = '#ffffff' self.data_exists = False self.icon_path = ':/system/system_settings.png' advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced') @@ -173,36 +173,36 @@ class AdvancedTab(SettingsTab): self.data_directory_layout.addRow(self.new_data_directory_has_files_label) self.left_layout.addWidget(self.data_directory_group_box) self.left_layout.addStretch() - # Default Image - self.default_image_group_box = QtWidgets.QGroupBox(self.right_column) - self.default_image_group_box.setObjectName('default_image_group_box') - self.default_image_layout = QtWidgets.QFormLayout(self.default_image_group_box) - self.default_image_layout.setObjectName('default_image_layout') - self.default_color_label = QtWidgets.QLabel(self.default_image_group_box) - self.default_color_label.setObjectName('default_color_label') - self.default_color_button = ColorButton(self.default_image_group_box) - self.default_color_button.setObjectName('default_color_button') - self.default_image_layout.addRow(self.default_color_label, self.default_color_button) - self.default_file_label = QtWidgets.QLabel(self.default_image_group_box) - self.default_file_label.setObjectName('default_file_label') - self.default_file_edit = QtWidgets.QLineEdit(self.default_image_group_box) - self.default_file_edit.setObjectName('default_file_edit') - self.default_browse_button = QtWidgets.QToolButton(self.default_image_group_box) - self.default_browse_button.setObjectName('default_browse_button') - self.default_browse_button.setIcon(build_icon(':/general/general_open.png')) - self.default_revert_button = QtWidgets.QToolButton(self.default_image_group_box) - self.default_revert_button.setObjectName('default_revert_button') - self.default_revert_button.setIcon(build_icon(':/general/general_revert.png')) - self.default_file_layout = QtWidgets.QHBoxLayout() - self.default_file_layout.setObjectName('default_file_layout') - self.default_file_layout.addWidget(self.default_file_edit) - self.default_file_layout.addWidget(self.default_browse_button) - self.default_file_layout.addWidget(self.default_revert_button) - self.default_image_layout.addRow(self.default_file_label, self.default_file_layout) - self.default_show_nothing_check_box = QtWidgets.QCheckBox(self.ui_group_box) - self.default_show_nothing_check_box.setObjectName('default_default_show_nothing_check_box') - self.default_image_layout.addRow(self.default_show_nothing_check_box) - self.right_layout.addWidget(self.default_image_group_box) + # Logo + self.logo_group_box = QtWidgets.QGroupBox(self.right_column) + self.logo_group_box.setObjectName('logo_group_box') + self.logo_layout = QtWidgets.QFormLayout(self.logo_group_box) + self.logo_layout.setObjectName('logo_layout') + self.logo_file_label = QtWidgets.QLabel(self.logo_group_box) + self.logo_file_label.setObjectName('logo_file_label') + self.logo_file_edit = QtWidgets.QLineEdit(self.logo_group_box) + self.logo_file_edit.setObjectName('logo_file_edit') + self.logo_browse_button = QtWidgets.QToolButton(self.logo_group_box) + self.logo_browse_button.setObjectName('logo_browse_button') + self.logo_browse_button.setIcon(build_icon(':/general/general_open.png')) + self.logo_revert_button = QtWidgets.QToolButton(self.logo_group_box) + self.logo_revert_button.setObjectName('logo_revert_button') + self.logo_revert_button.setIcon(build_icon(':/general/general_revert.png')) + self.logo_file_layout = QtWidgets.QHBoxLayout() + self.logo_file_layout.setObjectName('logo_file_layout') + self.logo_file_layout.addWidget(self.logo_file_edit) + self.logo_file_layout.addWidget(self.logo_browse_button) + self.logo_file_layout.addWidget(self.logo_revert_button) + self.logo_layout.addRow(self.logo_file_label, self.logo_file_layout) + self.logo_color_label = QtWidgets.QLabel(self.logo_group_box) + self.logo_color_label.setObjectName('logo_color_label') + self.logo_color_button = ColorButton(self.logo_group_box) + self.logo_color_button.setObjectName('logo_color_button') + self.logo_layout.addRow(self.logo_color_label, self.logo_color_button) + self.logo_hide_on_startup_check_box = QtWidgets.QCheckBox(self.ui_group_box) + self.logo_hide_on_startup_check_box.setObjectName('default_logo_hide_on_startup_check_box') + self.logo_layout.addRow(self.logo_hide_on_startup_check_box) + self.right_layout.addWidget(self.logo_group_box) # Hide mouse self.hide_mouse_group_box = QtWidgets.QGroupBox(self.right_column) self.hide_mouse_group_box.setObjectName('hide_mouse_group_box') @@ -249,9 +249,9 @@ class AdvancedTab(SettingsTab): self.service_name_time.timeChanged.connect(self.update_service_name_example) self.service_name_edit.textChanged.connect(self.update_service_name_example) self.service_name_revert_button.clicked.connect(self.on_service_name_revert_button_clicked) - self.default_color_button.colorChanged.connect(self.on_background_color_changed) - self.default_browse_button.clicked.connect(self.on_default_browse_button_clicked) - self.default_revert_button.clicked.connect(self.on_default_revert_button_clicked) + self.logo_color_button.colorChanged.connect(self.on_background_color_changed) + self.logo_browse_button.clicked.connect(self.on_logo_browse_button_clicked) + self.logo_revert_button.clicked.connect(self.on_logo_revert_button_clicked) self.alternate_rows_check_box.toggled.connect(self.on_alternate_rows_check_box_toggled) self.data_directory_browse_button.clicked.connect(self.on_data_directory_browse_button_clicked) self.data_directory_default_button.clicked.connect(self.on_data_directory_default_button_clicked) @@ -302,12 +302,12 @@ class AdvancedTab(SettingsTab): self.service_name_example_label.setText(translate('OpenLP.AdvancedTab', 'Example:')) self.hide_mouse_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor')) self.hide_mouse_check_box.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window')) - self.default_image_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Default Image')) - self.default_color_label.setText(translate('OpenLP.AdvancedTab', 'Background color:')) - self.default_file_label.setText(translate('OpenLP.AdvancedTab', 'Image file:')) - self.default_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.')) - self.default_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.')) - self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', 'Don\'t show image or background')) + self.logo_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Logo')) + self.logo_color_label.setText(translate('OpenLP.AdvancedTab', 'Background color:')) + self.logo_file_label.setText(translate('OpenLP.AdvancedTab', 'Logo file:')) + self.logo_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.')) + self.logo_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.')) + self.logo_hide_on_startup_check_box.setText(translate('OpenLP.AdvancedTab', 'Don\'t show logo on startup')) self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:')) self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:')) self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab', @@ -361,9 +361,9 @@ class AdvancedTab(SettingsTab): self.service_name_check_box.setChecked(default_service_enabled) self.service_name_check_box_toggled(default_service_enabled) self.x11_bypass_check_box.setChecked(settings.value('x11 bypass wm')) - self.default_color = settings.value('default color') - self.default_file_edit.setText(settings.value('default image')) - self.default_show_nothing_check_box.setChecked(settings.value('default show nothing')) + self.logo_background_color = settings.value('logo background color') + self.logo_file_edit.setText(settings.value('logo file')) + self.logo_hide_on_startup_check_box.setChecked(settings.value('logo hide on startup')) self.slide_limits = settings.value('slide limits') self.is_search_as_you_type_enabled = settings.value('search as type') self.search_as_type_check_box.setChecked(self.is_search_as_you_type_enabled) @@ -405,7 +405,7 @@ class AdvancedTab(SettingsTab): self.current_data_path = AppLocation.get_data_path() log.warning('User requested data path set to default %s' % self.current_data_path) self.data_directory_label.setText(os.path.abspath(self.current_data_path)) - self.default_color_button.color = self.default_color + self.logo_color_button.color = self.logo_background_color # Don't allow data directory move if running portable. if settings.value('advanced/is portable'): self.data_directory_group_box.hide() @@ -436,9 +436,9 @@ class AdvancedTab(SettingsTab): settings.setValue('enable exit confirmation', self.enable_auto_close_check_box.isChecked()) settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked()) settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked()) - settings.setValue('default color', self.default_color) - settings.setValue('default image', self.default_file_edit.text()) - settings.setValue('default show nothing', self.default_show_nothing_check_box.isChecked()) + settings.setValue('logo background color', self.logo_background_color) + settings.setValue('logo file', self.logo_file_edit.text()) + settings.setValue('logo hide on startup', self.logo_hide_on_startup_check_box.isChecked()) settings.setValue('slide limits', self.slide_limits) if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'): settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked()) @@ -520,9 +520,9 @@ class AdvancedTab(SettingsTab): """ Select the background colour of the default display screen. """ - self.default_color = color + self.logo_background_color = color - def on_default_browse_button_clicked(self): + def on_logo_browse_button_clicked(self): """ Select an image for the default display screen. """ @@ -531,8 +531,8 @@ class AdvancedTab(SettingsTab): translate('OpenLP.AdvancedTab', 'Open File'), '', file_filters) if filename: - self.default_file_edit.setText(filename) - self.default_file_edit.setFocus() + self.logo_file_edit.setText(filename) + self.logo_file_edit.setFocus() def on_data_directory_browse_button_clicked(self): """ @@ -651,12 +651,12 @@ class AdvancedTab(SettingsTab): self.data_directory_cancel_button.hide() self.new_data_directory_has_files_label.hide() - def on_default_revert_button_clicked(self): + def on_logo_revert_button_clicked(self): """ Revert the default screen back to the default settings. """ - self.default_file_edit.setText(':/graphics/openlp-splash-screen.png') - self.default_file_edit.setFocus() + self.logo_file_edit.setText(':/graphics/openlp-splash-screen.png') + self.logo_file_edit.setFocus() def on_alternate_rows_check_box_toggled(self, checked): """ diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 8ed8b3edf..4c9c24dca 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -27,7 +27,8 @@ import logging from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import Registry, Settings, UiStrings, translate -from openlp.core.lib import SettingsTab, ScreenList +from openlp.core.lib import SettingsTab, ScreenList, ColorButton, build_icon +from openlp.core.utils import get_images_filter log = logging.getLogger(__name__) @@ -40,6 +41,8 @@ class GeneralTab(SettingsTab): """ Initialise the general settings tab """ + self.logo_file = ':/graphics/openlp-splash-screen.png' + self.logo_background_color = '#ffffff' self.screens = ScreenList() self.icon_path = ':/icon/openlp-logo-16x16.png' general_translated = translate('OpenLP.GeneralTab', 'General') @@ -162,6 +165,39 @@ class GeneralTab(SettingsTab): self.check_for_updates_check_box.setVisible(False) self.startup_layout.addWidget(self.check_for_updates_check_box) self.right_layout.addWidget(self.startup_group_box) + # Logo + self.logo_group_box = QtWidgets.QGroupBox(self.right_column) + self.logo_group_box.setObjectName('logo_group_box') + self.logo_layout = QtWidgets.QFormLayout(self.logo_group_box) + self.logo_layout.setObjectName('logo_layout') + self.logo_file_label = QtWidgets.QLabel(self.logo_group_box) + self.logo_file_label.setObjectName('logo_file_label') + self.logo_file_edit = QtWidgets.QLineEdit(self.logo_group_box) + self.logo_file_edit.setObjectName('logo_file_edit') + self.logo_browse_button = QtWidgets.QToolButton(self.logo_group_box) + self.logo_browse_button.setObjectName('logo_browse_button') + self.logo_browse_button.setIcon(build_icon(':/general/general_open.png')) + self.logo_revert_button = QtWidgets.QToolButton(self.logo_group_box) + self.logo_revert_button.setObjectName('logo_revert_button') + self.logo_revert_button.setIcon(build_icon(':/general/general_revert.png')) + self.logo_file_layout = QtWidgets.QHBoxLayout() + self.logo_file_layout.setObjectName('logo_file_layout') + self.logo_file_layout.addWidget(self.logo_file_edit) + self.logo_file_layout.addWidget(self.logo_browse_button) + self.logo_file_layout.addWidget(self.logo_revert_button) + self.logo_layout.addRow(self.logo_file_label, self.logo_file_layout) + self.logo_color_label = QtWidgets.QLabel(self.logo_group_box) + self.logo_color_label.setObjectName('logo_color_label') + self.logo_color_button = ColorButton(self.logo_group_box) + self.logo_color_button.setObjectName('logo_color_button') + self.logo_layout.addRow(self.logo_color_label, self.logo_color_button) + self.logo_hide_on_startup_check_box = QtWidgets.QCheckBox(self.logo_group_box) + self.logo_hide_on_startup_check_box.setObjectName('default_logo_hide_on_startup_check_box') + self.logo_layout.addRow(self.logo_hide_on_startup_check_box) + self.right_layout.addWidget(self.logo_group_box) + self.logo_color_button.colorChanged.connect(self.on_background_color_changed) + self.logo_browse_button.clicked.connect(self.on_logo_browse_button_clicked) + self.logo_revert_button.clicked.connect(self.on_logo_revert_button_clicked) # Application Settings self.settings_group_box = QtWidgets.QGroupBox(self.right_column) self.settings_group_box.setObjectName('settings_group_box') @@ -212,6 +248,12 @@ class GeneralTab(SettingsTab): self.warning_check_box.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning')) self.auto_open_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service')) self.show_splash_check_box.setText(translate('OpenLP.GeneralTab', 'Show the splash screen')) + self.logo_group_box.setTitle(translate('OpenLP.GeneralTab', 'Logo')) + self.logo_color_label.setText(translate('OpenLP.GeneralTab', 'Background color:')) + self.logo_file_label.setText(translate('OpenLP.GeneralTab', 'Logo file:')) + self.logo_browse_button.setToolTip(translate('OpenLP.GeneralTab', 'Browse for an image file to display.')) + self.logo_revert_button.setToolTip(translate('OpenLP.GeneralTab', 'Revert to the default OpenLP logo.')) + self.logo_hide_on_startup_check_box.setText(translate('OpenLP.GeneralTab', 'Don\'t show logo on startup')) self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP')) self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings')) self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab', @@ -254,6 +296,10 @@ class GeneralTab(SettingsTab): self.warning_check_box.setChecked(settings.value('blank warning')) self.auto_open_check_box.setChecked(settings.value('auto open')) self.show_splash_check_box.setChecked(settings.value('show splash')) + self.logo_background_color = settings.value('logo background color') + self.logo_file_edit.setText(settings.value('logo file')) + self.logo_hide_on_startup_check_box.setChecked(settings.value('logo hide on startup')) + self.logo_color_button.color = self.logo_background_color self.check_for_updates_check_box.setChecked(settings.value('update check')) self.auto_preview_check_box.setChecked(settings.value('auto preview')) self.timeout_spin_box.setValue(settings.value('loop delay')) @@ -284,6 +330,9 @@ class GeneralTab(SettingsTab): settings.setValue('blank warning', self.warning_check_box.isChecked()) settings.setValue('auto open', self.auto_open_check_box.isChecked()) settings.setValue('show splash', self.show_splash_check_box.isChecked()) + settings.setValue('logo background color', self.logo_background_color) + settings.setValue('logo file', self.logo_file_edit.text()) + settings.setValue('logo hide on startup', self.logo_hide_on_startup_check_box.isChecked()) settings.setValue('update check', self.check_for_updates_check_box.isChecked()) settings.setValue('save prompt', self.save_check_service_check_box.isChecked()) settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked()) @@ -346,3 +395,28 @@ class GeneralTab(SettingsTab): Called when the width, height, x position or y position has changed. """ self.display_changed = True + + def on_logo_browse_button_clicked(self): + """ + Select an image for the default display screen. + """ + file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles) + filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(self, + translate('OpenLP.AdvancedTab', 'Open File'), '', + file_filters) + if filename: + self.logo_file_edit.setText(filename) + self.logo_file_edit.setFocus() + + def on_logo_revert_button_clicked(self): + """ + Revert the default screen back to the default settings. + """ + self.logo_file_edit.setText(':/graphics/openlp-splash-screen.png') + self.logo_file_edit.setFocus() + + def on_background_color_changed(self, color): + """ + Select the background colour of the default display screen. + """ + self.logo_background_color = color \ No newline at end of file diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 0e5215d89..2fce7c96a 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -254,10 +254,10 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): if self.is_live: # Build the initial frame. background_color = QtGui.QColor() - background_color.setNamedColor(Settings().value('advanced/default color')) + background_color.setNamedColor(Settings().value('core/logo background color')) if not background_color.isValid(): background_color = QtCore.Qt.white - image_file = Settings().value('advanced/default image') + image_file = Settings().value('core/logo file') splash_image = QtGui.QImage(image_file) self.initial_fame = QtGui.QImage( self.screen['size'].width(), @@ -525,7 +525,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): self.frame.evaluateJavaScript('show_blank("show");') # Check if setting for hiding default background image and color is enabled. # If so, display should remain hidden, otherwise default logo is shown. (from def setup) - if self.isHidden() and not Settings().value('advanced/default show nothing'): + if self.isHidden() and not Settings().value('core/logo hide on startup'): self.setVisible(True) self.hide_mode = None # Trigger actions when display is active again. From eee1301f4e838e701590cc6e2d8f37e6809937df Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 1 Apr 2016 04:11:28 +0300 Subject: [PATCH 09/14] In this branch: - Removed old "Default image" settings from advanced tab. - Removed related imports and functions. - Renamed def on_background_color_changed to on_logo_background_color_changed --- openlp/core/common/settings.py | 3 -- openlp/core/ui/advancedtab.py | 77 +--------------------------------- openlp/core/ui/generaltab.py | 4 +- 3 files changed, 4 insertions(+), 80 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index a241650ea..19821e0c9 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -109,8 +109,6 @@ class Settings(QtCore.QSettings): 'advanced/alternate rows': not is_win(), 'advanced/current media plugin': -1, 'advanced/data path': '', - 'advanced/logo background color': '#ffffff', - 'advanced/logo file': ':/graphics/openlp-splash-screen.png', # 7 stands for now, 0 to 6 is Monday to Sunday. 'advanced/default service day': 7, 'advanced/default service enabled': True, @@ -121,7 +119,6 @@ class Settings(QtCore.QSettings): 'advanced/double click live': False, 'advanced/enable exit confirmation': True, 'advanced/expand service item': False, - 'advanced/logo hide on startup': False, 'advanced/hide mouse': True, 'advanced/is portable': False, 'advanced/max recent files': 20, diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index fc65c9dff..4a25c40a3 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -30,8 +30,8 @@ import sys from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import AppLocation, Settings, SlideLimits, UiStrings, translate -from openlp.core.lib import ColorButton, SettingsTab, build_icon -from openlp.core.utils import format_time, get_images_filter +from openlp.core.lib import SettingsTab, build_icon +from openlp.core.utils import format_time log = logging.getLogger(__name__) @@ -45,8 +45,6 @@ class AdvancedTab(SettingsTab): """ Initialise the settings tab """ - self.logo_file = ':/graphics/openlp-splash-screen.png' - self.logo_background_color = '#ffffff' self.data_exists = False self.icon_path = ':/system/system_settings.png' advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced') @@ -173,36 +171,6 @@ class AdvancedTab(SettingsTab): self.data_directory_layout.addRow(self.new_data_directory_has_files_label) self.left_layout.addWidget(self.data_directory_group_box) self.left_layout.addStretch() - # Logo - self.logo_group_box = QtWidgets.QGroupBox(self.right_column) - self.logo_group_box.setObjectName('logo_group_box') - self.logo_layout = QtWidgets.QFormLayout(self.logo_group_box) - self.logo_layout.setObjectName('logo_layout') - self.logo_file_label = QtWidgets.QLabel(self.logo_group_box) - self.logo_file_label.setObjectName('logo_file_label') - self.logo_file_edit = QtWidgets.QLineEdit(self.logo_group_box) - self.logo_file_edit.setObjectName('logo_file_edit') - self.logo_browse_button = QtWidgets.QToolButton(self.logo_group_box) - self.logo_browse_button.setObjectName('logo_browse_button') - self.logo_browse_button.setIcon(build_icon(':/general/general_open.png')) - self.logo_revert_button = QtWidgets.QToolButton(self.logo_group_box) - self.logo_revert_button.setObjectName('logo_revert_button') - self.logo_revert_button.setIcon(build_icon(':/general/general_revert.png')) - self.logo_file_layout = QtWidgets.QHBoxLayout() - self.logo_file_layout.setObjectName('logo_file_layout') - self.logo_file_layout.addWidget(self.logo_file_edit) - self.logo_file_layout.addWidget(self.logo_browse_button) - self.logo_file_layout.addWidget(self.logo_revert_button) - self.logo_layout.addRow(self.logo_file_label, self.logo_file_layout) - self.logo_color_label = QtWidgets.QLabel(self.logo_group_box) - self.logo_color_label.setObjectName('logo_color_label') - self.logo_color_button = ColorButton(self.logo_group_box) - self.logo_color_button.setObjectName('logo_color_button') - self.logo_layout.addRow(self.logo_color_label, self.logo_color_button) - self.logo_hide_on_startup_check_box = QtWidgets.QCheckBox(self.ui_group_box) - self.logo_hide_on_startup_check_box.setObjectName('default_logo_hide_on_startup_check_box') - self.logo_layout.addRow(self.logo_hide_on_startup_check_box) - self.right_layout.addWidget(self.logo_group_box) # Hide mouse self.hide_mouse_group_box = QtWidgets.QGroupBox(self.right_column) self.hide_mouse_group_box.setObjectName('hide_mouse_group_box') @@ -249,9 +217,6 @@ class AdvancedTab(SettingsTab): self.service_name_time.timeChanged.connect(self.update_service_name_example) self.service_name_edit.textChanged.connect(self.update_service_name_example) self.service_name_revert_button.clicked.connect(self.on_service_name_revert_button_clicked) - self.logo_color_button.colorChanged.connect(self.on_background_color_changed) - self.logo_browse_button.clicked.connect(self.on_logo_browse_button_clicked) - self.logo_revert_button.clicked.connect(self.on_logo_revert_button_clicked) self.alternate_rows_check_box.toggled.connect(self.on_alternate_rows_check_box_toggled) self.data_directory_browse_button.clicked.connect(self.on_data_directory_browse_button_clicked) self.data_directory_default_button.clicked.connect(self.on_data_directory_default_button_clicked) @@ -302,12 +267,6 @@ class AdvancedTab(SettingsTab): self.service_name_example_label.setText(translate('OpenLP.AdvancedTab', 'Example:')) self.hide_mouse_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor')) self.hide_mouse_check_box.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window')) - self.logo_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Logo')) - self.logo_color_label.setText(translate('OpenLP.AdvancedTab', 'Background color:')) - self.logo_file_label.setText(translate('OpenLP.AdvancedTab', 'Logo file:')) - self.logo_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.')) - self.logo_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.')) - self.logo_hide_on_startup_check_box.setText(translate('OpenLP.AdvancedTab', 'Don\'t show logo on startup')) self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:')) self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:')) self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab', @@ -361,9 +320,6 @@ class AdvancedTab(SettingsTab): self.service_name_check_box.setChecked(default_service_enabled) self.service_name_check_box_toggled(default_service_enabled) self.x11_bypass_check_box.setChecked(settings.value('x11 bypass wm')) - self.logo_background_color = settings.value('logo background color') - self.logo_file_edit.setText(settings.value('logo file')) - self.logo_hide_on_startup_check_box.setChecked(settings.value('logo hide on startup')) self.slide_limits = settings.value('slide limits') self.is_search_as_you_type_enabled = settings.value('search as type') self.search_as_type_check_box.setChecked(self.is_search_as_you_type_enabled) @@ -405,7 +361,6 @@ class AdvancedTab(SettingsTab): self.current_data_path = AppLocation.get_data_path() log.warning('User requested data path set to default %s' % self.current_data_path) self.data_directory_label.setText(os.path.abspath(self.current_data_path)) - self.logo_color_button.color = self.logo_background_color # Don't allow data directory move if running portable. if settings.value('advanced/is portable'): self.data_directory_group_box.hide() @@ -436,9 +391,6 @@ class AdvancedTab(SettingsTab): settings.setValue('enable exit confirmation', self.enable_auto_close_check_box.isChecked()) settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked()) settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked()) - settings.setValue('logo background color', self.logo_background_color) - settings.setValue('logo file', self.logo_file_edit.text()) - settings.setValue('logo hide on startup', self.logo_hide_on_startup_check_box.isChecked()) settings.setValue('slide limits', self.slide_limits) if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'): settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked()) @@ -516,24 +468,6 @@ class AdvancedTab(SettingsTab): self.service_name_edit.setText(UiStrings().DefaultServiceName) self.service_name_edit.setFocus() - def on_background_color_changed(self, color): - """ - Select the background colour of the default display screen. - """ - self.logo_background_color = color - - def on_logo_browse_button_clicked(self): - """ - Select an image for the default display screen. - """ - file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles) - filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(self, - translate('OpenLP.AdvancedTab', 'Open File'), '', - file_filters) - if filename: - self.logo_file_edit.setText(filename) - self.logo_file_edit.setFocus() - def on_data_directory_browse_button_clicked(self): """ Browse for a new data directory location. @@ -651,13 +585,6 @@ class AdvancedTab(SettingsTab): self.data_directory_cancel_button.hide() self.new_data_directory_has_files_label.hide() - def on_logo_revert_button_clicked(self): - """ - Revert the default screen back to the default settings. - """ - self.logo_file_edit.setText(':/graphics/openlp-splash-screen.png') - self.logo_file_edit.setFocus() - def on_alternate_rows_check_box_toggled(self, checked): """ Notify user about required restart. diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 4c9c24dca..6e5009996 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -195,7 +195,7 @@ class GeneralTab(SettingsTab): self.logo_hide_on_startup_check_box.setObjectName('default_logo_hide_on_startup_check_box') self.logo_layout.addRow(self.logo_hide_on_startup_check_box) self.right_layout.addWidget(self.logo_group_box) - self.logo_color_button.colorChanged.connect(self.on_background_color_changed) + self.logo_color_button.colorChanged.connect(self.on_logo_background_color_changed) self.logo_browse_button.clicked.connect(self.on_logo_browse_button_clicked) self.logo_revert_button.clicked.connect(self.on_logo_revert_button_clicked) # Application Settings @@ -415,7 +415,7 @@ class GeneralTab(SettingsTab): self.logo_file_edit.setText(':/graphics/openlp-splash-screen.png') self.logo_file_edit.setFocus() - def on_background_color_changed(self, color): + def on_logo_background_color_changed(self, color): """ Select the background colour of the default display screen. """ From 4f5bb4f5ebf10a65f05b861af0e092e5aaa8c34f Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 1 Apr 2016 04:45:46 +0300 Subject: [PATCH 10/14] Added empty newline to the end of generaltab.py --- openlp/core/ui/generaltab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 6e5009996..b50c7f45b 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -419,4 +419,4 @@ class GeneralTab(SettingsTab): """ Select the background colour of the default display screen. """ - self.logo_background_color = color \ No newline at end of file + self.logo_background_color = color From 36d15615d143ed00b2ff95acebd9e919b52c28de Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 1 Apr 2016 05:32:36 +0300 Subject: [PATCH 11/14] - Changed comments related to "default image" to match "logo". - Removed one default_ --- openlp/core/ui/generaltab.py | 8 ++++---- openlp/core/ui/maindisplay.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index b50c7f45b..cc7ac4a3a 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -192,7 +192,7 @@ class GeneralTab(SettingsTab): self.logo_color_button.setObjectName('logo_color_button') self.logo_layout.addRow(self.logo_color_label, self.logo_color_button) self.logo_hide_on_startup_check_box = QtWidgets.QCheckBox(self.logo_group_box) - self.logo_hide_on_startup_check_box.setObjectName('default_logo_hide_on_startup_check_box') + self.logo_hide_on_startup_check_box.setObjectName('logo_hide_on_startup_check_box') self.logo_layout.addRow(self.logo_hide_on_startup_check_box) self.right_layout.addWidget(self.logo_group_box) self.logo_color_button.colorChanged.connect(self.on_logo_background_color_changed) @@ -398,7 +398,7 @@ class GeneralTab(SettingsTab): def on_logo_browse_button_clicked(self): """ - Select an image for the default display screen. + Select the logo file """ file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles) filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(self, @@ -410,13 +410,13 @@ class GeneralTab(SettingsTab): def on_logo_revert_button_clicked(self): """ - Revert the default screen back to the default settings. + Revert the logo file back to the default setting. """ self.logo_file_edit.setText(':/graphics/openlp-splash-screen.png') self.logo_file_edit.setFocus() def on_logo_background_color_changed(self, color): """ - Select the background colour of the default display screen. + Select the background color for logo. """ self.logo_background_color = color diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 2fce7c96a..079235c2d 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -523,8 +523,8 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): if not Settings().value('core/display on monitor'): return self.frame.evaluateJavaScript('show_blank("show");') - # Check if setting for hiding default background image and color is enabled. - # If so, display should remain hidden, otherwise default logo is shown. (from def setup) + # Check if setting for hiding logo on startup is enabled. + # If it is, display should remain hidden, otherwise logo is shown. (from def setup) if self.isHidden() and not Settings().value('core/logo hide on startup'): self.setVisible(True) self.hide_mode = None From 76aa114ff0e27daf8e3683d67759306dac186fd2 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 8 Apr 2016 16:40:34 +0300 Subject: [PATCH 12/14] This now moves old settings from advanced tab into the new settings. --- openlp/core/common/settings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 19821e0c9..4cdf3d712 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -207,7 +207,9 @@ class Settings(QtCore.QSettings): # ('general/recent files', 'core/recent files', [(recent_files_conv, None)]), ('songs/search as type', 'advanced/search as type', []), ('media/players', 'media/players_temp', [(media_players_conv, None)]), # Convert phonon to system - ('media/players_temp', 'media/players', []) # Move temp setting from above to correct setting + ('media/players_temp', 'media/players', []), # Move temp setting from above to correct setting + ('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4. + ('advanced/default image', '/core/logo file', []) # Default image renamed + moved to general after 2.4. ] @staticmethod From f57f335b0f993510f4d5b0c0922ceeb87aef8511 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Fri, 8 Apr 2016 18:03:05 +0300 Subject: [PATCH 13/14] Fixed the broken import statements. --- openlp/core/ui/advancedtab.py | 6 ------ openlp/core/ui/generaltab.py | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 0e36ae352..cf17dac4a 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -29,15 +29,9 @@ import sys from PyQt5 import QtCore, QtGui, QtWidgets -<<<<<<< TREE from openlp.core.common import AppLocation, Settings, SlideLimits, UiStrings, translate from openlp.core.lib import SettingsTab, build_icon -from openlp.core.utils import format_time -======= -from openlp.core.common import AppLocation, Settings, SlideLimits, UiStrings, translate, get_images_filter -from openlp.core.lib import ColorButton, SettingsTab, build_icon from openlp.core.common.languagemanager import format_time ->>>>>>> MERGE-SOURCE log = logging.getLogger(__name__) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index cc7ac4a3a..b0823a5d1 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -26,9 +26,8 @@ import logging from PyQt5 import QtCore, QtGui, QtWidgets -from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.common import Registry, Settings, UiStrings, translate, get_images_filter from openlp.core.lib import SettingsTab, ScreenList, ColorButton, build_icon -from openlp.core.utils import get_images_filter log = logging.getLogger(__name__) From 7219ba22e6c76bba14909bde09bee2477472faa3 Mon Sep 17 00:00:00 2001 From: suutari-olli Date: Wed, 13 Apr 2016 18:50:04 +0300 Subject: [PATCH 14/14] Added: self.BackgroundColorColon = translate('OpenLP.Ui', 'Background color:') to uistrings, background color label now uses this. This same string will be used several times in this branch: https://code.launchpad.net/~suutari-olli/openlp/ui-messages-part-1/+merge/291628 --- openlp/core/common/uistrings.py | 1 + openlp/core/ui/generaltab.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/common/uistrings.py b/openlp/core/common/uistrings.py index 33ebb0a5b..f26b41fc5 100644 --- a/openlp/core/common/uistrings.py +++ b/openlp/core/common/uistrings.py @@ -56,6 +56,7 @@ class UiStrings(object): self.AllFiles = translate('OpenLP.Ui', 'All Files') self.Automatic = translate('OpenLP.Ui', 'Automatic') self.BackgroundColor = translate('OpenLP.Ui', 'Background Color') + self.BackgroundColorColon = translate('OpenLP.Ui', 'Background color:') self.Bottom = translate('OpenLP.Ui', 'Bottom') self.Browse = translate('OpenLP.Ui', 'Browse...') self.Cancel = translate('OpenLP.Ui', 'Cancel') diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index b0823a5d1..be2630b35 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -248,7 +248,7 @@ class GeneralTab(SettingsTab): self.auto_open_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service')) self.show_splash_check_box.setText(translate('OpenLP.GeneralTab', 'Show the splash screen')) self.logo_group_box.setTitle(translate('OpenLP.GeneralTab', 'Logo')) - self.logo_color_label.setText(translate('OpenLP.GeneralTab', 'Background color:')) + self.logo_color_label.setText(UiStrings().BackgroundColorColon) self.logo_file_label.setText(translate('OpenLP.GeneralTab', 'Logo file:')) self.logo_browse_button.setToolTip(translate('OpenLP.GeneralTab', 'Browse for an image file to display.')) self.logo_revert_button.setToolTip(translate('OpenLP.GeneralTab', 'Revert to the default OpenLP logo.'))