Merge lp:~trb143/openlp/background_videos into lp:openlp

Proposed by Tim Bentley
Status: Superseded
Proposed branch: lp:~trb143/openlp/background_videos
Merge into: lp:openlp
Diff against target: 484 lines (+185/-33)
10 files modified
openlp/core/common/uistrings.py (+1/-0)
openlp/core/lib/theme.py (+24/-1)
openlp/core/ui/maindisplay.py (+22/-9)
openlp/core/ui/media/webkitplayer.py (+2/-9)
openlp/core/ui/servicemanager.py (+1/-1)
openlp/core/ui/themeform.py (+41/-3)
openlp/core/ui/thememanager.py (+2/-2)
openlp/core/ui/themewizard.py (+30/-5)
scripts/translation_utils.py (+2/-2)
tests/functional/openlp_core_ui/test_maindisplay.py (+60/-1)
To merge this branch: bzr merge lp:~trb143/openlp/background_videos
Reviewer Review Type Date Requested Status
Raoul Snyman Needs Fixing
Review via email: mp+293507@code.launchpad.net

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

This proposal has been superseded by a proposal from 2016-05-10.

Commit message

Allow themes to have video files so allow for background videos behind text.

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Only problem is that Transifex has deprecated the .net and now uses .com.

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Also, mediainfo spews out a lot of junk on the console, any way to suppress this?

lp:~trb143/openlp/background_videos updated
2693. By Tim Bentley

change net to com

2694. By Tim Bentley

