Merge lp:~suutari-olli/openlp/show-no-logo-or-background-when-starting into lp:openlp

Proposed by Azaziah
Status: Merged
Approved by: Raoul Snyman
Approved revision: 2643
Merged at revision: 2643
Proposed branch: lp:~suutari-olli/openlp/show-no-logo-or-background-when-starting
Merge into: lp:openlp
Diff against target: 402 lines (+130/-78)
6 files modified
openlp/core/common/settings.py (+6/-3)
openlp/core/common/uistrings.py (+1/-0)
openlp/core/ui/advancedtab.py (+2/-69)
openlp/core/ui/generaltab.py (+75/-2)
openlp/core/ui/maindisplay.py (+5/-3)
tests/functional/openlp_core_ui/test_maindisplay.py (+41/-1)
To merge this branch: bzr merge lp:~suutari-olli/openlp/show-no-logo-or-background-when-starting
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Tim Bentley Approve
Review via email: mp+291778@code.launchpad.net

This proposal supersedes a proposal from 2016-04-12.

Description of the change

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.)

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Not sure about moving them as it is alot of work moving settings.
We should not be using transparent display for hidden they are different
and we have issues with it. If you want to hide somthing hide it.
On 16 Mar 2016 19:07, "Azaziah" <email address hidden> wrote:

> The proposal to merge
> lp:~suutari-olli/openlp/show-no-logo-or-background-when-starting into
> lp:openlp has been updated.
>
> Description changed to:
>
> 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.)
>
> I think this and the other "Default image" settings should be moved to
> General options tab under Startup options rather than having them
> separately at advanced tab and the title renamed to something more
> describing. Should I do this?
>
> Jenkis passes but this does not have a test yet.
>
> For more details, see:
>
> https://code.launchpad.net/~suutari-olli/openlp/show-no-logo-or-background-when-starting/+merge/289111
> --
> Your team OpenLP Core is requested to review the proposed merge of
> lp:~suutari-olli/openlp/show-no-logo-or-background-when-starting into
> lp:openlp.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openlp-core
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~openlp-core
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

Thank you for your review.

It’s some work but I think I could do it in about 1-3 hours.
This would probably mean that users need to re-set custom values for these.

You mentioned I should use Hiding instead of Transparency, there are however
some requirements that need to be met.

A) Display should not show either background color or the image.
B) Display status should be not be blanked/hidden so sending the first item to Live works regardless of the setting for Unblanking display for this.
C) User should be able to interact with their desktop normally.

Is it possible to achieve this without using Transparency?

This works in Windows, are there issues with this on Linux/Mac?
Maybe there are no issues with this kind of transparency,
display stops being transparent once something is sent to Live.

There were some other transparency related code parts that I left out since I got it working
with those two rows, maybe they could fix this for other platforms if there are problems?

Revision history for this message
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

As asked previously:

This feature is based purely on:

self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.setStyleSheet(TRANSPARENT_STYLESHEET)

I'd imagine transparent themes are not such a simple feature.

I haven't noticed any trouble with this in Windows, are there any in Linux/Mac?

It seems like using the hide feature would at least require importing bunch of
stuff from some other files since Hide functions are not part of maindisplay.py

I think the best solution would be to go with this code if it works and
think for an alternative if this is broken in the next Qt release.

Thank you for your patience

Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Do not see then need for this and it is very useful to confirm the system is working.

As I said before and will say again stop using transparent for hiding things it is a complexity and unnecessary,

You only need an if statement to display the output not the else.

Unable to test as I only have a single monitor.

review: Needs Fixing
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Minor tweeks but much better.
Needs tests though!

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

This is looking good. The only thing I can see is that you're going to have to write some settings migration code for people (like our church) who have customised their logo screens. There's some code elsewhere to do settings migration, but I can't think of where right now.

review: Needs Fixing
Revision history for this message
Tim Bentley (trb143) wrote :

See question below

Revision history for this message
Azaziah (suutari-olli) wrote :

Your question has been answered.

