Merge lp:~oliwee/openlp/newtransition into lp:openlp
- newtransition
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~oliwee/openlp/newtransition |
Merge into: | lp:openlp |
Diff against target: |
525 lines (+208/-34) 7 files modified
openlp/core/lib/htmlbuilder.py (+83/-17) openlp/core/lib/json/theme.json (+1/-0) openlp/core/lib/theme.py (+36/-2) openlp/core/ui/themeform.py (+13/-1) openlp/core/ui/themewizard.py (+14/-2) tests/functional/openlp_core_lib/test_htmlbuilder.py (+59/-11) tests/functional/openlp_core_lib/test_theme.py (+2/-1) |
To merge this branch: | bzr merge lp:~oliwee/openlp/newtransition |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenLP Core | Pending | ||
Review via email: mp+248188@code.launchpad.net |
Commit message
Description of the change
Added a second type of transition, which is more a crossfade than a fade-out-
Added / adapted tests for htmlbuilder to match the new html code
- 2494. By Oliver Wieland
-
fixed test_theme
adapted to new count of theme variables
added assert for new variable
Oliver Wieland (oliwee) wrote : | # |
> Hey Oliver,
>
> Are you still interested in adding this feature to OpenLP? Trunk is open for
> code, and it would be great to have more transitions.
Hey, Raoul,
sorry for delay...
I have a few private problems here at the moment, so I don't have any time for OpenLP. When I have more time, I would like to work on this again.
Be blessed
Unmerged revisions
- 2494. By Oliver Wieland
-
fixed test_theme
adapted to new count of theme variables
added assert for new variable - 2493. By Oliver Wieland
-
merged actual trunk
- 2492. By Oliver Wieland
-
Fixed problems with vertical align
Fixed tests - 2491. By Oliver Wieland
-
Inserted a combo box into theme manager to select transition type
Tests for htmlbuilder adapted (not ready) - 2490. By Oliver Wieland
-
new Transition between slides
Preview Diff
1 | === modified file 'openlp/core/lib/htmlbuilder.py' | |||
2 | --- openlp/core/lib/htmlbuilder.py 2015-01-18 13:39:21 +0000 | |||
3 | +++ openlp/core/lib/htmlbuilder.py 2015-01-31 10:17:29 +0000 | |||
4 | @@ -117,6 +117,9 @@ | |||
5 | 117 | .lyricsmain { | 117 | .lyricsmain { |
6 | 118 | -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; text-shadow: #000000 5px 5px; | 118 | -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; text-shadow: #000000 5px 5px; |
7 | 119 | } | 119 | } |
8 | 120 | .lyricstext { | ||
9 | 121 | -webkit-transition: opacity 0.4s ease; | ||
10 | 122 | } | ||
11 | 120 | 123 | ||
12 | 121 | sup { | 124 | sup { |
13 | 122 | font-size: 0.6em; | 125 | font-size: 0.6em; |
14 | @@ -128,6 +131,7 @@ | |||
15 | 128 | <script> | 131 | <script> |
16 | 129 | var timer = null; | 132 | var timer = null; |
17 | 130 | var transition = false; | 133 | var transition = false; |
18 | 134 | var transition_type = '0'; | ||
19 | 131 | 135 | ||
20 | 132 | function show_video(state, path, volume, loop, variable_value){ | 136 | function show_video(state, path, volume, loop, variable_value){ |
21 | 133 | // Sometimes video.currentTime stops slightly short of video.duration and video.ended is intermittent! | 137 | // Sometimes video.currentTime stops slightly short of video.duration and video.ended is intermittent! |
22 | @@ -342,16 +346,34 @@ | |||
23 | 342 | /* | 346 | /* |
24 | 343 | Show the text. | 347 | Show the text. |
25 | 344 | */ | 348 | */ |
28 | 345 | var text = document.getElementById(id); | 349 | var text1 = document.getElementById(id).childNodes[0]; |
29 | 346 | if(text == null) return; | 350 | var text2 = document.getElementById(id).childNodes[1]; |
30 | 351 | if(text1 == null) return; | ||
31 | 352 | if(text2 == null) return; | ||
32 | 347 | if(!transition){ | 353 | if(!transition){ |
34 | 348 | text.innerHTML = new_text; | 354 | text1.innerHTML = new_text; |
35 | 355 | text2.innerHTML = new_text; | ||
36 | 349 | return; | 356 | return; |
37 | 350 | } | 357 | } |
42 | 351 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. | 358 | if(transition_type == 0){ |
43 | 352 | text.style.opacity = '0.1'; | 359 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. |
44 | 353 | // Fade new text in after the old text has finished fading out. | 360 | text1.style.opacity = '0.1'; |
45 | 354 | timer = window.setTimeout(function(){_show_text(text, new_text)}, 400); | 361 | // Fade new text in after the old text has finished fading out. |
46 | 362 | timer = window.setTimeout(function(){_show_text(text1, new_text)}, 400); | ||
47 | 363 | }else{ | ||
48 | 364 | // Toggle visible text element by fading out / in | ||
49 | 365 | if (text1.style.opacity == '1'){ | ||
50 | 366 | text2.innerHTML = new_text; | ||
51 | 367 | text1.style.opacity = '0'; | ||
52 | 368 | text2.style.opacity = '1'; | ||
53 | 369 | } | ||
54 | 370 | else{ | ||
55 | 371 | text1.innerHTML = new_text; | ||
56 | 372 | text2.style.opacity = '0'; | ||
57 | 373 | text1.style.opacity = '1'; | ||
58 | 374 | } | ||
59 | 375 | timer = window.setTimeout(function(){timer = null;}, 400); | ||
60 | 376 | } | ||
61 | 355 | } | 377 | } |
62 | 356 | 378 | ||
63 | 357 | function _show_text(text, new_text) { | 379 | function _show_text(text, new_text) { |
64 | @@ -381,7 +403,7 @@ | |||
65 | 381 | 403 | ||
66 | 382 | <div id="alert" style="visibility:hidden"></div> | 404 | <div id="alert" style="visibility:hidden"></div> |
67 | 383 | 405 | ||
69 | 384 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> | 406 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"><div id="lyricstext1" class="lyricstext" style="opacity:1;"></div><div id="lyricstext2" class="lyricstext" style="opacity:0;position:absolute;top:0px;left:0px;"></div></div></div> |
70 | 385 | <div id="footer" class="footer"></div> | 407 | <div id="footer" class="footer"></div> |
71 | 386 | <div id="black" class="size"></div> | 408 | <div id="black" class="size"></div> |
72 | 387 | </body> | 409 | </body> |
73 | @@ -448,6 +470,7 @@ | |||
74 | 448 | <script> | 470 | <script> |
75 | 449 | var timer = null; | 471 | var timer = null; |
76 | 450 | var transition = %s; | 472 | var transition = %s; |
77 | 473 | var transition_type = %s; | ||
78 | 451 | %s | 474 | %s |
79 | 452 | 475 | ||
80 | 453 | function show_image(src){ | 476 | function show_image(src){ |
81 | @@ -474,6 +497,7 @@ | |||
82 | 474 | } | 497 | } |
83 | 475 | document.getElementById('black').style.display = black; | 498 | document.getElementById('black').style.display = black; |
84 | 476 | document.getElementById('lyricsmain').style.visibility = lyrics; | 499 | document.getElementById('lyricsmain').style.visibility = lyrics; |
85 | 500 | document.getElementById('lyricsmain2').style.visibility = lyrics; | ||
86 | 477 | document.getElementById('image').style.visibility = lyrics; | 501 | document.getElementById('image').style.visibility = lyrics; |
87 | 478 | document.getElementById('footer').style.visibility = lyrics; | 502 | document.getElementById('footer').style.visibility = lyrics; |
88 | 479 | } | 503 | } |
89 | @@ -501,23 +525,51 @@ | |||
90 | 501 | new_text = '<span>' + new_text + '</span>'; | 525 | new_text = '<span>' + new_text + '</span>'; |
91 | 502 | } | 526 | } |
92 | 503 | } | 527 | } |
94 | 504 | text_fade('lyricsmain', new_text); | 528 | txt = document.getElementById('lyricsmain2'); |
95 | 529 | if(window.getComputedStyle(txt).textAlign == 'justify'){ | ||
96 | 530 | if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){ | ||
97 | 531 | new_text = new_text.replace(/(\s| )+(?![^<]*>)/g, | ||
98 | 532 | function(match) { | ||
99 | 533 | return '</span>' + match + '<span>'; | ||
100 | 534 | }); | ||
101 | 535 | new_text = '<span>' + new_text + '</span>'; | ||
102 | 536 | } | ||
103 | 537 | } | ||
104 | 538 | text_fade('lyricsmain', 'lyricsmain2', new_text); | ||
105 | 505 | } | 539 | } |
106 | 506 | 540 | ||
108 | 507 | function text_fade(id, new_text){ | 541 | function text_fade(id, id2, new_text){ |
109 | 508 | /* | 542 | /* |
110 | 509 | Show the text. | 543 | Show the text. |
111 | 510 | */ | 544 | */ |
114 | 511 | var text = document.getElementById(id); | 545 | var text1 = document.getElementById(id); |
115 | 512 | if(text == null) return; | 546 | var text2 = document.getElementById(id2); |
116 | 547 | if(text1 == null) return; | ||
117 | 548 | if(text2 == null) return; | ||
118 | 513 | if(!transition){ | 549 | if(!transition){ |
120 | 514 | text.innerHTML = new_text; | 550 | text1.innerHTML = new_text; |
121 | 551 | text2.innerHTML = new_text; | ||
122 | 515 | return; | 552 | return; |
123 | 516 | } | 553 | } |
128 | 517 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. | 554 | if(transition_type == 0){ |
129 | 518 | text.style.opacity = '0.1'; | 555 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. |
130 | 519 | // Fade new text in after the old text has finished fading out. | 556 | text1.style.opacity = '0.1'; |
131 | 520 | timer = window.setTimeout(function(){_show_text(text, new_text)}, 400); | 557 | // Fade new text in after the old text has finished fading out. |
132 | 558 | timer = window.setTimeout(function(){_show_text(text1, new_text)}, 400); | ||
133 | 559 | }else{ | ||
134 | 560 | // Toggle visible text element by fading out / in | ||
135 | 561 | if (text1.style.opacity == '1'){ | ||
136 | 562 | text2.innerHTML = new_text; | ||
137 | 563 | text1.style.opacity = '0'; | ||
138 | 564 | text2.style.opacity = '1'; | ||
139 | 565 | } | ||
140 | 566 | else{ | ||
141 | 567 | text1.innerHTML = new_text; | ||
142 | 568 | text2.style.opacity = '0'; | ||
143 | 569 | text1.style.opacity = '1'; | ||
144 | 570 | } | ||
145 | 571 | timer = window.setTimeout(function(){timer = null;}, 400); | ||
146 | 572 | } | ||
147 | 521 | } | 573 | } |
148 | 522 | 574 | ||
149 | 523 | function _show_text(text, new_text) { | 575 | function _show_text(text, new_text) { |
150 | @@ -541,6 +593,7 @@ | |||
151 | 541 | <img id="image" class="size" %s /> | 593 | <img id="image" class="size" %s /> |
152 | 542 | %s | 594 | %s |
153 | 543 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> | 595 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> |
154 | 596 | <div class="lyricstable"><div id="lyricsmain2" style="opacity:0" class="lyricscell lyricsmain"></div></div> | ||
155 | 544 | <div id="footer" class="footer"></div> | 597 | <div id="footer" class="footer"></div> |
156 | 545 | <div id="black" class="size"></div> | 598 | <div id="black" class="size"></div> |
157 | 546 | </body> | 599 | </body> |
158 | @@ -587,6 +640,7 @@ | |||
159 | 587 | build_footer_css(item, height), | 640 | build_footer_css(item, height), |
160 | 588 | build_lyrics_css(item), | 641 | build_lyrics_css(item), |
161 | 589 | 'true' if theme_data and theme_data.display_slide_transition and is_live else 'false', | 642 | 'true' if theme_data and theme_data.display_slide_transition and is_live else 'false', |
162 | 643 | get_transition_type(item), | ||
163 | 590 | js_additions, | 644 | js_additions, |
164 | 591 | bgimage_src, | 645 | bgimage_src, |
165 | 592 | image_src, | 646 | image_src, |
166 | @@ -754,3 +808,15 @@ | |||
167 | 754 | lyrics_html = style % (item.footer.x(), bottom, item.footer.width(), | 808 | lyrics_html = style % (item.footer.x(), bottom, item.footer.width(), |
168 | 755 | theme.font_footer_name, theme.font_footer_size, theme.font_footer_color, whitespace) | 809 | theme.font_footer_name, theme.font_footer_size, theme.font_footer_color, whitespace) |
169 | 756 | return lyrics_html | 810 | return lyrics_html |
170 | 811 | |||
171 | 812 | def get_transition_type(item): | ||
172 | 813 | """ | ||
173 | 814 | Returns the transition type of the theme | ||
174 | 815 | |||
175 | 816 | :param item: Service Item to be processed. | ||
176 | 817 | """ | ||
177 | 818 | theme= item.theme_data | ||
178 | 819 | if not theme: | ||
179 | 820 | return '0' | ||
180 | 821 | |||
181 | 822 | return theme.display_slide_transition_type | ||
182 | 757 | \ No newline at end of file | 823 | \ No newline at end of file |
183 | 758 | 824 | ||
184 | === modified file 'openlp/core/lib/json/theme.json' | |||
185 | --- openlp/core/lib/json/theme.json 2013-10-18 18:10:47 +0000 | |||
186 | +++ openlp/core/lib/json/theme.json 2015-01-31 10:17:29 +0000 | |||
187 | @@ -11,6 +11,7 @@ | |||
188 | 11 | "display" :{ | 11 | "display" :{ |
189 | 12 | "horizontal_align": 0, | 12 | "horizontal_align": 0, |
190 | 13 | "slide_transition": false, | 13 | "slide_transition": false, |
191 | 14 | "slide_transition_type": 0, | ||
192 | 14 | "vertical_align": 0 | 15 | "vertical_align": 0 |
193 | 15 | }, | 16 | }, |
194 | 16 | "font": { | 17 | "font": { |
195 | 17 | 18 | ||
196 | === modified file 'openlp/core/lib/theme.py' | |||
197 | --- openlp/core/lib/theme.py 2015-01-18 13:39:21 +0000 | |||
198 | +++ openlp/core/lib/theme.py 2015-01-31 10:17:29 +0000 | |||
199 | @@ -140,6 +140,33 @@ | |||
200 | 140 | Names = ['top', 'middle', 'bottom'] | 140 | Names = ['top', 'middle', 'bottom'] |
201 | 141 | 141 | ||
202 | 142 | 142 | ||
203 | 143 | class TransitionType(object): | ||
204 | 144 | """ | ||
205 | 145 | Type enumeration for backgrounds. | ||
206 | 146 | """ | ||
207 | 147 | Fadeout_fadein = 0 | ||
208 | 148 | Crossfade = 1 | ||
209 | 149 | |||
210 | 150 | @staticmethod | ||
211 | 151 | def to_string(transition_type): | ||
212 | 152 | """ | ||
213 | 153 | Return a string representation of a transition type. | ||
214 | 154 | """ | ||
215 | 155 | if transition_type == TransitionType.Fadeout_fadein: | ||
216 | 156 | return 'Fade Out - Fade In' | ||
217 | 157 | elif transition_type == TransitionType.Crossfade: | ||
218 | 158 | return 'Crossfade' | ||
219 | 159 | |||
220 | 160 | @staticmethod | ||
221 | 161 | def from_string(type_string): | ||
222 | 162 | """ | ||
223 | 163 | Return a transition type for the given string. | ||
224 | 164 | """ | ||
225 | 165 | if type_string == 'Fade Out - Fade In': | ||
226 | 166 | return TransitionType.Fadeout_fadein | ||
227 | 167 | elif type_string == 'Crossfade': | ||
228 | 168 | return TransitionType.Crossfade | ||
229 | 169 | |||
230 | 143 | BOOLEAN_LIST = ['bold', 'italics', 'override', 'outline', 'shadow', 'slide_transition'] | 170 | BOOLEAN_LIST = ['bold', 'italics', 'override', 'outline', 'shadow', 'slide_transition'] |
231 | 144 | 171 | ||
232 | 145 | INTEGER_LIST = ['size', 'line_adjustment', 'x', 'height', 'y', 'width', 'shadow_size', 'outline_size', | 172 | INTEGER_LIST = ['size', 'line_adjustment', 'x', 'height', 'y', 'width', 'shadow_size', 'outline_size', |
233 | @@ -318,13 +345,14 @@ | |||
234 | 318 | element.appendChild(value) | 345 | element.appendChild(value) |
235 | 319 | background.appendChild(element) | 346 | background.appendChild(element) |
236 | 320 | 347 | ||
238 | 321 | def add_display(self, horizontal, vertical, transition): | 348 | def add_display(self, horizontal, vertical, transition, transition_type): |
239 | 322 | """ | 349 | """ |
240 | 323 | Add a Display options. | 350 | Add a Display options. |
241 | 324 | 351 | ||
242 | 325 | :param horizontal: The horizontal alignment of the text. | 352 | :param horizontal: The horizontal alignment of the text. |
243 | 326 | :param vertical: The vertical alignment of the text. | 353 | :param vertical: The vertical alignment of the text. |
244 | 327 | :param transition: Whether the slide transition is active. | 354 | :param transition: Whether the slide transition is active. |
245 | 355 | _param transition_type: Type of the slide transition. | ||
246 | 328 | """ | 356 | """ |
247 | 329 | background = self.theme_xml.createElement('display') | 357 | background = self.theme_xml.createElement('display') |
248 | 330 | self.theme.appendChild(background) | 358 | self.theme.appendChild(background) |
249 | @@ -343,6 +371,11 @@ | |||
250 | 343 | value = self.theme_xml.createTextNode(str(transition)) | 371 | value = self.theme_xml.createTextNode(str(transition)) |
251 | 344 | element.appendChild(value) | 372 | element.appendChild(value) |
252 | 345 | background.appendChild(element) | 373 | background.appendChild(element) |
253 | 374 | # Slide Transition Type | ||
254 | 375 | element = self.theme_xml.createElement('slideTransitionType') | ||
255 | 376 | value = self.theme_xml.createTextNode(str(transition_type)) | ||
256 | 377 | element.appendChild(value) | ||
257 | 378 | background.appendChild(element) | ||
258 | 346 | 379 | ||
259 | 347 | def child_element(self, element, tag, value): | 380 | def child_element(self, element, tag, value): |
260 | 348 | """ | 381 | """ |
261 | @@ -555,5 +588,6 @@ | |||
262 | 555 | self.add_display( | 588 | self.add_display( |
263 | 556 | self.display_horizontal_align, | 589 | self.display_horizontal_align, |
264 | 557 | self.display_vertical_align, | 590 | self.display_vertical_align, |
266 | 558 | self.display_slide_transition | 591 | self.display_slide_transition, |
267 | 592 | self.display_slide_transition_type | ||
268 | 559 | ) | 593 | ) |
269 | 560 | 594 | ||
270 | === modified file 'openlp/core/ui/themeform.py' | |||
271 | --- openlp/core/ui/themeform.py 2015-01-18 13:39:21 +0000 | |||
272 | +++ openlp/core/ui/themeform.py 2015-01-31 10:17:29 +0000 | |||
273 | @@ -28,7 +28,7 @@ | |||
274 | 28 | from PyQt4 import QtCore, QtGui | 28 | from PyQt4 import QtCore, QtGui |
275 | 29 | 29 | ||
276 | 30 | from openlp.core.common import Registry, RegistryProperties, UiStrings, translate | 30 | from openlp.core.common import Registry, RegistryProperties, UiStrings, translate |
278 | 31 | from openlp.core.lib.theme import BackgroundType, BackgroundGradientType | 31 | from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, TransitionType |
279 | 32 | from openlp.core.lib.ui import critical_error_message_box | 32 | from openlp.core.lib.ui import critical_error_message_box |
280 | 33 | from openlp.core.ui import ThemeLayoutForm | 33 | from openlp.core.ui import ThemeLayoutForm |
281 | 34 | from openlp.core.utils import get_images_filter, is_not_image_file | 34 | from openlp.core.utils import get_images_filter, is_not_image_file |
282 | @@ -88,6 +88,7 @@ | |||
283 | 88 | self.main_font_combo_box.activated.connect(self.calculate_lines) | 88 | self.main_font_combo_box.activated.connect(self.calculate_lines) |
284 | 89 | self.footer_font_combo_box.activated.connect(self.update_theme) | 89 | self.footer_font_combo_box.activated.connect(self.update_theme) |
285 | 90 | self.footer_size_spin_box.valueChanged.connect(self.update_theme) | 90 | self.footer_size_spin_box.valueChanged.connect(self.update_theme) |
286 | 91 | self.transitions_combo_box.currentIndexChanged.connect(self.on_transitions_combo_box_current_index_changed) | ||
287 | 91 | 92 | ||
288 | 92 | def set_defaults(self): | 93 | def set_defaults(self): |
289 | 93 | """ | 94 | """ |
290 | @@ -134,6 +135,7 @@ | |||
291 | 134 | self.background_page.registerField('horizontal', self.horizontal_combo_box) | 135 | self.background_page.registerField('horizontal', self.horizontal_combo_box) |
292 | 135 | self.background_page.registerField('vertical', self.vertical_combo_box) | 136 | self.background_page.registerField('vertical', self.vertical_combo_box) |
293 | 136 | self.background_page.registerField('slide_transition', self.transitions_check_box) | 137 | self.background_page.registerField('slide_transition', self.transitions_check_box) |
294 | 138 | self.background_page.registerField('slide_transition_type', self.transitions_combo_box) | ||
295 | 137 | self.background_page.registerField('name', self.theme_name_edit) | 139 | self.background_page.registerField('name', self.theme_name_edit) |
296 | 138 | 140 | ||
297 | 139 | def calculate_lines(self): | 141 | def calculate_lines(self): |
298 | @@ -366,6 +368,7 @@ | |||
299 | 366 | self.setField('horizontal', self.theme.display_horizontal_align) | 368 | self.setField('horizontal', self.theme.display_horizontal_align) |
300 | 367 | self.setField('vertical', self.theme.display_vertical_align) | 369 | self.setField('vertical', self.theme.display_vertical_align) |
301 | 368 | self.setField('slide_transition', self.theme.display_slide_transition) | 370 | self.setField('slide_transition', self.theme.display_slide_transition) |
302 | 371 | self.setField('slide_transition_type', self.theme.display_slide_transition_type) | ||
303 | 369 | 372 | ||
304 | 370 | def set_preview_page_values(self): | 373 | def set_preview_page_values(self): |
305 | 371 | """ | 374 | """ |
306 | @@ -464,6 +467,14 @@ | |||
307 | 464 | """ | 467 | """ |
308 | 465 | self.theme.font_footer_color = color | 468 | self.theme.font_footer_color = color |
309 | 466 | 469 | ||
310 | 470 | def on_transitions_combo_box_current_index_changed(self, index): | ||
311 | 471 | """ | ||
312 | 472 | Transition style Combo box has changed. | ||
313 | 473 | """ | ||
314 | 474 | # do not allow updates when screen is building for the first time. | ||
315 | 475 | if self.update_theme_allowed: | ||
316 | 476 | self.theme.transition_type = TransitionType.to_string(index) | ||
317 | 477 | |||
318 | 467 | def update_theme(self): | 478 | def update_theme(self): |
319 | 468 | """ | 479 | """ |
320 | 469 | Update the theme object from the UI for fields not already updated | 480 | Update the theme object from the UI for fields not already updated |
321 | @@ -496,6 +507,7 @@ | |||
322 | 496 | self.theme.display_horizontal_align = self.horizontal_combo_box.currentIndex() | 507 | self.theme.display_horizontal_align = self.horizontal_combo_box.currentIndex() |
323 | 497 | self.theme.display_vertical_align = self.vertical_combo_box.currentIndex() | 508 | self.theme.display_vertical_align = self.vertical_combo_box.currentIndex() |
324 | 498 | self.theme.display_slide_transition = self.field('slide_transition') | 509 | self.theme.display_slide_transition = self.field('slide_transition') |
325 | 510 | self.theme.display_slide_transition_type = self.field('slide_transition_type') | ||
326 | 499 | 511 | ||
327 | 500 | def accept(self): | 512 | def accept(self): |
328 | 501 | """ | 513 | """ |
329 | 502 | 514 | ||
330 | === modified file 'openlp/core/ui/themewizard.py' | |||
331 | --- openlp/core/ui/themewizard.py 2015-01-18 13:39:21 +0000 | |||
332 | +++ openlp/core/ui/themewizard.py 2015-01-31 10:17:29 +0000 | |||
333 | @@ -26,7 +26,7 @@ | |||
334 | 26 | 26 | ||
335 | 27 | from openlp.core.common import UiStrings, translate, is_macosx | 27 | from openlp.core.common import UiStrings, translate, is_macosx |
336 | 28 | from openlp.core.lib import build_icon, ColorButton | 28 | from openlp.core.lib import build_icon, ColorButton |
338 | 29 | from openlp.core.lib.theme import HorizontalType, BackgroundType, BackgroundGradientType | 29 | from openlp.core.lib.theme import HorizontalType, BackgroundType, BackgroundGradientType, TransitionType |
339 | 30 | from openlp.core.lib.ui import add_welcome_page, create_valign_selection_widgets | 30 | from openlp.core.lib.ui import add_welcome_page, create_valign_selection_widgets |
340 | 31 | 31 | ||
341 | 32 | 32 | ||
342 | @@ -257,9 +257,17 @@ | |||
343 | 257 | self.alignment_layout.addRow(self.vertical_label, self.vertical_combo_box) | 257 | self.alignment_layout.addRow(self.vertical_label, self.vertical_combo_box) |
344 | 258 | self.transitions_label = QtGui.QLabel(self.alignment_page) | 258 | self.transitions_label = QtGui.QLabel(self.alignment_page) |
345 | 259 | self.transitions_label.setObjectName('transitions_label') | 259 | self.transitions_label.setObjectName('transitions_label') |
346 | 260 | self.transitions_properties_layout = QtGui.QHBoxLayout() | ||
347 | 261 | self.transitions_properties_layout.setObjectName('transitions_properties_layout') | ||
348 | 260 | self.transitions_check_box = QtGui.QCheckBox(self.alignment_page) | 262 | self.transitions_check_box = QtGui.QCheckBox(self.alignment_page) |
349 | 261 | self.transitions_check_box.setObjectName('transitions_check_box') | 263 | self.transitions_check_box.setObjectName('transitions_check_box') |
351 | 262 | self.alignment_layout.addRow(self.transitions_label, self.transitions_check_box) | 264 | self.transitions_properties_layout.addWidget(self.transitions_check_box) |
352 | 265 | self.transitions_properties_layout.addSpacing(20) | ||
353 | 266 | self.transitions_combo_box = QtGui.QComboBox(self.alignment_page) | ||
354 | 267 | self.transitions_combo_box.addItems(['', '']) | ||
355 | 268 | self.transitions_combo_box.setObjectName('transitions_combo_box') | ||
356 | 269 | self.transitions_properties_layout.addWidget(self.transitions_combo_box) | ||
357 | 270 | self.alignment_layout.addRow(self.transitions_label, self.transitions_properties_layout) | ||
358 | 263 | self.alignment_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer) | 271 | self.alignment_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer) |
359 | 264 | theme_wizard.addPage(self.alignment_page) | 272 | theme_wizard.addPage(self.alignment_page) |
360 | 265 | # Area Position Page | 273 | # Area Position Page |
361 | @@ -458,6 +466,10 @@ | |||
362 | 458 | self.horizontal_combo_box.setItemText(HorizontalType.Center, translate('OpenLP.ThemeWizard', 'Center')) | 466 | self.horizontal_combo_box.setItemText(HorizontalType.Center, translate('OpenLP.ThemeWizard', 'Center')) |
363 | 459 | self.horizontal_combo_box.setItemText(HorizontalType.Justify, translate('OpenLP.ThemeWizard', 'Justify')) | 467 | self.horizontal_combo_box.setItemText(HorizontalType.Justify, translate('OpenLP.ThemeWizard', 'Justify')) |
364 | 460 | self.transitions_label.setText(translate('OpenLP.ThemeWizard', 'Transitions:')) | 468 | self.transitions_label.setText(translate('OpenLP.ThemeWizard', 'Transitions:')) |
365 | 469 | self.transitions_combo_box.setItemText(TransitionType.Fadeout_fadein, | ||
366 | 470 | translate('OpenLP.ThemeWizard', 'Fade out - Fade in')) | ||
367 | 471 | self.transitions_combo_box.setItemText(TransitionType.Crossfade, | ||
368 | 472 | translate('OpenLP.ThemeWizard', 'Crossfade')) | ||
369 | 461 | self.area_position_page.setTitle(translate('OpenLP.ThemeWizard', 'Output Area Locations')) | 473 | self.area_position_page.setTitle(translate('OpenLP.ThemeWizard', 'Output Area Locations')) |
370 | 462 | self.area_position_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Allows you to change and move the' | 474 | self.area_position_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Allows you to change and move the' |
371 | 463 | ' Main and Footer areas.')) | 475 | ' Main and Footer areas.')) |
372 | 464 | 476 | ||
373 | === modified file 'tests/functional/openlp_core_lib/test_htmlbuilder.py' | |||
374 | --- tests/functional/openlp_core_lib/test_htmlbuilder.py 2014-07-24 21:57:16 +0000 | |||
375 | +++ tests/functional/openlp_core_lib/test_htmlbuilder.py 2015-01-31 10:17:29 +0000 | |||
376 | @@ -8,7 +8,7 @@ | |||
377 | 8 | 8 | ||
378 | 9 | from openlp.core.common import Settings | 9 | from openlp.core.common import Settings |
379 | 10 | from openlp.core.lib.htmlbuilder import build_html, build_background_css, build_lyrics_css, build_lyrics_outline_css, \ | 10 | from openlp.core.lib.htmlbuilder import build_html, build_background_css, build_lyrics_css, build_lyrics_outline_css, \ |
381 | 11 | build_lyrics_format_css, build_footer_css | 11 | build_lyrics_format_css, build_footer_css, get_transition_type |
382 | 12 | from openlp.core.lib.theme import HorizontalType, VerticalType | 12 | from openlp.core.lib.theme import HorizontalType, VerticalType |
383 | 13 | from tests.functional import MagicMock, patch | 13 | from tests.functional import MagicMock, patch |
384 | 14 | from tests.helpers.testmixin import TestMixin | 14 | from tests.helpers.testmixin import TestMixin |
385 | @@ -65,6 +65,7 @@ | |||
386 | 65 | <script> | 65 | <script> |
387 | 66 | var timer = null; | 66 | var timer = null; |
388 | 67 | var transition = false; | 67 | var transition = false; |
389 | 68 | var transition_type = 0; | ||
390 | 68 | plugin JS | 69 | plugin JS |
391 | 69 | 70 | ||
392 | 70 | function show_image(src){ | 71 | function show_image(src){ |
393 | @@ -91,6 +92,7 @@ | |||
394 | 91 | } | 92 | } |
395 | 92 | document.getElementById('black').style.display = black; | 93 | document.getElementById('black').style.display = black; |
396 | 93 | document.getElementById('lyricsmain').style.visibility = lyrics; | 94 | document.getElementById('lyricsmain').style.visibility = lyrics; |
397 | 95 | document.getElementById('lyricsmain2').style.visibility = lyrics; | ||
398 | 94 | document.getElementById('image').style.visibility = lyrics; | 96 | document.getElementById('image').style.visibility = lyrics; |
399 | 95 | document.getElementById('footer').style.visibility = lyrics; | 97 | document.getElementById('footer').style.visibility = lyrics; |
400 | 96 | } | 98 | } |
401 | @@ -100,7 +102,7 @@ | |||
402 | 100 | } | 102 | } |
403 | 101 | 103 | ||
404 | 102 | function show_text(new_text){ | 104 | function show_text(new_text){ |
406 | 103 | var match = /-webkit-text-fill-color:[^;"]+/gi; | 105 | var match = /-webkit-text-fill-color:[^;\"]+/gi; |
407 | 104 | if(timer != null) | 106 | if(timer != null) |
408 | 105 | clearTimeout(timer); | 107 | clearTimeout(timer); |
409 | 106 | /* | 108 | /* |
410 | @@ -118,23 +120,51 @@ | |||
411 | 118 | new_text = '<span>' + new_text + '</span>'; | 120 | new_text = '<span>' + new_text + '</span>'; |
412 | 119 | } | 121 | } |
413 | 120 | } | 122 | } |
415 | 121 | text_fade('lyricsmain', new_text); | 123 | txt = document.getElementById('lyricsmain2'); |
416 | 124 | if(window.getComputedStyle(txt).textAlign == 'justify'){ | ||
417 | 125 | if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){ | ||
418 | 126 | new_text = new_text.replace(/(\s| )+(?![^<]*>)/g, | ||
419 | 127 | function(match) { | ||
420 | 128 | return '</span>' + match + '<span>'; | ||
421 | 129 | }); | ||
422 | 130 | new_text = '<span>' + new_text + '</span>'; | ||
423 | 131 | } | ||
424 | 132 | } | ||
425 | 133 | text_fade('lyricsmain', 'lyricsmain2', new_text); | ||
426 | 122 | } | 134 | } |
427 | 123 | 135 | ||
429 | 124 | function text_fade(id, new_text){ | 136 | function text_fade(id, id2, new_text){ |
430 | 125 | /* | 137 | /* |
431 | 126 | Show the text. | 138 | Show the text. |
432 | 127 | */ | 139 | */ |
435 | 128 | var text = document.getElementById(id); | 140 | var text1 = document.getElementById(id); |
436 | 129 | if(text == null) return; | 141 | var text2 = document.getElementById(id2); |
437 | 142 | if(text1 == null) return; | ||
438 | 143 | if(text2 == null) return; | ||
439 | 130 | if(!transition){ | 144 | if(!transition){ |
441 | 131 | text.innerHTML = new_text; | 145 | text1.innerHTML = new_text; |
442 | 146 | text2.innerHTML = new_text; | ||
443 | 132 | return; | 147 | return; |
444 | 133 | } | 148 | } |
449 | 134 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. | 149 | if(transition_type == 0){ |
450 | 135 | text.style.opacity = '0.1'; | 150 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. |
451 | 136 | // Fade new text in after the old text has finished fading out. | 151 | text1.style.opacity = '0.1'; |
452 | 137 | timer = window.setTimeout(function(){_show_text(text, new_text)}, 400); | 152 | // Fade new text in after the old text has finished fading out. |
453 | 153 | timer = window.setTimeout(function(){_show_text(text1, new_text)}, 400); | ||
454 | 154 | }else{ | ||
455 | 155 | // Toggle visible text element by fading out / in | ||
456 | 156 | if (text1.style.opacity == '1'){ | ||
457 | 157 | text2.innerHTML = new_text; | ||
458 | 158 | text1.style.opacity = '0'; | ||
459 | 159 | text2.style.opacity = '1'; | ||
460 | 160 | } | ||
461 | 161 | else{ | ||
462 | 162 | text1.innerHTML = new_text; | ||
463 | 163 | text2.style.opacity = '0'; | ||
464 | 164 | text1.style.opacity = '1'; | ||
465 | 165 | } | ||
466 | 166 | timer = window.setTimeout(function(){timer = null;}, 400); | ||
467 | 167 | } | ||
468 | 138 | } | 168 | } |
469 | 139 | 169 | ||
470 | 140 | function _show_text(text, new_text) { | 170 | function _show_text(text, new_text) { |
471 | @@ -158,6 +188,7 @@ | |||
472 | 158 | <img id="image" class="size" style="display:none;" /> | 188 | <img id="image" class="size" style="display:none;" /> |
473 | 159 | plugin HTML | 189 | plugin HTML |
474 | 160 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> | 190 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> |
475 | 191 | <div class="lyricstable"><div id="lyricsmain2" style="opacity:0" class="lyricscell lyricsmain"></div></div> | ||
476 | 161 | <div id="footer" class="footer"></div> | 192 | <div id="footer" class="footer"></div> |
477 | 162 | <div id="black" class="size"></div> | 193 | <div id="black" class="size"></div> |
478 | 163 | </body> | 194 | </body> |
479 | @@ -230,6 +261,7 @@ | |||
480 | 230 | # Mocked arguments. | 261 | # Mocked arguments. |
481 | 231 | item = MagicMock() | 262 | item = MagicMock() |
482 | 232 | item.bg_image_bytes = None | 263 | item.bg_image_bytes = None |
483 | 264 | item.theme_data.display_slide_transition_type = 0 | ||
484 | 233 | screen = MagicMock() | 265 | screen = MagicMock() |
485 | 234 | is_live = False | 266 | is_live = False |
486 | 235 | background = None | 267 | background = None |
487 | @@ -238,6 +270,7 @@ | |||
488 | 238 | plugin.get_display_javascript.return_value = 'plugin JS' | 270 | plugin.get_display_javascript.return_value = 'plugin JS' |
489 | 239 | plugin.get_display_html.return_value = 'plugin HTML' | 271 | plugin.get_display_html.return_value = 'plugin HTML' |
490 | 240 | plugins = [plugin] | 272 | plugins = [plugin] |
491 | 273 | self.maxDiff = None | ||
492 | 241 | 274 | ||
493 | 242 | # WHEN: Create the html. | 275 | # WHEN: Create the html. |
494 | 243 | html = build_html(item, screen, is_live, background, plugins=plugins) | 276 | html = build_html(item, screen, is_live, background, plugins=plugins) |
495 | @@ -358,3 +391,18 @@ | |||
496 | 358 | 391 | ||
497 | 359 | # THEN: Footer should wrap | 392 | # THEN: Footer should wrap |
498 | 360 | self.assertEqual(FOOTER_CSS_WRAP, css, 'The footer strings should be equal.') | 393 | self.assertEqual(FOOTER_CSS_WRAP, css, 'The footer strings should be equal.') |
499 | 394 | |||
500 | 395 | def get_transition_type_test(self): | ||
501 | 396 | """ | ||
502 | 397 | Test the get_transition_type() function | ||
503 | 398 | """ | ||
504 | 399 | # GIVEN: Create a theme. | ||
505 | 400 | item = MagicMock() | ||
506 | 401 | item.theme_data.display_slide_transition_type = 1 | ||
507 | 402 | |||
508 | 403 | #WHEN: get transition type | ||
509 | 404 | transition_type = get_transition_type(item); | ||
510 | 405 | |||
511 | 406 | #THEN: transition type should be 1 | ||
512 | 407 | self.assertEqual(1, transition_type, 'The transition type should be 1.'); | ||
513 | 408 | |||
514 | 361 | \ No newline at end of file | 409 | \ No newline at end of file |
515 | 362 | 410 | ||
516 | === modified file 'tests/functional/openlp_core_lib/test_theme.py' | |||
517 | --- tests/functional/openlp_core_lib/test_theme.py 2015-01-18 13:39:21 +0000 | |||
518 | +++ tests/functional/openlp_core_lib/test_theme.py 2015-01-31 10:17:29 +0000 | |||
519 | @@ -61,4 +61,5 @@ | |||
520 | 61 | self.assertTrue(default_theme.font_footer_name == "Arial", | 61 | self.assertTrue(default_theme.font_footer_name == "Arial", |
521 | 62 | 'The theme should have a font_footer_name of Arial') | 62 | 'The theme should have a font_footer_name of Arial') |
522 | 63 | self.assertTrue(default_theme.font_main_bold is False, 'The theme should have a font_main_bold of false') | 63 | self.assertTrue(default_theme.font_main_bold is False, 'The theme should have a font_main_bold of false') |
524 | 64 | self.assertTrue(len(default_theme.__dict__) == 47, 'The theme should have 47 variables') | 64 | self.assertTrue(default_theme.display_slide_transition_type is 0, 'The theme should have a slide_transition_type of 0') |
525 | 65 | self.assertTrue(len(default_theme.__dict__) == 48, 'The theme should have 48 variables') |
Hey Oliver,
Are you still interested in adding this feature to OpenLP? Trunk is open for code, and it would be great to have more transitions.