remove rogue print

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/common/uistrings.py'
--- openlp/core/common/uistrings.py 2016-04-16 19:51:35 +0000
+++ openlp/core/common/uistrings.py 2016-05-10 04:41:16 +0000
@@ -152,3 +152,4 @@
152 self.Version = translate('OpenLP.Ui', 'Version')152 self.Version = translate('OpenLP.Ui', 'Version')
153 self.View = translate('OpenLP.Ui', 'View')153 self.View = translate('OpenLP.Ui', 'View')
154 self.ViewMode = translate('OpenLP.Ui', 'View Mode')154 self.ViewMode = translate('OpenLP.Ui', 'View Mode')
155 self.Video = translate('OpenLP.Ui', 'Video')
155156
=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py 2015-12-31 22:46:06 +0000
+++ openlp/core/lib/theme.py 2016-05-10 04:41:16 +0000
@@ -44,6 +44,7 @@
44 Gradient = 144 Gradient = 1
45 Image = 245 Image = 2
46 Transparent = 346 Transparent = 3
47 Video = 4
4748
48 @staticmethod49 @staticmethod
49 def to_string(background_type):50 def to_string(background_type):
@@ -58,6 +59,8 @@
58 return 'image'59 return 'image'
59 elif background_type == BackgroundType.Transparent:60 elif background_type == BackgroundType.Transparent:
60 return 'transparent'61 return 'transparent'
62 elif background_type == BackgroundType.Video:
63 return 'video'
6164
62 @staticmethod65 @staticmethod
63 def from_string(type_string):66 def from_string(type_string):
@@ -72,6 +75,8 @@
72 return BackgroundType.Image75 return BackgroundType.Image
73 elif type_string == 'transparent':76 elif type_string == 'transparent':
74 return BackgroundType.Transparent77 return BackgroundType.Transparent
78 elif type_string == 'video':
79 return BackgroundType.Video
7580
7681
77class BackgroundGradientType(object):82class BackgroundGradientType(object):
@@ -184,7 +189,7 @@
184189
185 :param path: The path name to be added.190 :param path: The path name to be added.
186 """191 """
187 if self.background_type == 'image':192 if self.background_type == 'image' or self.background_type == 'video':
188 if self.background_filename and path:193 if self.background_filename and path:
189 self.theme_name = self.theme_name.strip()194 self.theme_name = self.theme_name.strip()
190 self.background_filename = self.background_filename.strip()195 self.background_filename = self.background_filename.strip()
@@ -255,6 +260,21 @@
255 # Create endColor element260 # Create endColor element
256 self.child_element(background, 'borderColor', str(border_color))261 self.child_element(background, 'borderColor', str(border_color))
257262
263 def add_background_video(self, filename, border_color):
264 """
265 Add a video background.
266
267 :param filename: The file name of the video.
268 :param border_color:
269 """
270 background = self.theme_xml.createElement('background')
271 background.setAttribute('type', 'video')
272 self.theme.appendChild(background)
273 # Create Filename element
274 self.child_element(background, 'filename', filename)
275 # Create endColor element
276 self.child_element(background, 'borderColor', str(border_color))
277
258 def add_font(self, name, color, size, override, fonttype='main', bold='False', italics='False',278 def add_font(self, name, color, size, override, fonttype='main', bold='False', italics='False',
259 line_adjustment=0, xpos=0, ypos=0, width=0, height=0, outline='False', outline_color='#ffffff',279 line_adjustment=0, xpos=0, ypos=0, width=0, height=0, outline='False', outline_color='#ffffff',
260 outline_pixel=2, shadow='False', shadow_color='#ffffff', shadow_pixel=5):280 outline_pixel=2, shadow='False', shadow_color='#ffffff', shadow_pixel=5):
@@ -512,6 +532,9 @@
512 elif self.background_type == BackgroundType.to_string(BackgroundType.Image):532 elif self.background_type == BackgroundType.to_string(BackgroundType.Image):
513 filename = os.path.split(self.background_filename)[1]533 filename = os.path.split(self.background_filename)[1]
514 self.add_background_image(filename, self.background_border_color)534 self.add_background_image(filename, self.background_border_color)
535 elif self.background_type == BackgroundType.to_string(BackgroundType.Video):
536 filename = os.path.split(self.background_filename)[1]
537 self.add_background_video(filename, self.background_border_color)
515 elif self.background_type == BackgroundType.to_string(BackgroundType.Transparent):538 elif self.background_type == BackgroundType.to_string(BackgroundType.Transparent):
516 self.add_background_transparent()539 self.add_background_transparent()
517 self.add_font(540 self.add_font(
518541
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2016-04-29 20:25:12 +0000
+++ openlp/core/ui/maindisplay.py 2016-05-10 04:41:16 +0000
@@ -31,13 +31,15 @@
3131
32import html32import html
33import logging33import logging
34import os
3435
35from PyQt5 import QtCore, QtWidgets, QtWebKit, QtWebKitWidgets, QtOpenGL, QtGui, QtMultimedia36from PyQt5 import QtCore, QtWidgets, QtWebKit, QtWebKitWidgets, QtOpenGL, QtGui, QtMultimedia
3637
37from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, Settings, translate, is_macosx, is_win38from openlp.core.common import AppLocation, Registry, RegistryProperties, OpenLPMixin, Settings, translate,\
39 is_macosx, is_win
38from openlp.core.lib import ServiceItem, ImageSource, ScreenList, build_html, expand_tags, image_to_byte40from openlp.core.lib import ServiceItem, ImageSource, ScreenList, build_html, expand_tags, image_to_byte
39from openlp.core.lib.theme import BackgroundType41from openlp.core.lib.theme import BackgroundType
40from openlp.core.ui import HideMode, AlertLocation42from openlp.core.ui import HideMode, AlertLocation, DisplayControllerType
4143
42if is_macosx():44if is_macosx():
43 from ctypes import pythonapi, c_void_p, c_char_p, py_object45 from ctypes import pythonapi, c_void_p, c_char_p, py_object
@@ -459,13 +461,13 @@
459 background = self.image_manager.get_image_bytes(self.override['image'], ImageSource.ImagePlugin)461 background = self.image_manager.get_image_bytes(self.override['image'], ImageSource.ImagePlugin)
460 self.set_transparency(self.service_item.theme_data.background_type ==462 self.set_transparency(self.service_item.theme_data.background_type ==
461 BackgroundType.to_string(BackgroundType.Transparent))463 BackgroundType.to_string(BackgroundType.Transparent))
462 if self.service_item.theme_data.background_filename:464 image_bytes = None
463 self.service_item.bg_image_bytes = self.image_manager.get_image_bytes(465 if self.service_item.theme_data.background_type == 'image':
464 self.service_item.theme_data.background_filename, ImageSource.Theme)466 if self.service_item.theme_data.background_filename:
465 if image_path:467 self.service_item.bg_image_bytes = self.image_manager.get_image_bytes(
466 image_bytes = self.image_manager.get_image_bytes(image_path, ImageSource.ImagePlugin)468 self.service_item.theme_data.background_filename, ImageSource.Theme)
467 else:469 if image_path:
468 image_bytes = None470 image_bytes = self.image_manager.get_image_bytes(image_path, ImageSource.ImagePlugin)
469 html = build_html(self.service_item, self.screen, self.is_live, background, image_bytes,471 html = build_html(self.service_item, self.screen, self.is_live, background, image_bytes,
470 plugins=self.plugin_manager.plugins)472 plugins=self.plugin_manager.plugins)
471 self.web_view.setHtml(html)473 self.web_view.setHtml(html)
@@ -477,6 +479,17 @@
477 Registry().execute('slidecontroller_live_unblank')479 Registry().execute('slidecontroller_live_unblank')
478 else:480 else:
479 self.hide_display(self.hide_mode)481 self.hide_display(self.hide_mode)
482 if self.service_item.theme_data.background_type == 'video' and self.is_live:
483 if self.service_item.theme_data.background_filename:
484 service_item = ServiceItem()
485 service_item.title = 'webkit'
486 service_item.processor = 'webkit'
487 path = os.path.join(AppLocation.get_section_data_path('themes'),
488 self.service_item.theme_data.theme_name)
489 service_item.add_from_command(path,
490 self.service_item.theme_data.background_filename,
491 ':/media/slidecontroller_multimedia.png')
492 self.media_controller.video(DisplayControllerType.Live, service_item, video_behind_text=True)
480 self._hide_mouse()493 self._hide_mouse()
481494
482 def footer(self, text):495 def footer(self, text):
483496
=== modified file 'openlp/core/ui/media/webkitplayer.py'
--- openlp/core/ui/media/webkitplayer.py 2016-02-26 16:00:04 +0000
+++ openlp/core/ui/media/webkitplayer.py 2016-05-10 04:41:16 +0000
@@ -45,7 +45,7 @@
45"""45"""
4646
47VIDEO_JS = """47VIDEO_JS = """
48 function show_video(state, path, volume, loop, variable_value){48 function show_video(state, path, volume, variable_value){
49 // Sometimes video.currentTime stops slightly short of video.duration and video.ended is intermittent!49 // Sometimes video.currentTime stops slightly short of video.duration and video.ended is intermittent!
5050
51 var video = document.getElementById('video');51 var video = document.getElementById('video');
@@ -55,9 +55,6 @@
55 switch(state){55 switch(state){
56 case 'load':56 case 'load':
57 video.src = 'file:///' + path;57 video.src = 'file:///' + path;
58 if(loop == true) {
59 video.loop = true;
60 }
61 video.load();58 video.load();
62 break;59 break;
63 case 'play':60 case 'play':
@@ -180,12 +177,8 @@
180 else:177 else:
181 vol = 0178 vol = 0
182 path = controller.media_info.file_info.absoluteFilePath()179 path = controller.media_info.file_info.absoluteFilePath()
183 if controller.media_info.is_background:
184 loop = 'true'
185 else:
186 loop = 'false'
187 display.web_view.setVisible(True)180 display.web_view.setVisible(True)
188 js = 'show_video("load", "%s", %s, %s);' % (path.replace('\\', '\\\\'), str(vol), loop)181 js = 'show_video("load", "{path}", {vol});'.format(path=path.replace('\\', '\\\\'), vol=str(vol))
189 display.frame.evaluateJavaScript(js)182 display.frame.evaluateJavaScript(js)
190 return True183 return True
191184
192185
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2016-04-17 19:32:15 +0000
+++ openlp/core/ui/servicemanager.py 2016-05-10 04:41:16 +0000
@@ -1323,7 +1323,7 @@
1323 """1323 """
1324 The theme may have changed in the settings dialog so make sure the theme combo box is in the correct state.1324 The theme may have changed in the settings dialog so make sure the theme combo box is in the correct state.
1325 """1325 """
1326 visible = self.renderer.theme_level == ThemeLevel.Global1326 visible = not self.renderer.theme_level == ThemeLevel.Global
1327 self.theme_label.setVisible(visible)1327 self.theme_label.setVisible(visible)
1328 self.theme_combo_box.setVisible(visible)1328 self.theme_combo_box.setVisible(visible)
13291329
13301330
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2016-04-17 18:57:03 +0000
+++ openlp/core/ui/themeform.py 2016-05-10 04:41:16 +0000
@@ -31,7 +31,7 @@
31from openlp.core.lib.theme import BackgroundType, BackgroundGradientType31from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
32from openlp.core.lib.ui import critical_error_message_box32from openlp.core.lib.ui import critical_error_message_box
33from openlp.core.ui import ThemeLayoutForm33from openlp.core.ui import ThemeLayoutForm
34from openlp.core.ui.lib.colorbutton import ColorButton34from openlp.core.ui.media.webkitplayer import VIDEO_EXT
35from .themewizard import Ui_ThemeWizard35from .themewizard import Ui_ThemeWizard
3636
37log = logging.getLogger(__name__)37log = logging.getLogger(__name__)
@@ -66,10 +66,13 @@
66 self.gradient_combo_box.currentIndexChanged.connect(self.on_gradient_combo_box_current_index_changed)66 self.gradient_combo_box.currentIndexChanged.connect(self.on_gradient_combo_box_current_index_changed)
67 self.color_button.colorChanged.connect(self.on_color_changed)67 self.color_button.colorChanged.connect(self.on_color_changed)
68 self.image_color_button.colorChanged.connect(self.on_image_color_changed)68 self.image_color_button.colorChanged.connect(self.on_image_color_changed)
69 self.video_color_button.colorChanged.connect(self.on_video_color_changed)
69 self.gradient_start_button.colorChanged.connect(self.on_gradient_start_color_changed)70 self.gradient_start_button.colorChanged.connect(self.on_gradient_start_color_changed)
70 self.gradient_end_button.colorChanged.connect(self.on_gradient_end_color_changed)71 self.gradient_end_button.colorChanged.connect(self.on_gradient_end_color_changed)
71 self.image_browse_button.clicked.connect(self.on_image_browse_button_clicked)72 self.image_browse_button.clicked.connect(self.on_image_browse_button_clicked)
72 self.image_file_edit.editingFinished.connect(self.on_image_file_edit_editing_finished)73 self.image_file_edit.editingFinished.connect(self.on_image_file_edit_editing_finished)
74 self.video_browse_button.clicked.connect(self.on_video_browse_button_clicked)
75 self.video_file_edit.editingFinished.connect(self.on_video_file_edit_editing_finished)
73 self.main_color_button.colorChanged.connect(self.on_main_color_changed)76 self.main_color_button.colorChanged.connect(self.on_main_color_changed)
74 self.outline_color_button.colorChanged.connect(self.on_outline_color_changed)77 self.outline_color_button.colorChanged.connect(self.on_outline_color_changed)
75 self.shadow_color_button.colorChanged.connect(self.on_shadow_color_changed)78 self.shadow_color_button.colorChanged.connect(self.on_shadow_color_changed)
@@ -307,6 +310,10 @@
307 self.image_color_button.color = self.theme.background_border_color310 self.image_color_button.color = self.theme.background_border_color
308 self.image_file_edit.setText(self.theme.background_filename)311 self.image_file_edit.setText(self.theme.background_filename)
309 self.setField('background_type', 2)312 self.setField('background_type', 2)
313 elif self.theme.background_type == BackgroundType.to_string(BackgroundType.Video):
314 self.video_color_button.color = self.theme.background_border_color
315 self.video_file_edit.setText(self.theme.background_filename)
316 self.setField('background_type', 4)
310 elif self.theme.background_type == BackgroundType.to_string(BackgroundType.Transparent):317 elif self.theme.background_type == BackgroundType.to_string(BackgroundType.Transparent):
311 self.setField('background_type', 3)318 self.setField('background_type', 3)
312 if self.theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):319 if self.theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
@@ -384,10 +391,12 @@
384 if self.update_theme_allowed:391 if self.update_theme_allowed:
385 self.theme.background_type = BackgroundType.to_string(index)392 self.theme.background_type = BackgroundType.to_string(index)
386 if self.theme.background_type != BackgroundType.to_string(BackgroundType.Image) and \393 if self.theme.background_type != BackgroundType.to_string(BackgroundType.Image) and \
394 self.theme.background_type != BackgroundType.to_string(BackgroundType.Video) and \
387 self.temp_background_filename == '':395 self.temp_background_filename == '':
388 self.temp_background_filename = self.theme.background_filename396 self.temp_background_filename = self.theme.background_filename
389 self.theme.background_filename = ''397 self.theme.background_filename = ''
390 if self.theme.background_type == BackgroundType.to_string(BackgroundType.Image) and \398 if (self.theme.background_type == BackgroundType.to_string(BackgroundType.Image) or
399 self.theme.background_type != BackgroundType.to_string(BackgroundType.Video)) and \
391 self.temp_background_filename != '':400 self.temp_background_filename != '':
392 self.theme.background_filename = self.temp_background_filename401 self.theme.background_filename = self.temp_background_filename
393 self.temp_background_filename = ''402 self.temp_background_filename = ''
@@ -413,6 +422,12 @@
413 """422 """
414 self.theme.background_border_color = color423 self.theme.background_border_color = color
415424
425 def on_video_color_changed(self, color):
426 """
427 Background / Gradient 1 _color button pushed.
428 """
429 self.theme.background_border_color = color
430
416 def on_gradient_start_color_changed(self, color):431 def on_gradient_start_color_changed(self, color):
417 """432 """
418 Gradient 2 _color button pushed.433 Gradient 2 _color button pushed.
@@ -444,6 +459,28 @@
444 """459 """
445 self.theme.background_filename = str(self.image_file_edit.text())460 self.theme.background_filename = str(self.image_file_edit.text())
446461
462 def on_video_browse_button_clicked(self):
463 """
464 Background video button pushed.
465 """
466 visible_formats = '(%s)' % '; '.join(VIDEO_EXT)
467 actual_formats = '(%s)' % ' '.join(VIDEO_EXT)
468 video_filter = '{trans} {visible} {actual}'.format(trans=translate('OpenLP', 'Video Files'),
469 visible=visible_formats, actual=actual_formats)
470 video_filter = '{video};;{ui} (*.*)'.format(video=video_filter, ui=UiStrings().AllFiles)
471 filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(
472 self, translate('OpenLP.ThemeWizard', 'Select Video'),
473 self.video_file_edit.text(), video_filter)
474 if filename:
475 self.theme.background_filename = filename
476 self.set_background_page_values()
477
478 def on_video_file_edit_editing_finished(self):
479 """
480 Background video path edited
481 """
482 self.theme.background_filename = str(self.image_file_edit.text())
483
447 def on_main_color_changed(self, color):484 def on_main_color_changed(self, color):
448 """485 """
449 Set the main colour value486 Set the main colour value
@@ -519,7 +556,8 @@
519 return556 return
520 save_from = None557 save_from = None
521 save_to = None558 save_to = None
522 if self.theme.background_type == BackgroundType.to_string(BackgroundType.Image):559 if self.theme.background_type == BackgroundType.to_string(BackgroundType.Image) or \
560 self.theme.background_type == BackgroundType.to_string(BackgroundType.Video):
523 filename = os.path.split(str(self.theme.background_filename))[1]561 filename = os.path.split(str(self.theme.background_filename))[1]
524 save_to = os.path.join(self.path, self.theme.theme_name, filename)562 save_to = os.path.join(self.path, self.theme.theme_name, filename)
525 save_from = self.theme.background_filename563 save_from = self.theme.background_filename
526564
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2016-04-17 19:32:15 +0000
+++ openlp/core/ui/thememanager.py 2016-05-10 04:41:16 +0000
@@ -300,7 +300,7 @@
300 """300 """
301 save_to = None301 save_to = None
302 save_from = None302 save_from = None
303 if theme_data.background_type == 'image':303 if theme_data.background_type == 'image' or theme_data.background_type == 'video':
304 save_to = os.path.join(self.path, new_theme_name, os.path.split(str(theme_data.background_filename))[1])304 save_to = os.path.join(self.path, new_theme_name, os.path.split(str(theme_data.background_filename))[1])
305 save_from = theme_data.background_filename305 save_from = theme_data.background_filename
306 theme_data.theme_name = new_theme_name306 theme_data.theme_name = new_theme_name
@@ -318,7 +318,7 @@
318 translate('OpenLP.ThemeManager', 'You must select a theme to edit.')):318 translate('OpenLP.ThemeManager', 'You must select a theme to edit.')):
319 item = self.theme_list_widget.currentItem()319 item = self.theme_list_widget.currentItem()
320 theme = self.get_theme_data(item.data(QtCore.Qt.UserRole))320 theme = self.get_theme_data(item.data(QtCore.Qt.UserRole))
321 if theme.background_type == 'image':321 if theme.background_type == 'image' or theme.background_type == 'video':
322 self.old_background_image = theme.background_filename322 self.old_background_image = theme.background_filename
323 self.theme_form.theme = theme323 self.theme_form.theme = theme
324 self.theme_form.exec(True)324 self.theme_form.exec(True)
325325
=== modified file 'openlp/core/ui/themewizard.py'
--- openlp/core/ui/themewizard.py 2016-04-17 18:57:03 +0000
+++ openlp/core/ui/themewizard.py 2016-05-10 04:41:16 +0000
@@ -62,7 +62,7 @@
62 self.background_label = QtWidgets.QLabel(self.background_page)62 self.background_label = QtWidgets.QLabel(self.background_page)
63 self.background_label.setObjectName('background_label')63 self.background_label.setObjectName('background_label')
64 self.background_combo_box = QtWidgets.QComboBox(self.background_page)64 self.background_combo_box = QtWidgets.QComboBox(self.background_page)
65 self.background_combo_box.addItems(['', '', '', ''])65 self.background_combo_box.addItems(['', '', '', '', ''])
66 self.background_combo_box.setObjectName('background_combo_box')66 self.background_combo_box.setObjectName('background_combo_box')
67 self.background_type_layout.addRow(self.background_label, self.background_combo_box)67 self.background_type_layout.addRow(self.background_label, self.background_combo_box)
68 self.background_type_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)68 self.background_type_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
@@ -135,6 +135,30 @@
135 self.transparent_layout.setObjectName('Transparent_layout')135 self.transparent_layout.setObjectName('Transparent_layout')
136 self.background_stack.addWidget(self.transparent_widget)136 self.background_stack.addWidget(self.transparent_widget)
137 self.background_layout.addLayout(self.background_stack)137 self.background_layout.addLayout(self.background_stack)
138 self.video_widget = QtWidgets.QWidget(self.background_page)
139 self.video_widget.setObjectName('video_widget')
140 self.video_layout = QtWidgets.QFormLayout(self.video_widget)
141 self.video_layout.setContentsMargins(0, 0, 0, 0)
142 self.video_layout.setObjectName('video_layout')
143 self.video_color_label = QtWidgets.QLabel(self.color_widget)
144 self.video_color_label.setObjectName('video_color_label')
145 self.video_color_button = ColorButton(self.color_widget)
146 self.video_color_button.setObjectName('video_color_button')
147 self.video_layout.addRow(self.video_color_label, self.video_color_button)
148 self.video_label = QtWidgets.QLabel(self.video_widget)
149 self.video_label.setObjectName('video_label')
150 self.video_file_layout = QtWidgets.QHBoxLayout()
151 self.video_file_layout.setObjectName('video_file_layout')
152 self.video_file_edit = QtWidgets.QLineEdit(self.video_widget)
153 self.video_file_edit.setObjectName('video_file_edit')
154 self.video_file_layout.addWidget(self.video_file_edit)
155 self.video_browse_button = QtWidgets.QToolButton(self.video_widget)
156 self.video_browse_button.setObjectName('video_browse_button')
157 self.video_browse_button.setIcon(build_icon(':/general/general_open.png'))
158 self.video_file_layout.addWidget(self.video_browse_button)
159 self.video_layout.addRow(self.video_label, self.video_file_layout)
160 self.video_layout.setItem(2, QtWidgets.QFormLayout.LabelRole, self.spacer)
161 self.background_stack.addWidget(self.video_widget)
138 theme_wizard.addPage(self.background_page)162 theme_wizard.addPage(self.background_page)
139 # Main Area Page163 # Main Area Page
140 self.main_area_page = QtWidgets.QWizardPage()164 self.main_area_page = QtWidgets.QWizardPage()
@@ -390,11 +414,10 @@
390 self.background_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Set up your theme\'s background '414 self.background_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Set up your theme\'s background '
391 'according to the parameters below.'))415 'according to the parameters below.'))
392 self.background_label.setText(translate('OpenLP.ThemeWizard', 'Background type:'))416 self.background_label.setText(translate('OpenLP.ThemeWizard', 'Background type:'))
393 self.background_combo_box.setItemText(BackgroundType.Solid,417 self.background_combo_box.setItemText(BackgroundType.Solid, translate('OpenLP.ThemeWizard', 'Solid color'))
394 translate('OpenLP.ThemeWizard', 'Solid color'))418 self.background_combo_box.setItemText(BackgroundType.Gradient, translate('OpenLP.ThemeWizard', 'Gradient'))
395 self.background_combo_box.setItemText(BackgroundType.Gradient,
396 translate('OpenLP.ThemeWizard', 'Gradient'))
397 self.background_combo_box.setItemText(BackgroundType.Image, UiStrings().Image)419 self.background_combo_box.setItemText(BackgroundType.Image, UiStrings().Image)
420 self.background_combo_box.setItemText(BackgroundType.Video, UiStrings().Video)
398 self.background_combo_box.setItemText(BackgroundType.Transparent,421 self.background_combo_box.setItemText(BackgroundType.Transparent,
399 translate('OpenLP.ThemeWizard', 'Transparent'))422 translate('OpenLP.ThemeWizard', 'Transparent'))
400 self.color_label.setText(translate('OpenLP.ThemeWizard', 'color:'))423 self.color_label.setText(translate('OpenLP.ThemeWizard', 'color:'))
@@ -413,6 +436,8 @@
413 translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right'))436 translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right'))
414 self.image_color_label.setText(translate('OpenLP.ThemeWizard', 'Background color:'))437 self.image_color_label.setText(translate('OpenLP.ThemeWizard', 'Background color:'))
415 self.image_label.setText('%s:' % UiStrings().Image)438 self.image_label.setText('%s:' % UiStrings().Image)
439 self.video_color_label.setText(translate('OpenLP.ThemeWizard', 'Background color:'))
440 self.video_label.setText('%s:' % UiStrings().Video)
416 self.main_area_page.setTitle(translate('OpenLP.ThemeWizard', 'Main Area Font Details'))441 self.main_area_page.setTitle(translate('OpenLP.ThemeWizard', 'Main Area Font Details'))
417 self.main_area_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Define the font and display '442 self.main_area_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Define the font and display '
418 'characteristics for the Display text'))443 'characteristics for the Display text'))
419444
=== modified file 'openlp/plugins/media/mediaplugin.py'
=== modified file 'scripts/translation_utils.py'
--- scripts/translation_utils.py 2015-12-31 22:46:06 +0000
+++ scripts/translation_utils.py 2016-05-10 04:41:16 +0000
@@ -60,7 +60,7 @@
60from PyQt5 import QtCore60from PyQt5 import QtCore
61from lxml import etree, objectify61from lxml import etree, objectify
6262
63SERVER_URL = 'http://www.transifex.net/api/2/project/openlp/resource/openlp-24x/'63SERVER_URL = 'http://www.transifex.com/api/2/project/openlp/resource/openlp-26x/'
64IGNORED_PATHS = ['scripts']64IGNORED_PATHS = ['scripts']
65IGNORED_FILES = ['setup.py']65IGNORED_FILES = ['setup.py']
6666
@@ -270,7 +270,7 @@
270 return270 return
271 else:271 else:
272 os.chdir(os.path.abspath('..'))272 os.chdir(os.path.abspath('..'))
273 run('pylupdate4 -verbose -noobsolete openlp.pro')273 run('pylupdate5 -verbose -noobsolete openlp.pro')
274 os.chdir(os.path.abspath('scripts'))274 os.chdir(os.path.abspath('scripts'))
275275
276276
277277
=== modified file 'tests/functional/openlp_core_ui/test_maindisplay.py'
--- tests/functional/openlp_core_ui/test_maindisplay.py 2016-03-31 20:35:04 +0000
+++ tests/functional/openlp_core_ui/test_maindisplay.py 2016-05-10 04:41:16 +0000
@@ -27,8 +27,9 @@
27from PyQt5 import QtCore27from PyQt5 import QtCore
2828
29from openlp.core.common import Registry, is_macosx, Settings29from openlp.core.common import Registry, is_macosx, Settings
30from openlp.core.lib import ScreenList30from openlp.core.lib import ScreenList, PluginManager
31from openlp.core.ui import MainDisplay31from openlp.core.ui import MainDisplay
32from openlp.core.ui.media import MediaController
32from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET33from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET
3334
34from tests.helpers.testmixin import TestMixin35from tests.helpers.testmixin import TestMixin
@@ -223,3 +224,61 @@
223224
224 # THEN: setVisible should had not been called225 # THEN: setVisible should had not been called
225 main_display.setVisible.assert_not_called()226 main_display.setVisible.assert_not_called()
227
228 @patch(u'openlp.core.ui.maindisplay.Settings')
229 @patch(u'openlp.core.ui.maindisplay.build_html')
230 def build_html_no_video_test(self, MockedSettings, Mocked_build_html):
231 # GIVEN: Mocked display
232 display = MagicMock()
233 mocked_media_controller = MagicMock()
234 Registry.create()
235 Registry().register('media_controller', mocked_media_controller)
236 main_display = MainDisplay(display)
237 main_display.frame = MagicMock()
238 mocked_settings = MagicMock()
239 mocked_settings.value.return_value = False
240 MockedSettings.return_value = mocked_settings
241 main_display.shake_web_view = MagicMock()
242 service_item = MagicMock()
243 mocked_plugin = MagicMock()
244 display.plugin_manager = PluginManager()
245 display.plugin_manager.plugins = [mocked_plugin]
246 main_display.web_view = MagicMock()
247
248 # WHEN: build_html is called with a normal service item and a non video theme.
249 main_display.build_html(service_item)
250
251 # THEN: the following should had not been called
252 self.assertEquals(main_display.web_view.setHtml.call_count, 1, 'setHTML should be called once')
253 self.assertEquals(main_display.media_controller.video.call_count, 0,
254 'Media Controller video should not have been called')
255
256 @patch(u'openlp.core.ui.maindisplay.Settings')
257 @patch(u'openlp.core.ui.maindisplay.build_html')
258 def build_html_video_test(self, MockedSettings, Mocked_build_html):
259 # GIVEN: Mocked display
260 display = MagicMock()
261 mocked_media_controller = MagicMock()
262 Registry.create()
263 Registry().register('media_controller', mocked_media_controller)
264 main_display = MainDisplay(display)
265 main_display.frame = MagicMock()
266 mocked_settings = MagicMock()
267 mocked_settings.value.return_value = False
268 MockedSettings.return_value = mocked_settings
269 main_display.shake_web_view = MagicMock()
270 service_item = MagicMock()
271 service_item.theme_data = MagicMock()
272 service_item.theme_data.background_type = 'video'
273 mocked_plugin = MagicMock()
274 display.plugin_manager = PluginManager()
275 display.plugin_manager.plugins = [mocked_plugin]
276 main_display.web_view = MagicMock()
277
278 # WHEN: build_html is called with a normal service item and a video theme.
279 main_display.build_html(service_item)
280
281 # THEN: the following should had not been called
282 self.assertEquals(main_display.web_view.setHtml.call_count, 1, 'setHTML should be called once')
283 self.assertEquals(main_display.media_controller.video.call_count, 1,
284 'Media Controller video should have been called once')