openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #29168
[Merge] lp:~suutari-olli/openlp/show-no-logo-or-background-when-starting into lp:openlp
Azaziah has proposed merging lp:~suutari-olli/openlp/show-no-logo-or-background-when-starting into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
Raoul Snyman (raoul-snyman)
Related bugs:
Bug #1512038 in OpenLP: "Disable default image background, show desktop"
https://bugs.launchpad.net/openlp/+bug/1512038
For more details, see:
https://code.launchpad.net/~suutari-olli/openlp/show-no-logo-or-background-when-starting/+merge/291778
In this re-proposal:
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
--------------------------------------------------------------------------------------------------------------
- Merged to trunk on 13.4.16, tests are now passing.
lp:~suutari-olli/openlp/show-no-logo-or-background-when-starting (revision 2642)
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-01-Pull/1421/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-02-Functional-Tests/1338/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-03-Interface-Tests/1277/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1086/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/677/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05a-Code_Analysis/744/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05b-Test_Coverage/612/
------------------------------------
- Changed comments related to "default image" to match "logo".
- Removed the last remaining default_ from default_logo_xxx code row. (name)
---------------------------
- Added tests
- Moved these settings from Advanced tab to General tab
and renamed "Default image" to "Logo"
--------------------------------------------------------------
Added: "Show no logo" 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.)
--
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py 2016-03-20 15:00:15 +0000
+++ openlp/core/common/settings.py 2016-04-13 15:54:24 +0000
@@ -109,8 +109,6 @@
'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',
# 7 stands for now, 0 to 6 is Monday to Sunday.
'advanced/default service day': 7,
'advanced/default service enabled': True,
@@ -152,6 +150,9 @@
'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,
@@ -207,7 +208,9 @@
# ('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
=== modified file 'openlp/core/common/uistrings.py'
--- openlp/core/common/uistrings.py 2016-01-23 08:15:37 +0000
+++ openlp/core/common/uistrings.py 2016-04-13 15:54:24 +0000
@@ -56,6 +56,7 @@
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')
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2016-04-05 17:30:20 +0000
+++ openlp/core/ui/advancedtab.py 2016-04-13 15:54:24 +0000
@@ -29,8 +29,8 @@
from PyQt5 import QtCore, QtGui, QtWidgets
-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 import AppLocation, Settings, SlideLimits, UiStrings, translate
+from openlp.core.lib import SettingsTab, build_icon
from openlp.core.common.languagemanager import format_time
log = logging.getLogger(__name__)
@@ -45,8 +45,6 @@
"""
Initialise the settings tab
"""
- self.default_image = ':/graphics/openlp-splash-screen.png'
- self.default_color = '#ffffff'
self.data_exists = False
self.icon_path = ':/system/system_settings.png'
advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
@@ -180,33 +178,6 @@
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.right_layout.addWidget(self.default_image_group_box)
# Hide mouse
self.hide_mouse_group_box = QtWidgets.QGroupBox(self.right_column)
self.hide_mouse_group_box.setObjectName('hide_mouse_group_box')
@@ -253,9 +224,6 @@
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.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)
@@ -309,11 +277,6 @@
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.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',
@@ -368,8 +331,6 @@
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.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)
@@ -411,7 +372,6 @@
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
# Don't allow data directory move if running portable.
if settings.value('advanced/is portable'):
self.data_directory_group_box.hide()
@@ -443,8 +403,6 @@
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('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())
@@ -522,24 +480,6 @@
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.default_color = color
-
- def on_default_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.default_file_edit.setText(filename)
- self.default_file_edit.setFocus()
-
def on_data_directory_browse_button_clicked(self):
"""
Browse for a new data directory location.
@@ -657,13 +597,6 @@
self.data_directory_cancel_button.hide()
self.new_data_directory_has_files_label.hide()
- def on_default_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()
-
def on_alternate_rows_check_box_toggled(self, checked):
"""
Notify user about required restart.
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2016-01-16 20:13:41 +0000
+++ openlp/core/ui/generaltab.py 2016-04-13 15:54:24 +0000
@@ -26,8 +26,8 @@
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.common import Registry, Settings, UiStrings, translate, get_images_filter
+from openlp.core.lib import SettingsTab, ScreenList, ColorButton, build_icon
log = logging.getLogger(__name__)
@@ -40,6 +40,8 @@
"""
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 +164,39 @@
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('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)
+ 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 +247,12 @@
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(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.'))
+ 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 +295,10 @@
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 +329,9 @@
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 +394,28 @@
Called when the width, height, x position or y position has changed.
"""
self.display_changed = True
+
+ def on_logo_browse_button_clicked(self):
+ """
+ Select the logo file
+ """
+ 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 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 color for logo.
+ """
+ self.logo_background_color = color
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2016-02-20 21:42:31 +0000
+++ openlp/core/ui/maindisplay.py 2016-04-13 15:54:24 +0000
@@ -254,10 +254,10 @@
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(),
@@ -523,7 +523,9 @@
if not Settings().value('core/display on monitor'):
return
self.frame.evaluateJavaScript('show_blank("show");')
- if self.isHidden():
+ # 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
# Trigger actions when display is active again.
=== modified file 'tests/functional/openlp_core_ui/test_maindisplay.py'
--- tests/functional/openlp_core_ui/test_maindisplay.py 2016-01-11 03:27:28 +0000
+++ tests/functional/openlp_core_ui/test_maindisplay.py 2016-04-13 15:54:24 +0000
@@ -26,7 +26,7 @@
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 @@
'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()
Follow ups