Revision history for this message
Tim Bentley (trb143) :
review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
109 'advanced/alternate rows': not is_win(),109 'advanced/alternate rows': not is_win(),
110 'advanced/current media plugin': -1,110 'advanced/current media plugin': -1,
111 'advanced/data path': '',111 'advanced/data path': '',
112 'advanced/default color': '#ffffff',
113 'advanced/default image': ':/graphics/openlp-splash-screen.png',
114 # 7 stands for now, 0 to 6 is Monday to Sunday.112 # 7 stands for now, 0 to 6 is Monday to Sunday.
115 'advanced/default service day': 7,113 'advanced/default service day': 7,
116 'advanced/default service enabled': True,114 'advanced/default service enabled': True,
@@ -152,6 +150,9 @@
152 'core/save prompt': False,150 'core/save prompt': False,
153 'core/screen blank': False,151 'core/screen blank': False,
154 'core/show splash': True,152 'core/show splash': True,
153 'core/logo background color': '#ffffff',
154 'core/logo file': ':/graphics/openlp-splash-screen.png',
155 'core/logo hide on startup': False,
155 'core/songselect password': '',156 'core/songselect password': '',
156 'core/songselect username': '',157 'core/songselect username': '',
157 'core/update check': True,158 'core/update check': True,
@@ -207,7 +208,9 @@
207 # ('general/recent files', 'core/recent files', [(recent_files_conv, None)]),208 # ('general/recent files', 'core/recent files', [(recent_files_conv, None)]),
208 ('songs/search as type', 'advanced/search as type', []),209 ('songs/search as type', 'advanced/search as type', []),
209 ('media/players', 'media/players_temp', [(media_players_conv, None)]), # Convert phonon to system210 ('media/players', 'media/players_temp', [(media_players_conv, None)]), # Convert phonon to system
210 ('media/players_temp', 'media/players', []) # Move temp setting from above to correct setting211 ('media/players_temp', 'media/players', []), # Move temp setting from above to correct setting
212 ('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4.
213 ('advanced/default image', '/core/logo file', []) # Default image renamed + moved to general after 2.4.
211 ]214 ]
212215
213 @staticmethod216 @staticmethod
214217
=== 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 @@
56 self.AllFiles = translate('OpenLP.Ui', 'All Files')56 self.AllFiles = translate('OpenLP.Ui', 'All Files')
57 self.Automatic = translate('OpenLP.Ui', 'Automatic')57 self.Automatic = translate('OpenLP.Ui', 'Automatic')
58 self.BackgroundColor = translate('OpenLP.Ui', 'Background Color')58 self.BackgroundColor = translate('OpenLP.Ui', 'Background Color')
59 self.BackgroundColorColon = translate('OpenLP.Ui', 'Background color:')
59 self.Bottom = translate('OpenLP.Ui', 'Bottom')60 self.Bottom = translate('OpenLP.Ui', 'Bottom')
60 self.Browse = translate('OpenLP.Ui', 'Browse...')61 self.Browse = translate('OpenLP.Ui', 'Browse...')
61 self.Cancel = translate('OpenLP.Ui', 'Cancel')62 self.Cancel = translate('OpenLP.Ui', 'Cancel')
6263
=== 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 @@
2929
30from PyQt5 import QtCore, QtGui, QtWidgets30from PyQt5 import QtCore, QtGui, QtWidgets
3131
32from openlp.core.common import AppLocation, Settings, SlideLimits, UiStrings, translate, get_images_filter32from openlp.core.common import AppLocation, Settings, SlideLimits, UiStrings, translate
33from openlp.core.lib import ColorButton, SettingsTab, build_icon33from openlp.core.lib import SettingsTab, build_icon
34from openlp.core.common.languagemanager import format_time34from openlp.core.common.languagemanager import format_time
3535
36log = logging.getLogger(__name__)36log = logging.getLogger(__name__)
@@ -45,8 +45,6 @@
45 """45 """
46 Initialise the settings tab46 Initialise the settings tab
47 """47 """
48 self.default_image = ':/graphics/openlp-splash-screen.png'
49 self.default_color = '#ffffff'
50 self.data_exists = False48 self.data_exists = False
51 self.icon_path = ':/system/system_settings.png'49 self.icon_path = ':/system/system_settings.png'
52 advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')50 advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
@@ -180,33 +178,6 @@
180 self.data_directory_layout.addRow(self.new_data_directory_has_files_label)178 self.data_directory_layout.addRow(self.new_data_directory_has_files_label)
181 self.left_layout.addWidget(self.data_directory_group_box)179 self.left_layout.addWidget(self.data_directory_group_box)
182 self.left_layout.addStretch()180 self.left_layout.addStretch()
183 # Default Image
184 self.default_image_group_box = QtWidgets.QGroupBox(self.right_column)
185 self.default_image_group_box.setObjectName('default_image_group_box')
186 self.default_image_layout = QtWidgets.QFormLayout(self.default_image_group_box)
187 self.default_image_layout.setObjectName('default_image_layout')
188 self.default_color_label = QtWidgets.QLabel(self.default_image_group_box)
189 self.default_color_label.setObjectName('default_color_label')
190 self.default_color_button = ColorButton(self.default_image_group_box)
191 self.default_color_button.setObjectName('default_color_button')
192 self.default_image_layout.addRow(self.default_color_label, self.default_color_button)
193 self.default_file_label = QtWidgets.QLabel(self.default_image_group_box)
194 self.default_file_label.setObjectName('default_file_label')
195 self.default_file_edit = QtWidgets.QLineEdit(self.default_image_group_box)
196 self.default_file_edit.setObjectName('default_file_edit')
197 self.default_browse_button = QtWidgets.QToolButton(self.default_image_group_box)
198 self.default_browse_button.setObjectName('default_browse_button')
199 self.default_browse_button.setIcon(build_icon(':/general/general_open.png'))
200 self.default_revert_button = QtWidgets.QToolButton(self.default_image_group_box)
201 self.default_revert_button.setObjectName('default_revert_button')
202 self.default_revert_button.setIcon(build_icon(':/general/general_revert.png'))
203 self.default_file_layout = QtWidgets.QHBoxLayout()
204 self.default_file_layout.setObjectName('default_file_layout')
205 self.default_file_layout.addWidget(self.default_file_edit)
206 self.default_file_layout.addWidget(self.default_browse_button)
207 self.default_file_layout.addWidget(self.default_revert_button)
208 self.default_image_layout.addRow(self.default_file_label, self.default_file_layout)
209 self.right_layout.addWidget(self.default_image_group_box)
210 # Hide mouse181 # Hide mouse
211 self.hide_mouse_group_box = QtWidgets.QGroupBox(self.right_column)182 self.hide_mouse_group_box = QtWidgets.QGroupBox(self.right_column)
212 self.hide_mouse_group_box.setObjectName('hide_mouse_group_box')183 self.hide_mouse_group_box.setObjectName('hide_mouse_group_box')
@@ -253,9 +224,6 @@
253 self.service_name_time.timeChanged.connect(self.update_service_name_example)224 self.service_name_time.timeChanged.connect(self.update_service_name_example)
254 self.service_name_edit.textChanged.connect(self.update_service_name_example)225 self.service_name_edit.textChanged.connect(self.update_service_name_example)
255 self.service_name_revert_button.clicked.connect(self.on_service_name_revert_button_clicked)226 self.service_name_revert_button.clicked.connect(self.on_service_name_revert_button_clicked)
256 self.default_color_button.colorChanged.connect(self.on_background_color_changed)
257 self.default_browse_button.clicked.connect(self.on_default_browse_button_clicked)
258 self.default_revert_button.clicked.connect(self.on_default_revert_button_clicked)
259 self.alternate_rows_check_box.toggled.connect(self.on_alternate_rows_check_box_toggled)227 self.alternate_rows_check_box.toggled.connect(self.on_alternate_rows_check_box_toggled)
260 self.data_directory_browse_button.clicked.connect(self.on_data_directory_browse_button_clicked)228 self.data_directory_browse_button.clicked.connect(self.on_data_directory_browse_button_clicked)
261 self.data_directory_default_button.clicked.connect(self.on_data_directory_default_button_clicked)229 self.data_directory_default_button.clicked.connect(self.on_data_directory_default_button_clicked)
@@ -309,11 +277,6 @@
309 self.service_name_example_label.setText(translate('OpenLP.AdvancedTab', 'Example:'))277 self.service_name_example_label.setText(translate('OpenLP.AdvancedTab', 'Example:'))
310 self.hide_mouse_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor'))278 self.hide_mouse_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor'))
311 self.hide_mouse_check_box.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window'))279 self.hide_mouse_check_box.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window'))
312 self.default_image_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Default Image'))
313 self.default_color_label.setText(translate('OpenLP.AdvancedTab', 'Background color:'))
314 self.default_file_label.setText(translate('OpenLP.AdvancedTab', 'Image file:'))
315 self.default_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.'))
316 self.default_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.'))
317 self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:'))280 self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:'))
318 self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:'))281 self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:'))
319 self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab',282 self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab',
@@ -368,8 +331,6 @@
368 self.service_name_check_box.setChecked(default_service_enabled)331 self.service_name_check_box.setChecked(default_service_enabled)
369 self.service_name_check_box_toggled(default_service_enabled)332 self.service_name_check_box_toggled(default_service_enabled)
370 self.x11_bypass_check_box.setChecked(settings.value('x11 bypass wm'))333 self.x11_bypass_check_box.setChecked(settings.value('x11 bypass wm'))
371 self.default_color = settings.value('default color')
372 self.default_file_edit.setText(settings.value('default image'))
373 self.slide_limits = settings.value('slide limits')334 self.slide_limits = settings.value('slide limits')
374 self.is_search_as_you_type_enabled = settings.value('search as type')335 self.is_search_as_you_type_enabled = settings.value('search as type')
375 self.search_as_type_check_box.setChecked(self.is_search_as_you_type_enabled)336 self.search_as_type_check_box.setChecked(self.is_search_as_you_type_enabled)
@@ -411,7 +372,6 @@
411 self.current_data_path = AppLocation.get_data_path()372 self.current_data_path = AppLocation.get_data_path()
412 log.warning('User requested data path set to default %s' % self.current_data_path)373 log.warning('User requested data path set to default %s' % self.current_data_path)
413 self.data_directory_label.setText(os.path.abspath(self.current_data_path))374 self.data_directory_label.setText(os.path.abspath(self.current_data_path))
414 self.default_color_button.color = self.default_color
415 # Don't allow data directory move if running portable.375 # Don't allow data directory move if running portable.
416 if settings.value('advanced/is portable'):376 if settings.value('advanced/is portable'):
417 self.data_directory_group_box.hide()377 self.data_directory_group_box.hide()
@@ -443,8 +403,6 @@
443 settings.setValue('enable exit confirmation', self.enable_auto_close_check_box.isChecked())403 settings.setValue('enable exit confirmation', self.enable_auto_close_check_box.isChecked())
444 settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked())404 settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked())
445 settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked())405 settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked())
446 settings.setValue('default color', self.default_color)
447 settings.setValue('default image', self.default_file_edit.text())
448 settings.setValue('slide limits', self.slide_limits)406 settings.setValue('slide limits', self.slide_limits)
449 if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'):407 if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'):
450 settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked())408 settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked())
@@ -522,24 +480,6 @@
522 self.service_name_edit.setText(UiStrings().DefaultServiceName)480 self.service_name_edit.setText(UiStrings().DefaultServiceName)
523 self.service_name_edit.setFocus()481 self.service_name_edit.setFocus()
524482
525 def on_background_color_changed(self, color):
526 """
527 Select the background colour of the default display screen.
528 """
529 self.default_color = color
530
531 def on_default_browse_button_clicked(self):
532 """
533 Select an image for the default display screen.
534 """
535 file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles)
536 filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(self,
537 translate('OpenLP.AdvancedTab', 'Open File'), '',
538 file_filters)
539 if filename:
540 self.default_file_edit.setText(filename)
541 self.default_file_edit.setFocus()
542
543 def on_data_directory_browse_button_clicked(self):483 def on_data_directory_browse_button_clicked(self):
544 """484 """
545 Browse for a new data directory location.485 Browse for a new data directory location.
@@ -657,13 +597,6 @@
657 self.data_directory_cancel_button.hide()597 self.data_directory_cancel_button.hide()
658 self.new_data_directory_has_files_label.hide()598 self.new_data_directory_has_files_label.hide()
659599
660 def on_default_revert_button_clicked(self):
661 """
662 Revert the default screen back to the default settings.
663 """
664 self.default_file_edit.setText(':/graphics/openlp-splash-screen.png')
665 self.default_file_edit.setFocus()
666
667 def on_alternate_rows_check_box_toggled(self, checked):600 def on_alternate_rows_check_box_toggled(self, checked):
668 """601 """
669 Notify user about required restart.602 Notify user about required restart.
670603
=== 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 @@
2626
27from PyQt5 import QtCore, QtGui, QtWidgets27from PyQt5 import QtCore, QtGui, QtWidgets
2828
29from openlp.core.common import Registry, Settings, UiStrings, translate29from openlp.core.common import Registry, Settings, UiStrings, translate, get_images_filter
30from openlp.core.lib import SettingsTab, ScreenList30from openlp.core.lib import SettingsTab, ScreenList, ColorButton, build_icon
3131
32log = logging.getLogger(__name__)32log = logging.getLogger(__name__)
3333
@@ -40,6 +40,8 @@
40 """40 """
41 Initialise the general settings tab41 Initialise the general settings tab
42 """42 """
43 self.logo_file = ':/graphics/openlp-splash-screen.png'
44 self.logo_background_color = '#ffffff'
43 self.screens = ScreenList()45 self.screens = ScreenList()
44 self.icon_path = ':/icon/openlp-logo-16x16.png'46 self.icon_path = ':/icon/openlp-logo-16x16.png'
45 general_translated = translate('OpenLP.GeneralTab', 'General')47 general_translated = translate('OpenLP.GeneralTab', 'General')
@@ -162,6 +164,39 @@
162 self.check_for_updates_check_box.setVisible(False)164 self.check_for_updates_check_box.setVisible(False)
163 self.startup_layout.addWidget(self.check_for_updates_check_box)165 self.startup_layout.addWidget(self.check_for_updates_check_box)
164 self.right_layout.addWidget(self.startup_group_box)166 self.right_layout.addWidget(self.startup_group_box)
167 # Logo
168 self.logo_group_box = QtWidgets.QGroupBox(self.right_column)
169 self.logo_group_box.setObjectName('logo_group_box')
170 self.logo_layout = QtWidgets.QFormLayout(self.logo_group_box)
171 self.logo_layout.setObjectName('logo_layout')
172 self.logo_file_label = QtWidgets.QLabel(self.logo_group_box)
173 self.logo_file_label.setObjectName('logo_file_label')
174 self.logo_file_edit = QtWidgets.QLineEdit(self.logo_group_box)
175 self.logo_file_edit.setObjectName('logo_file_edit')
176 self.logo_browse_button = QtWidgets.QToolButton(self.logo_group_box)
177 self.logo_browse_button.setObjectName('logo_browse_button')
178 self.logo_browse_button.setIcon(build_icon(':/general/general_open.png'))
179 self.logo_revert_button = QtWidgets.QToolButton(self.logo_group_box)
180 self.logo_revert_button.setObjectName('logo_revert_button')
181 self.logo_revert_button.setIcon(build_icon(':/general/general_revert.png'))
182 self.logo_file_layout = QtWidgets.QHBoxLayout()
183 self.logo_file_layout.setObjectName('logo_file_layout')
184 self.logo_file_layout.addWidget(self.logo_file_edit)
185 self.logo_file_layout.addWidget(self.logo_browse_button)
186 self.logo_file_layout.addWidget(self.logo_revert_button)
187 self.logo_layout.addRow(self.logo_file_label, self.logo_file_layout)
188 self.logo_color_label = QtWidgets.QLabel(self.logo_group_box)
189 self.logo_color_label.setObjectName('logo_color_label')
190 self.logo_color_button = ColorButton(self.logo_group_box)
191 self.logo_color_button.setObjectName('logo_color_button')
192 self.logo_layout.addRow(self.logo_color_label, self.logo_color_button)
193 self.logo_hide_on_startup_check_box = QtWidgets.QCheckBox(self.logo_group_box)
194 self.logo_hide_on_startup_check_box.setObjectName('logo_hide_on_startup_check_box')
195 self.logo_layout.addRow(self.logo_hide_on_startup_check_box)
196 self.right_layout.addWidget(self.logo_group_box)
197 self.logo_color_button.colorChanged.connect(self.on_logo_background_color_changed)
198 self.logo_browse_button.clicked.connect(self.on_logo_browse_button_clicked)
199 self.logo_revert_button.clicked.connect(self.on_logo_revert_button_clicked)
165 # Application Settings200 # Application Settings
166 self.settings_group_box = QtWidgets.QGroupBox(self.right_column)201 self.settings_group_box = QtWidgets.QGroupBox(self.right_column)
167 self.settings_group_box.setObjectName('settings_group_box')202 self.settings_group_box.setObjectName('settings_group_box')
@@ -212,6 +247,12 @@
212 self.warning_check_box.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning'))247 self.warning_check_box.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning'))
213 self.auto_open_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service'))248 self.auto_open_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service'))
214 self.show_splash_check_box.setText(translate('OpenLP.GeneralTab', 'Show the splash screen'))249 self.show_splash_check_box.setText(translate('OpenLP.GeneralTab', 'Show the splash screen'))
250 self.logo_group_box.setTitle(translate('OpenLP.GeneralTab', 'Logo'))
251 self.logo_color_label.setText(UiStrings().BackgroundColorColon)
252 self.logo_file_label.setText(translate('OpenLP.GeneralTab', 'Logo file:'))
253 self.logo_browse_button.setToolTip(translate('OpenLP.GeneralTab', 'Browse for an image file to display.'))
254 self.logo_revert_button.setToolTip(translate('OpenLP.GeneralTab', 'Revert to the default OpenLP logo.'))
255 self.logo_hide_on_startup_check_box.setText(translate('OpenLP.GeneralTab', 'Don\'t show logo on startup'))
215 self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))256 self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
216 self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))257 self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
217 self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',258 self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
@@ -254,6 +295,10 @@
254 self.warning_check_box.setChecked(settings.value('blank warning'))295 self.warning_check_box.setChecked(settings.value('blank warning'))
255 self.auto_open_check_box.setChecked(settings.value('auto open'))296 self.auto_open_check_box.setChecked(settings.value('auto open'))
256 self.show_splash_check_box.setChecked(settings.value('show splash'))297 self.show_splash_check_box.setChecked(settings.value('show splash'))
298 self.logo_background_color = settings.value('logo background color')
299 self.logo_file_edit.setText(settings.value('logo file'))
300 self.logo_hide_on_startup_check_box.setChecked(settings.value('logo hide on startup'))
301 self.logo_color_button.color = self.logo_background_color
257 self.check_for_updates_check_box.setChecked(settings.value('update check'))302 self.check_for_updates_check_box.setChecked(settings.value('update check'))
258 self.auto_preview_check_box.setChecked(settings.value('auto preview'))303 self.auto_preview_check_box.setChecked(settings.value('auto preview'))
259 self.timeout_spin_box.setValue(settings.value('loop delay'))304 self.timeout_spin_box.setValue(settings.value('loop delay'))
@@ -284,6 +329,9 @@
284 settings.setValue('blank warning', self.warning_check_box.isChecked())329 settings.setValue('blank warning', self.warning_check_box.isChecked())
285 settings.setValue('auto open', self.auto_open_check_box.isChecked())330 settings.setValue('auto open', self.auto_open_check_box.isChecked())
286 settings.setValue('show splash', self.show_splash_check_box.isChecked())331 settings.setValue('show splash', self.show_splash_check_box.isChecked())
332 settings.setValue('logo background color', self.logo_background_color)
333 settings.setValue('logo file', self.logo_file_edit.text())
334 settings.setValue('logo hide on startup', self.logo_hide_on_startup_check_box.isChecked())
287 settings.setValue('update check', self.check_for_updates_check_box.isChecked())335 settings.setValue('update check', self.check_for_updates_check_box.isChecked())
288 settings.setValue('save prompt', self.save_check_service_check_box.isChecked())336 settings.setValue('save prompt', self.save_check_service_check_box.isChecked())
289 settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())337 settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())
@@ -346,3 +394,28 @@
346 Called when the width, height, x position or y position has changed.394 Called when the width, height, x position or y position has changed.
347 """395 """
348 self.display_changed = True396 self.display_changed = True
397
398 def on_logo_browse_button_clicked(self):
399 """
400 Select the logo file
401 """
402 file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles)
403 filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(self,
404 translate('OpenLP.AdvancedTab', 'Open File'), '',
405 file_filters)
406 if filename:
407 self.logo_file_edit.setText(filename)
408 self.logo_file_edit.setFocus()
409
410 def on_logo_revert_button_clicked(self):
411 """
412 Revert the logo file back to the default setting.
413 """
414 self.logo_file_edit.setText(':/graphics/openlp-splash-screen.png')
415 self.logo_file_edit.setFocus()
416
417 def on_logo_background_color_changed(self, color):
418 """
419 Select the background color for logo.
420 """
421 self.logo_background_color = color
349422
=== 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 @@
254 if self.is_live:254 if self.is_live:
255 # Build the initial frame.255 # Build the initial frame.
256 background_color = QtGui.QColor()256 background_color = QtGui.QColor()
257 background_color.setNamedColor(Settings().value('advanced/default color'))257 background_color.setNamedColor(Settings().value('core/logo background color'))
258 if not background_color.isValid():258 if not background_color.isValid():
259 background_color = QtCore.Qt.white259 background_color = QtCore.Qt.white
260 image_file = Settings().value('advanced/default image')260 image_file = Settings().value('core/logo file')
261 splash_image = QtGui.QImage(image_file)261 splash_image = QtGui.QImage(image_file)
262 self.initial_fame = QtGui.QImage(262 self.initial_fame = QtGui.QImage(
263 self.screen['size'].width(),263 self.screen['size'].width(),
@@ -523,7 +523,9 @@
523 if not Settings().value('core/display on monitor'):523 if not Settings().value('core/display on monitor'):
524 return524 return
525 self.frame.evaluateJavaScript('show_blank("show");')525 self.frame.evaluateJavaScript('show_blank("show");')
526 if self.isHidden():526 # Check if setting for hiding logo on startup is enabled.
527 # If it is, display should remain hidden, otherwise logo is shown. (from def setup)
528 if self.isHidden() and not Settings().value('core/logo hide on startup'):
527 self.setVisible(True)529 self.setVisible(True)
528 self.hide_mode = None530 self.hide_mode = None
529 # Trigger actions when display is active again.531 # Trigger actions when display is active again.
530532
=== 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 @@
2626
27from PyQt5 import QtCore27from PyQt5 import QtCore
2828
29from openlp.core.common import Registry, is_macosx29from openlp.core.common import Registry, is_macosx, Settings
30from openlp.core.lib import ScreenList30from openlp.core.lib import ScreenList
31from openlp.core.ui import MainDisplay31from openlp.core.ui import MainDisplay
32from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET32from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET
@@ -183,3 +183,43 @@
183 'Window level should be NSMainMenuWindowLevel + 2')183 'Window level should be NSMainMenuWindowLevel + 2')
184 self.assertEqual(pyobjc_nsview.window().collectionBehavior(), NSWindowCollectionBehaviorManaged,184 self.assertEqual(pyobjc_nsview.window().collectionBehavior(), NSWindowCollectionBehaviorManaged,
185 'Window collection behavior should be NSWindowCollectionBehaviorManaged')185 'Window collection behavior should be NSWindowCollectionBehaviorManaged')
186
187 @patch(u'openlp.core.ui.maindisplay.Settings')
188 def show_display_startup_logo_test(self, MockedSettings):
189 # GIVEN: Mocked show_display, setting for logo visibility
190 display = MagicMock()
191 main_display = MainDisplay(display)
192 main_display.frame = MagicMock()
193 main_display.isHidden = MagicMock()
194 main_display.isHidden.return_value = True
195 main_display.setVisible = MagicMock()
196 mocked_settings = MagicMock()
197 mocked_settings.value.return_value = False
198 MockedSettings.return_value = mocked_settings
199 main_display.shake_web_view = MagicMock()
200
201 # WHEN: show_display is called.
202 main_display.show_display()
203
204 # THEN: setVisible should had been called with "True"
205 main_display.setVisible.assert_called_once_with(True)
206
207 @patch(u'openlp.core.ui.maindisplay.Settings')
208 def show_display_hide_startup_logo_test(self, MockedSettings):
209 # GIVEN: Mocked show_display, setting for logo visibility
210 display = MagicMock()
211 main_display = MainDisplay(display)
212 main_display.frame = MagicMock()
213 main_display.isHidden = MagicMock()
214 main_display.isHidden.return_value = False
215 main_display.setVisible = MagicMock()
216 mocked_settings = MagicMock()
217 mocked_settings.value.return_value = False
218 MockedSettings.return_value = mocked_settings
219 main_display.shake_web_view = MagicMock()
220
221 # WHEN: show_display is called.
222 main_display.show_display()
223
224 # THEN: setVisible should had not been called
225 main_display.setVisible.assert_not_called()