Merge lp:~alisonken1/openlp/strings-templates2 into lp:openlp
- strings-templates2
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Tim Bentley |
Approved revision: | 2680 |
Merged at revision: | 2675 |
Proposed branch: | lp:~alisonken1/openlp/strings-templates2 |
Merge into: | lp:openlp |
Diff against target: |
923 lines (+409/-398) 5 files modified
openlp/core/lib/htmlbuilder.py (+224/-226) openlp/core/ui/firsttimeform.py (+3/-3) openlp/plugins/bibles/forms/editbibledialog.py (+1/-1) openlp/plugins/songs/lib/mediaitem.py (+1/-1) tests/functional/openlp_core_lib/test_htmlbuilder.py (+180/-167) |
To merge this branch: | bzr merge lp:~alisonken1/openlp/strings-templates2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Bentley | Approve | ||
Tomas Groth | Approve | ||
Review via email: mp+296870@code.launchpad.net |
This proposal supersedes a proposal from 2016-06-08.
Commit message
Convert htmlbuilder.py to use Template() strings for css
Description of the change
Convert htmlbuilder.py to use Template() strings for css
- Changed strings to use Template() instead of format() for css building
- Fix htmlbuilder strings tests
- Cleanup template variables and fix tests to match
- bug 1590386 - string format error in editbibledialog.py
- bug 1590475 - string format error in mediaitem.py
- Function call error in firsttimeform.py (missed label text variable)
-------
lp:~alisonken1/openlp/strings-templates2 (revision 2679)
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal | # |
Ken Roberts (alisonken1) wrote : Posted in a previous version of this proposal | # |
Since this is HTML/css source and not just any text variable I followed the
formatting the original HTML SRC. Has something changed since the original
was put in?
On Jun 6, 2016 9:12 AM, "Tim Bentley" <email address hidden> wrote:
> Review: Needs Fixing
>
> Looks good but one comment which is general across all the code.
>
> Diff comments:
>
> > === modified file 'openlp/
> > --- openlp/
> > +++ openlp/
> > @@ -538,15 +538,60 @@
> > </script>
> > </head>
> > <body>
> > -<img id="bgimage" class="size" %s />
> > -<img id="image" class="size" %s />
> > -%s
> > +<img id="bgimage" class="size" ${bg_image} />
> > +<img id="image" class="size" ${image} />
> > +${html_additions}
> > <div class="
> class="lyricscell lyricsmain"
> > <div id="footer" class="
> > <div id="black" class="size"></div>
> > </body>
> > </html>
> > -"""
> > +""")
> > +
> > +LYRICS_SRC = Template("""
> > +.lyricstable {
> > + z-index: 5;
> > + position: absolute;
> > + display: table;
> > + ${stable}
> > +}
> > +.lyricscell {
> > + display: table-cell;
> > + word-wrap: break-word;
> > + -webkit-transition: opacity 0.4s ease;
> > + ${lyrics}
> > +}
> > +.lyricsmain {
> > + ${main}
> > +}
> > +""")
> > +
> > +FOOTER_SRC = Template("""
>
> Indent please.
> No real rule about indentation but Lyrics_src looks better!
>
> > +left: ${left}px;
> > +bottom: ${bottom}px;
> > +width: ${width}px;
> > +font-family: ${family};
> > +font-size: ${size}pt;
> > +color: ${color};
> > +text-align: left;
> > +white-space: ${space};
> > +""")
> > +
> > +LYRICS_FORMAT_SRC = Template("""
> > +${justify}
> > +text-align: ${align};
> > +vertical-align: ${valign};
> > +font-family: ${font};
> > +font-size: ${size}pt;
> > +color: ${color};
> > +line-height: ${line}%;
> > +margin: 0;
> > +padding: 0;
> > +padding-bottom: ${bottom};
> > +padding-left: ${left}px;
> > +width: ${width}px;
> > +height: ${height}
> > +""")
> >
> >
> > def build_html(item, screen, is_live, background, image=None,
> plugins=None):
>
>
> --
>
> https:/
> You are the owner of lp:~alisonken1/openlp/strings-templates2.
>
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal | # |
No it just looks a bit cramped and could do with a visit to a beauty spar😁
On 7 Jun 2016 1:42 a.m., "Ken Roberts" <email address hidden> wrote:
> Since this is HTML/css source and not just any text variable I followed the
> formatting the original HTML SRC. Has something changed since the original
> was put in?
> On Jun 6, 2016 9:12 AM, "Tim Bentley" <email address hidden> wrote:
>
> > Review: Needs Fixing
> >
> > Looks good but one comment which is general across all the code.
> >
> > Diff comments:
> >
> > > === modified file 'openlp/
> > > --- openlp/
> > > +++ openlp/
> > > @@ -538,15 +538,60 @@
> > > </script>
> > > </head>
> > > <body>
> > > -<img id="bgimage" class="size" %s />
> > > -<img id="image" class="size" %s />
> > > -%s
> > > +<img id="bgimage" class="size" ${bg_image} />
> > > +<img id="image" class="size" ${image} />
> > > +${html_additions}
> > > <div class="
> > class="lyricscell lyricsmain"
> > > <div id="footer" class="
> > > <div id="black" class="size"></div>
> > > </body>
> > > </html>
> > > -"""
> > > +""")
> > > +
> > > +LYRICS_SRC = Template("""
> > > +.lyricstable {
> > > + z-index: 5;
> > > + position: absolute;
> > > + display: table;
> > > + ${stable}
> > > +}
> > > +.lyricscell {
> > > + display: table-cell;
> > > + word-wrap: break-word;
> > > + -webkit-transition: opacity 0.4s ease;
> > > + ${lyrics}
> > > +}
> > > +.lyricsmain {
> > > + ${main}
> > > +}
> > > +""")
> > > +
> > > +FOOTER_SRC = Template("""
> >
> > Indent please.
> > No real rule about indentation but Lyrics_src looks better!
> >
> > > +left: ${left}px;
> > > +bottom: ${bottom}px;
> > > +width: ${width}px;
> > > +font-family: ${family};
> > > +font-size: ${size}pt;
> > > +color: ${color};
> > > +text-align: left;
> > > +white-space: ${space};
> > > +""")
> > > +
> > > +LYRICS_FORMAT_SRC = Template("""
> > > +${justify}
> > > +text-align: ${align};
> > > +vertical-align: ${valign};
> > > +font-family: ${font};
> > > +font-size: ${size}pt;
> > > +color: ${color};
> > > +line-height: ${line}%;
> > > +margin: 0;
> > > +padding: 0;
> > > +padding-bottom: ${bottom};
> > > +padding-left: ${left}px;
> > > +width: ${width}px;
> > > +height: ${height}
> > > +""")
> > >
> > >
> > > def build_html(item, screen, is_live, background, image=None,
> > plugins=None):
> >
> >
> > --
> >
> >
> https:/
> > You are the owner of lp:~alisonken1/openlp/strings-templates2.
> >
>
> --
>
> https:/
> You are reviewing the proposed merge of
> lp:~alisonken1/openlp/strings-templates2 into lp:openlp.
>
Tim Bentley (trb143) : Posted in a previous version of this proposal | # |
- 2680. By Ken Roberts
-
String format oops
Ken Roberts (alisonken1) wrote : | # |
Ignore last commit (2680) - fixed in strings_template and reverted in this branch
Tim Bentley (trb143) : | # |
Preview Diff
1 | === modified file 'openlp/core/lib/htmlbuilder.py' | |||
2 | --- openlp/core/lib/htmlbuilder.py 2016-05-17 13:21:29 +0000 | |||
3 | +++ openlp/core/lib/htmlbuilder.py 2016-06-09 02:57:58 +0000 | |||
4 | @@ -390,163 +390,207 @@ | |||
5 | 390 | import logging | 390 | import logging |
6 | 391 | 391 | ||
7 | 392 | from PyQt5 import QtWebKit | 392 | from PyQt5 import QtWebKit |
8 | 393 | from string import Template | ||
9 | 393 | 394 | ||
10 | 394 | from openlp.core.common import Settings | 395 | from openlp.core.common import Settings |
11 | 395 | from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType | 396 | from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType |
12 | 396 | 397 | ||
13 | 397 | log = logging.getLogger(__name__) | 398 | log = logging.getLogger(__name__) |
14 | 398 | 399 | ||
23 | 399 | # TODO: Verify where this is used before converting to python3 | 400 | HTML_SRC = Template(""" |
24 | 400 | HTMLSRC = """ | 401 | <!DOCTYPE html> |
25 | 401 | <!DOCTYPE html> | 402 | <html> |
26 | 402 | <html> | 403 | <head> |
27 | 403 | <head> | 404 | <title>OpenLP Display</title> |
28 | 404 | <title>OpenLP Display</title> | 405 | <style> |
29 | 405 | <style> | 406 | *{ |
30 | 406 | *{ | 407 | margin: 0; |
31 | 408 | padding: 0; | ||
32 | 409 | border: 0; | ||
33 | 410 | overflow: hidden; | ||
34 | 411 | -webkit-user-select: none; | ||
35 | 412 | } | ||
36 | 413 | body { | ||
37 | 414 | ${bg_css}; | ||
38 | 415 | } | ||
39 | 416 | .size { | ||
40 | 417 | position: absolute; | ||
41 | 418 | left: 0px; | ||
42 | 419 | top: 0px; | ||
43 | 420 | width: 100%; | ||
44 | 421 | height: 100%; | ||
45 | 422 | } | ||
46 | 423 | #black { | ||
47 | 424 | z-index: 8; | ||
48 | 425 | background-color: black; | ||
49 | 426 | display: none; | ||
50 | 427 | } | ||
51 | 428 | #bgimage { | ||
52 | 429 | z-index: 1; | ||
53 | 430 | } | ||
54 | 431 | #image { | ||
55 | 432 | z-index: 2; | ||
56 | 433 | } | ||
57 | 434 | ${css_additions} | ||
58 | 435 | #footer { | ||
59 | 436 | position: absolute; | ||
60 | 437 | z-index: 6; | ||
61 | 438 | ${footer_css} | ||
62 | 439 | } | ||
63 | 440 | /* lyric css */${lyrics_css} | ||
64 | 441 | sup { | ||
65 | 442 | font-size: 0.6em; | ||
66 | 443 | vertical-align: top; | ||
67 | 444 | position: relative; | ||
68 | 445 | top: -0.3em; | ||
69 | 446 | } | ||
70 | 447 | </style> | ||
71 | 448 | <script> | ||
72 | 449 | var timer = null; | ||
73 | 450 | var transition = ${transitions}; | ||
74 | 451 | ${js_additions} | ||
75 | 452 | |||
76 | 453 | function show_image(src){ | ||
77 | 454 | var img = document.getElementById('image'); | ||
78 | 455 | img.src = src; | ||
79 | 456 | if(src == '') | ||
80 | 457 | img.style.display = 'none'; | ||
81 | 458 | else | ||
82 | 459 | img.style.display = 'block'; | ||
83 | 460 | } | ||
84 | 461 | |||
85 | 462 | function show_blank(state){ | ||
86 | 463 | var black = 'none'; | ||
87 | 464 | var lyrics = ''; | ||
88 | 465 | switch(state){ | ||
89 | 466 | case 'theme': | ||
90 | 467 | lyrics = 'hidden'; | ||
91 | 468 | break; | ||
92 | 469 | case 'black': | ||
93 | 470 | black = 'block'; | ||
94 | 471 | break; | ||
95 | 472 | case 'desktop': | ||
96 | 473 | break; | ||
97 | 474 | } | ||
98 | 475 | document.getElementById('black').style.display = black; | ||
99 | 476 | document.getElementById('lyricsmain').style.visibility = lyrics; | ||
100 | 477 | document.getElementById('image').style.visibility = lyrics; | ||
101 | 478 | document.getElementById('footer').style.visibility = lyrics; | ||
102 | 479 | } | ||
103 | 480 | |||
104 | 481 | function show_footer(footertext){ | ||
105 | 482 | document.getElementById('footer').innerHTML = footertext; | ||
106 | 483 | } | ||
107 | 484 | |||
108 | 485 | function show_text(new_text){ | ||
109 | 486 | var match = /-webkit-text-fill-color:[^;\"]+/gi; | ||
110 | 487 | if(timer != null) | ||
111 | 488 | clearTimeout(timer); | ||
112 | 489 | /* | ||
113 | 490 | QtWebkit bug with outlines and justify causing outline alignment | ||
114 | 491 | problems. (Bug 859950) Surround each word with a <span> to workaround, | ||
115 | 492 | but only in this scenario. | ||
116 | 493 | */ | ||
117 | 494 | var txt = document.getElementById('lyricsmain'); | ||
118 | 495 | if(window.getComputedStyle(txt).textAlign == 'justify'){ | ||
119 | 496 | if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){ | ||
120 | 497 | new_text = new_text.replace(/(\s| )+(?![^<]*>)/g, | ||
121 | 498 | function(match) { | ||
122 | 499 | return '</span>' + match + '<span>'; | ||
123 | 500 | }); | ||
124 | 501 | new_text = '<span>' + new_text + '</span>'; | ||
125 | 502 | } | ||
126 | 503 | } | ||
127 | 504 | text_fade('lyricsmain', new_text); | ||
128 | 505 | } | ||
129 | 506 | |||
130 | 507 | function text_fade(id, new_text){ | ||
131 | 508 | /* | ||
132 | 509 | Show the text. | ||
133 | 510 | */ | ||
134 | 511 | var text = document.getElementById(id); | ||
135 | 512 | if(text == null) return; | ||
136 | 513 | if(!transition){ | ||
137 | 514 | text.innerHTML = new_text; | ||
138 | 515 | return; | ||
139 | 516 | } | ||
140 | 517 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. | ||
141 | 518 | text.style.opacity = '0.1'; | ||
142 | 519 | // Fade new text in after the old text has finished fading out. | ||
143 | 520 | timer = window.setTimeout(function(){_show_text(text, new_text)}, 400); | ||
144 | 521 | } | ||
145 | 522 | |||
146 | 523 | function _show_text(text, new_text) { | ||
147 | 524 | /* | ||
148 | 525 | Helper function to show the new_text delayed. | ||
149 | 526 | */ | ||
150 | 527 | text.innerHTML = new_text; | ||
151 | 528 | text.style.opacity = '1'; | ||
152 | 529 | // Wait until the text is completely visible. We want to save the timer id, to be able to call | ||
153 | 530 | // clearTimeout(timer) when the text has changed before finishing fading. | ||
154 | 531 | timer = window.setTimeout(function(){timer = null;}, 400); | ||
155 | 532 | } | ||
156 | 533 | |||
157 | 534 | function show_text_completed(){ | ||
158 | 535 | return (timer == null); | ||
159 | 536 | } | ||
160 | 537 | </script> | ||
161 | 538 | </head> | ||
162 | 539 | <body> | ||
163 | 540 | <img id="bgimage" class="size" ${bg_image} /> | ||
164 | 541 | <img id="image" class="size" ${image} /> | ||
165 | 542 | ${html_additions} | ||
166 | 543 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> | ||
167 | 544 | <div id="footer" class="footer"></div> | ||
168 | 545 | <div id="black" class="size"></div> | ||
169 | 546 | </body> | ||
170 | 547 | </html> | ||
171 | 548 | """) | ||
172 | 549 | |||
173 | 550 | LYRICS_SRC = Template(""" | ||
174 | 551 | .lyricstable { | ||
175 | 552 | z-index: 5; | ||
176 | 553 | position: absolute; | ||
177 | 554 | display: table; | ||
178 | 555 | ${stable} | ||
179 | 556 | } | ||
180 | 557 | .lyricscell { | ||
181 | 558 | display: table-cell; | ||
182 | 559 | word-wrap: break-word; | ||
183 | 560 | -webkit-transition: opacity 0.4s ease; | ||
184 | 561 | ${lyrics} | ||
185 | 562 | } | ||
186 | 563 | .lyricsmain { | ||
187 | 564 | ${main} | ||
188 | 565 | } | ||
189 | 566 | """) | ||
190 | 567 | |||
191 | 568 | FOOTER_SRC = Template(""" | ||
192 | 569 | left: ${left}px; | ||
193 | 570 | bottom: ${bottom}px; | ||
194 | 571 | width: ${width}px; | ||
195 | 572 | font-family: ${family}; | ||
196 | 573 | font-size: ${size}pt; | ||
197 | 574 | color: ${color}; | ||
198 | 575 | text-align: left; | ||
199 | 576 | white-space: ${space}; | ||
200 | 577 | """) | ||
201 | 578 | |||
202 | 579 | LYRICS_FORMAT_SRC = Template(""" | ||
203 | 580 | ${justify}word-wrap: break-word; | ||
204 | 581 | text-align: ${align}; | ||
205 | 582 | vertical-align: ${valign}; | ||
206 | 583 | font-family: ${font}; | ||
207 | 584 | font-size: ${size}pt; | ||
208 | 585 | color: ${color}; | ||
209 | 586 | line-height: ${line}%; | ||
210 | 407 | margin: 0; | 587 | margin: 0; |
211 | 408 | padding: 0; | 588 | padding: 0; |
353 | 409 | border: 0; | 589 | padding-bottom: ${bottom}; |
354 | 410 | overflow: hidden; | 590 | padding-left: ${left}px; |
355 | 411 | -webkit-user-select: none; | 591 | width: ${width}px; |
356 | 412 | } | 592 | height: ${height}px;${font_style}${font_weight} |
357 | 413 | body { | 593 | """) |
217 | 414 | %s; | ||
218 | 415 | } | ||
219 | 416 | .size { | ||
220 | 417 | position: absolute; | ||
221 | 418 | left: 0px; | ||
222 | 419 | top: 0px; | ||
223 | 420 | width: 100%%; | ||
224 | 421 | height: 100%%; | ||
225 | 422 | } | ||
226 | 423 | #black { | ||
227 | 424 | z-index: 8; | ||
228 | 425 | background-color: black; | ||
229 | 426 | display: none; | ||
230 | 427 | } | ||
231 | 428 | #bgimage { | ||
232 | 429 | z-index: 1; | ||
233 | 430 | } | ||
234 | 431 | #image { | ||
235 | 432 | z-index: 2; | ||
236 | 433 | } | ||
237 | 434 | %s | ||
238 | 435 | #footer { | ||
239 | 436 | position: absolute; | ||
240 | 437 | z-index: 6; | ||
241 | 438 | %s | ||
242 | 439 | } | ||
243 | 440 | /* lyric css */ | ||
244 | 441 | %s | ||
245 | 442 | sup { | ||
246 | 443 | font-size: 0.6em; | ||
247 | 444 | vertical-align: top; | ||
248 | 445 | position: relative; | ||
249 | 446 | top: -0.3em; | ||
250 | 447 | } | ||
251 | 448 | </style> | ||
252 | 449 | <script> | ||
253 | 450 | var timer = null; | ||
254 | 451 | var transition = %s; | ||
255 | 452 | %s | ||
256 | 453 | |||
257 | 454 | function show_image(src){ | ||
258 | 455 | var img = document.getElementById('image'); | ||
259 | 456 | img.src = src; | ||
260 | 457 | if(src == '') | ||
261 | 458 | img.style.display = 'none'; | ||
262 | 459 | else | ||
263 | 460 | img.style.display = 'block'; | ||
264 | 461 | } | ||
265 | 462 | |||
266 | 463 | function show_blank(state){ | ||
267 | 464 | var black = 'none'; | ||
268 | 465 | var lyrics = ''; | ||
269 | 466 | switch(state){ | ||
270 | 467 | case 'theme': | ||
271 | 468 | lyrics = 'hidden'; | ||
272 | 469 | break; | ||
273 | 470 | case 'black': | ||
274 | 471 | black = 'block'; | ||
275 | 472 | break; | ||
276 | 473 | case 'desktop': | ||
277 | 474 | break; | ||
278 | 475 | } | ||
279 | 476 | document.getElementById('black').style.display = black; | ||
280 | 477 | document.getElementById('lyricsmain').style.visibility = lyrics; | ||
281 | 478 | document.getElementById('image').style.visibility = lyrics; | ||
282 | 479 | document.getElementById('footer').style.visibility = lyrics; | ||
283 | 480 | } | ||
284 | 481 | |||
285 | 482 | function show_footer(footertext){ | ||
286 | 483 | document.getElementById('footer').innerHTML = footertext; | ||
287 | 484 | } | ||
288 | 485 | |||
289 | 486 | function show_text(new_text){ | ||
290 | 487 | var match = /-webkit-text-fill-color:[^;\"]+/gi; | ||
291 | 488 | if(timer != null) | ||
292 | 489 | clearTimeout(timer); | ||
293 | 490 | /* | ||
294 | 491 | QtWebkit bug with outlines and justify causing outline alignment | ||
295 | 492 | problems. (Bug 859950) Surround each word with a <span> to workaround, | ||
296 | 493 | but only in this scenario. | ||
297 | 494 | */ | ||
298 | 495 | var txt = document.getElementById('lyricsmain'); | ||
299 | 496 | if(window.getComputedStyle(txt).textAlign == 'justify'){ | ||
300 | 497 | if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){ | ||
301 | 498 | new_text = new_text.replace(/(\s| )+(?![^<]*>)/g, | ||
302 | 499 | function(match) { | ||
303 | 500 | return '</span>' + match + '<span>'; | ||
304 | 501 | }); | ||
305 | 502 | new_text = '<span>' + new_text + '</span>'; | ||
306 | 503 | } | ||
307 | 504 | } | ||
308 | 505 | text_fade('lyricsmain', new_text); | ||
309 | 506 | } | ||
310 | 507 | |||
311 | 508 | function text_fade(id, new_text){ | ||
312 | 509 | /* | ||
313 | 510 | Show the text. | ||
314 | 511 | */ | ||
315 | 512 | var text = document.getElementById(id); | ||
316 | 513 | if(text == null) return; | ||
317 | 514 | if(!transition){ | ||
318 | 515 | text.innerHTML = new_text; | ||
319 | 516 | return; | ||
320 | 517 | } | ||
321 | 518 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. | ||
322 | 519 | text.style.opacity = '0.1'; | ||
323 | 520 | // Fade new text in after the old text has finished fading out. | ||
324 | 521 | timer = window.setTimeout(function(){_show_text(text, new_text)}, 400); | ||
325 | 522 | } | ||
326 | 523 | |||
327 | 524 | function _show_text(text, new_text) { | ||
328 | 525 | /* | ||
329 | 526 | Helper function to show the new_text delayed. | ||
330 | 527 | */ | ||
331 | 528 | text.innerHTML = new_text; | ||
332 | 529 | text.style.opacity = '1'; | ||
333 | 530 | // Wait until the text is completely visible. We want to save the timer id, to be able to call | ||
334 | 531 | // clearTimeout(timer) when the text has changed before finishing fading. | ||
335 | 532 | timer = window.setTimeout(function(){timer = null;}, 400); | ||
336 | 533 | } | ||
337 | 534 | |||
338 | 535 | function show_text_completed(){ | ||
339 | 536 | return (timer == null); | ||
340 | 537 | } | ||
341 | 538 | </script> | ||
342 | 539 | </head> | ||
343 | 540 | <body> | ||
344 | 541 | <img id="bgimage" class="size" %s /> | ||
345 | 542 | <img id="image" class="size" %s /> | ||
346 | 543 | %s | ||
347 | 544 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> | ||
348 | 545 | <div id="footer" class="footer"></div> | ||
349 | 546 | <div id="black" class="size"></div> | ||
350 | 547 | </body> | ||
351 | 548 | </html> | ||
352 | 549 | """ | ||
358 | 550 | 594 | ||
359 | 551 | 595 | ||
360 | 552 | def build_html(item, screen, is_live, background, image=None, plugins=None): | 596 | def build_html(item, screen, is_live, background, image=None, plugins=None): |
361 | @@ -582,18 +626,17 @@ | |||
362 | 582 | css_additions += plugin.get_display_css() | 626 | css_additions += plugin.get_display_css() |
363 | 583 | js_additions += plugin.get_display_javascript() | 627 | js_additions += plugin.get_display_javascript() |
364 | 584 | html_additions += plugin.get_display_html() | 628 | html_additions += plugin.get_display_html() |
377 | 585 | html = HTMLSRC % ( | 629 | return HTML_SRC.substitute(bg_css=build_background_css(item, width), |
378 | 586 | build_background_css(item, width), | 630 | css_additions=css_additions, |
379 | 587 | css_additions, | 631 | footer_css=build_footer_css(item, height), |
380 | 588 | build_footer_css(item, height), | 632 | lyrics_css=build_lyrics_css(item), |
381 | 589 | build_lyrics_css(item), | 633 | transitions='true' if (theme_data and |
382 | 590 | 'true' if theme_data and theme_data.display_slide_transition and is_live else 'false', | 634 | theme_data.display_slide_transition and |
383 | 591 | js_additions, | 635 | is_live) else 'false', |
384 | 592 | bgimage_src, | 636 | js_additions=js_additions, |
385 | 593 | image_src, | 637 | bg_image=bgimage_src, |
386 | 594 | html_additions | 638 | image=image_src, |
387 | 595 | ) | 639 | html_additions=html_additions) |
376 | 596 | return html | ||
388 | 597 | 640 | ||
389 | 598 | 641 | ||
390 | 599 | def webkit_version(): | 642 | def webkit_version(): |
391 | @@ -650,24 +693,6 @@ | |||
392 | 650 | 693 | ||
393 | 651 | :param item: Service Item containing theme and location information | 694 | :param item: Service Item containing theme and location information |
394 | 652 | """ | 695 | """ |
395 | 653 | # TODO: Verify this before converting to python3 | ||
396 | 654 | style = """ | ||
397 | 655 | .lyricstable { | ||
398 | 656 | z-index: 5; | ||
399 | 657 | position: absolute; | ||
400 | 658 | display: table; | ||
401 | 659 | %s | ||
402 | 660 | } | ||
403 | 661 | .lyricscell { | ||
404 | 662 | display: table-cell; | ||
405 | 663 | word-wrap: break-word; | ||
406 | 664 | -webkit-transition: opacity 0.4s ease; | ||
407 | 665 | %s | ||
408 | 666 | } | ||
409 | 667 | .lyricsmain { | ||
410 | 668 | %s | ||
411 | 669 | } | ||
412 | 670 | """ | ||
413 | 671 | theme_data = item.theme_data | 696 | theme_data = item.theme_data |
414 | 672 | lyricstable = '' | 697 | lyricstable = '' |
415 | 673 | lyrics = '' | 698 | lyrics = '' |
416 | @@ -680,8 +705,7 @@ | |||
417 | 680 | lyricsmain += ' text-shadow: {theme} {shadow}px ' \ | 705 | lyricsmain += ' text-shadow: {theme} {shadow}px ' \ |
418 | 681 | '{shadow}px;'.format(theme=theme_data.font_main_shadow_color, | 706 | '{shadow}px;'.format(theme=theme_data.font_main_shadow_color, |
419 | 682 | shadow=theme_data.font_main_shadow_size) | 707 | shadow=theme_data.font_main_shadow_size) |
422 | 683 | lyrics_css = style % (lyricstable, lyrics, lyricsmain) | 708 | return LYRICS_SRC.substitute(stable=lyricstable, lyrics=lyrics, main=lyricsmain) |
421 | 684 | return lyrics_css | ||
423 | 685 | 709 | ||
424 | 686 | 710 | ||
425 | 687 | def build_lyrics_outline_css(theme_data): | 711 | def build_lyrics_outline_css(theme_data): |
426 | @@ -710,38 +734,23 @@ | |||
427 | 710 | """ | 734 | """ |
428 | 711 | align = HorizontalType.Names[theme_data.display_horizontal_align] | 735 | align = HorizontalType.Names[theme_data.display_horizontal_align] |
429 | 712 | valign = VerticalType.Names[theme_data.display_vertical_align] | 736 | valign = VerticalType.Names[theme_data.display_vertical_align] |
435 | 713 | if theme_data.font_main_outline: | 737 | left_margin = (int(theme_data.font_main_outline_size) * 2) if theme_data.font_main_outline else 0 |
431 | 714 | left_margin = int(theme_data.font_main_outline_size) * 2 | ||
432 | 715 | else: | ||
433 | 716 | left_margin = 0 | ||
434 | 717 | justify = 'white-space:pre-wrap;' | ||
436 | 718 | # fix tag incompatibilities | 738 | # fix tag incompatibilities |
463 | 719 | if theme_data.display_horizontal_align == HorizontalType.Justify: | 739 | justify = '' if (theme_data.display_horizontal_align == HorizontalType.Justify) else ' white-space: pre-wrap;\n' |
464 | 720 | justify = '' | 740 | padding_bottom = '0.5em' if (theme_data.display_vertical_align == VerticalType.Bottom) else '0' |
465 | 721 | if theme_data.display_vertical_align == VerticalType.Bottom: | 741 | return LYRICS_FORMAT_SRC.substitute(justify=justify, |
466 | 722 | padding_bottom = '0.5em' | 742 | align=align, |
467 | 723 | else: | 743 | valign=valign, |
468 | 724 | padding_bottom = '0' | 744 | font=theme_data.font_main_name, |
469 | 725 | lyrics = '{justify} word-wrap: break-word; ' \ | 745 | size=theme_data.font_main_size, |
470 | 726 | 'text-align: {align}; vertical-align: {valign}; font-family: {font}; ' \ | 746 | color=theme_data.font_main_color, |
471 | 727 | 'font-size: {size}pt; color: {color}; line-height: {line:d}%; margin: 0;' \ | 747 | line='{line:d}'.format(line=100 + int(theme_data.font_main_line_adjustment)), |
472 | 728 | 'padding: 0; padding-bottom: {bottom}; padding-left: {left}px; width: {width}px; ' \ | 748 | bottom=padding_bottom, |
473 | 729 | 'height: {height}px; '.format(justify=justify, | 749 | left=left_margin, |
474 | 730 | align=align, | 750 | width=width, |
475 | 731 | valign=valign, | 751 | height=height, |
476 | 732 | font=theme_data.font_main_name, | 752 | font_style='\n font-style: italic;' if theme_data.font_main_italics else '', |
477 | 733 | size=theme_data.font_main_size, | 753 | font_weight='\n font-weight: bold;' if theme_data.font_main_bold else '') |
452 | 734 | color=theme_data.font_main_color, | ||
453 | 735 | line=100 + int(theme_data.font_main_line_adjustment), | ||
454 | 736 | bottom=padding_bottom, | ||
455 | 737 | left=left_margin, | ||
456 | 738 | width=width, | ||
457 | 739 | height=height) | ||
458 | 740 | if theme_data.font_main_italics: | ||
459 | 741 | lyrics += 'font-style:italic; ' | ||
460 | 742 | if theme_data.font_main_bold: | ||
461 | 743 | lyrics += 'font-weight:bold; ' | ||
462 | 744 | return lyrics | ||
478 | 745 | 754 | ||
479 | 746 | 755 | ||
480 | 747 | def build_footer_css(item, height): | 756 | def build_footer_css(item, height): |
481 | @@ -751,22 +760,11 @@ | |||
482 | 751 | :param item: Service Item to be processed. | 760 | :param item: Service Item to be processed. |
483 | 752 | :param height: | 761 | :param height: |
484 | 753 | """ | 762 | """ |
485 | 754 | style = """ | ||
486 | 755 | left: {left}px; | ||
487 | 756 | bottom: {bottom}px; | ||
488 | 757 | width: {width}px; | ||
489 | 758 | font-family: {family}; | ||
490 | 759 | font-size: {size}pt; | ||
491 | 760 | color: {color}; | ||
492 | 761 | text-align: left; | ||
493 | 762 | white-space: {space}; | ||
494 | 763 | """ | ||
495 | 764 | theme = item.theme_data | 763 | theme = item.theme_data |
496 | 765 | if not theme or not item.footer: | 764 | if not theme or not item.footer: |
497 | 766 | return '' | 765 | return '' |
498 | 767 | bottom = height - int(item.footer.y()) - int(item.footer.height()) | 766 | bottom = height - int(item.footer.y()) - int(item.footer.height()) |
499 | 768 | whitespace = 'normal' if Settings().value('themes/wrap footer') else 'nowrap' | 767 | whitespace = 'normal' if Settings().value('themes/wrap footer') else 'nowrap' |
504 | 769 | lyrics_html = style.format(left=item.footer.x(), bottom=bottom, width=item.footer.width(), | 768 | return FOOTER_SRC.substitute(left=item.footer.x(), bottom=bottom, width=item.footer.width(), |
505 | 770 | family=theme.font_footer_name, size=theme.font_footer_size, | 769 | family=theme.font_footer_name, size=theme.font_footer_size, |
506 | 771 | color=theme.font_footer_color, space=whitespace) | 770 | color=theme.font_footer_color, space=whitespace) |
503 | 772 | return lyrics_html | ||
507 | 773 | 771 | ||
508 | === modified file 'openlp/core/ui/firsttimeform.py' | |||
509 | --- openlp/core/ui/firsttimeform.py 2016-05-20 16:22:06 +0000 | |||
510 | +++ openlp/core/ui/firsttimeform.py 2016-06-09 02:57:58 +0000 | |||
511 | @@ -565,13 +565,13 @@ | |||
512 | 565 | if self.has_run_wizard: | 565 | if self.has_run_wizard: |
513 | 566 | text = translate('OpenLP.FirstTimeWizard', | 566 | text = translate('OpenLP.FirstTimeWizard', |
514 | 567 | 'Download complete. Click the {button} button to return to OpenLP.' | 567 | 'Download complete. Click the {button} button to return to OpenLP.' |
516 | 568 | ).format(text=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) | 568 | ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
517 | 569 | self.progress_label.setText(text) | 569 | self.progress_label.setText(text) |
518 | 570 | else: | 570 | else: |
519 | 571 | text = translate('OpenLP.FirstTimeWizard', | 571 | text = translate('OpenLP.FirstTimeWizard', |
520 | 572 | 'Download complete. Click the {button} button to start OpenLP.' | 572 | 'Download complete. Click the {button} button to start OpenLP.' |
521 | 573 | ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) | 573 | ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
523 | 574 | self.progress_label.setText() | 574 | self.progress_label.setText(text) |
524 | 575 | else: | 575 | else: |
525 | 576 | if self.has_run_wizard: | 576 | if self.has_run_wizard: |
526 | 577 | text = translate('OpenLP.FirstTimeWizard', | 577 | text = translate('OpenLP.FirstTimeWizard', |
527 | @@ -582,7 +582,7 @@ | |||
528 | 582 | text = translate('OpenLP.FirstTimeWizard', | 582 | text = translate('OpenLP.FirstTimeWizard', |
529 | 583 | 'Click the {button} button to start OpenLP.' | 583 | 'Click the {button} button to start OpenLP.' |
530 | 584 | ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) | 584 | ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
532 | 585 | self.progress_label.setText() | 585 | self.progress_label.setText(text) |
533 | 586 | self.finish_button.setVisible(True) | 586 | self.finish_button.setVisible(True) |
534 | 587 | self.finish_button.setEnabled(True) | 587 | self.finish_button.setEnabled(True) |
535 | 588 | self.cancel_button.setVisible(False) | 588 | self.cancel_button.setVisible(False) |
536 | 589 | 589 | ||
537 | === modified file 'openlp/plugins/bibles/forms/editbibledialog.py' | |||
538 | --- openlp/plugins/bibles/forms/editbibledialog.py 2016-05-21 08:31:24 +0000 | |||
539 | +++ openlp/plugins/bibles/forms/editbibledialog.py 2016-06-09 02:57:58 +0000 | |||
540 | @@ -104,7 +104,7 @@ | |||
541 | 104 | for book in BiblesResourcesDB.get_books(): | 104 | for book in BiblesResourcesDB.get_books(): |
542 | 105 | self.book_name_label[book['abbreviation']] = QtWidgets.QLabel(self.book_name_widget) | 105 | self.book_name_label[book['abbreviation']] = QtWidgets.QLabel(self.book_name_widget) |
543 | 106 | self.book_name_label[book['abbreviation']].setObjectName( | 106 | self.book_name_label[book['abbreviation']].setObjectName( |
545 | 107 | 'book_name_label[{name}]'.format(book=book['abbreviation'])) | 107 | 'book_name_label[{book}]'.format(book=book['abbreviation'])) |
546 | 108 | self.book_name_edit[book['abbreviation']] = QtWidgets.QLineEdit(self.book_name_widget) | 108 | self.book_name_edit[book['abbreviation']] = QtWidgets.QLineEdit(self.book_name_widget) |
547 | 109 | self.book_name_edit[book['abbreviation']].setObjectName( | 109 | self.book_name_edit[book['abbreviation']].setObjectName( |
548 | 110 | 'book_name_edit[{name}]'.format(name=book['abbreviation'])) | 110 | 'book_name_edit[{name}]'.format(name=book['abbreviation'])) |
549 | 111 | 111 | ||
550 | === modified file 'openlp/plugins/songs/lib/mediaitem.py' | |||
551 | --- openlp/plugins/songs/lib/mediaitem.py 2016-05-27 08:13:14 +0000 | |||
552 | +++ openlp/plugins/songs/lib/mediaitem.py 2016-06-09 02:57:58 +0000 | |||
553 | @@ -603,7 +603,7 @@ | |||
554 | 603 | else: | 603 | else: |
555 | 604 | verse_index = VerseType.from_tag(verse[0]['type']) | 604 | verse_index = VerseType.from_tag(verse[0]['type']) |
556 | 605 | verse_tag = VerseType.translated_tags[verse_index] | 605 | verse_tag = VerseType.translated_tags[verse_index] |
558 | 606 | verse_def = '{tag}{label}'.format(tzg=verse_tag, text=verse[0]['label']) | 606 | verse_def = '{tag}{text}'.format(tag=verse_tag, text=verse[0]['label']) |
559 | 607 | service_item.add_from_text(verse[1], verse_def) | 607 | service_item.add_from_text(verse[1], verse_def) |
560 | 608 | service_item.title = song.title | 608 | service_item.title = song.title |
561 | 609 | author_list = self.generate_footer(service_item, song) | 609 | author_list = self.generate_footer(service_item, song) |
562 | 610 | 610 | ||
563 | === modified file 'tests/functional/openlp_core_lib/test_htmlbuilder.py' | |||
564 | --- tests/functional/openlp_core_lib/test_htmlbuilder.py 2016-05-31 21:40:13 +0000 | |||
565 | +++ tests/functional/openlp_core_lib/test_htmlbuilder.py 2016-06-09 02:57:58 +0000 | |||
566 | @@ -14,177 +14,190 @@ | |||
567 | 14 | from tests.helpers.testmixin import TestMixin | 14 | from tests.helpers.testmixin import TestMixin |
568 | 15 | 15 | ||
569 | 16 | HTML = """ | 16 | HTML = """ |
684 | 17 | <!DOCTYPE html> | 17 | <!DOCTYPE html> |
685 | 18 | <html> | 18 | <html> |
686 | 19 | <head> | 19 | <head> |
687 | 20 | <title>OpenLP Display</title> | 20 | <title>OpenLP Display</title> |
688 | 21 | <style> | 21 | <style> |
689 | 22 | *{ | 22 | *{ |
690 | 23 | margin: 0; | 23 | margin: 0; |
691 | 24 | padding: 0; | 24 | padding: 0; |
692 | 25 | border: 0; | 25 | border: 0; |
693 | 26 | overflow: hidden; | 26 | overflow: hidden; |
694 | 27 | -webkit-user-select: none; | 27 | -webkit-user-select: none; |
695 | 28 | } | 28 | } |
696 | 29 | body { | 29 | body { |
697 | 30 | ; | 30 | ; |
698 | 31 | } | 31 | } |
699 | 32 | .size { | 32 | .size { |
700 | 33 | position: absolute; | 33 | position: absolute; |
701 | 34 | left: 0px; | 34 | left: 0px; |
702 | 35 | top: 0px; | 35 | top: 0px; |
703 | 36 | width: 100%; | 36 | width: 100%; |
704 | 37 | height: 100%; | 37 | height: 100%; |
705 | 38 | } | 38 | } |
706 | 39 | #black { | 39 | #black { |
707 | 40 | z-index: 8; | 40 | z-index: 8; |
708 | 41 | background-color: black; | 41 | background-color: black; |
709 | 42 | display: none; | 42 | display: none; |
710 | 43 | } | 43 | } |
711 | 44 | #bgimage { | 44 | #bgimage { |
712 | 45 | z-index: 1; | 45 | z-index: 1; |
713 | 46 | } | 46 | } |
714 | 47 | #image { | 47 | #image { |
715 | 48 | z-index: 2; | 48 | z-index: 2; |
716 | 49 | } | 49 | } |
717 | 50 | plugin CSS | 50 | plugin CSS |
718 | 51 | #footer { | 51 | #footer { |
719 | 52 | position: absolute; | 52 | position: absolute; |
720 | 53 | z-index: 6; | 53 | z-index: 6; |
721 | 54 | dummy: dummy; | 54 | dummy: dummy; |
722 | 55 | } | 55 | } |
723 | 56 | /* lyric css */ | 56 | /* lyric css */ |
724 | 57 | 57 | sup { | |
725 | 58 | sup { | 58 | font-size: 0.6em; |
726 | 59 | font-size: 0.6em; | 59 | vertical-align: top; |
727 | 60 | vertical-align: top; | 60 | position: relative; |
728 | 61 | position: relative; | 61 | top: -0.3em; |
729 | 62 | top: -0.3em; | 62 | } |
730 | 63 | } | 63 | </style> |
731 | 64 | </style> | 64 | <script> |
732 | 65 | <script> | 65 | var timer = null; |
733 | 66 | var timer = null; | 66 | var transition = false; |
734 | 67 | var transition = false; | 67 | plugin JS |
735 | 68 | plugin JS | 68 | |
736 | 69 | 69 | function show_image(src){ | |
737 | 70 | function show_image(src){ | 70 | var img = document.getElementById('image'); |
738 | 71 | var img = document.getElementById('image'); | 71 | img.src = src; |
739 | 72 | img.src = src; | 72 | if(src == '') |
740 | 73 | if(src == '') | 73 | img.style.display = 'none'; |
741 | 74 | img.style.display = 'none'; | 74 | else |
742 | 75 | else | 75 | img.style.display = 'block'; |
743 | 76 | img.style.display = 'block'; | 76 | } |
744 | 77 | } | 77 | |
745 | 78 | 78 | function show_blank(state){ | |
746 | 79 | function show_blank(state){ | 79 | var black = 'none'; |
747 | 80 | var black = 'none'; | 80 | var lyrics = ''; |
748 | 81 | var lyrics = ''; | 81 | switch(state){ |
749 | 82 | switch(state){ | 82 | case 'theme': |
750 | 83 | case 'theme': | 83 | lyrics = 'hidden'; |
751 | 84 | lyrics = 'hidden'; | 84 | break; |
752 | 85 | break; | 85 | case 'black': |
753 | 86 | case 'black': | 86 | black = 'block'; |
754 | 87 | black = 'block'; | 87 | break; |
755 | 88 | break; | 88 | case 'desktop': |
756 | 89 | case 'desktop': | 89 | break; |
757 | 90 | break; | 90 | } |
758 | 91 | } | 91 | document.getElementById('black').style.display = black; |
759 | 92 | document.getElementById('black').style.display = black; | 92 | document.getElementById('lyricsmain').style.visibility = lyrics; |
760 | 93 | document.getElementById('lyricsmain').style.visibility = lyrics; | 93 | document.getElementById('image').style.visibility = lyrics; |
761 | 94 | document.getElementById('image').style.visibility = lyrics; | 94 | document.getElementById('footer').style.visibility = lyrics; |
762 | 95 | document.getElementById('footer').style.visibility = lyrics; | 95 | } |
763 | 96 | } | 96 | |
764 | 97 | 97 | function show_footer(footertext){ | |
765 | 98 | function show_footer(footertext){ | 98 | document.getElementById('footer').innerHTML = footertext; |
766 | 99 | document.getElementById('footer').innerHTML = footertext; | 99 | } |
767 | 100 | } | 100 | |
768 | 101 | 101 | function show_text(new_text){ | |
769 | 102 | function show_text(new_text){ | 102 | var match = /-webkit-text-fill-color:[^;"]+/gi; |
770 | 103 | var match = /-webkit-text-fill-color:[^;"]+/gi; | 103 | if(timer != null) |
771 | 104 | if(timer != null) | 104 | clearTimeout(timer); |
772 | 105 | clearTimeout(timer); | 105 | /* |
773 | 106 | /* | 106 | QtWebkit bug with outlines and justify causing outline alignment |
774 | 107 | QtWebkit bug with outlines and justify causing outline alignment | 107 | problems. (Bug 859950) Surround each word with a <span> to workaround, |
775 | 108 | problems. (Bug 859950) Surround each word with a <span> to workaround, | 108 | but only in this scenario. |
776 | 109 | but only in this scenario. | 109 | */ |
777 | 110 | */ | 110 | var txt = document.getElementById('lyricsmain'); |
778 | 111 | var txt = document.getElementById('lyricsmain'); | 111 | if(window.getComputedStyle(txt).textAlign == 'justify'){ |
779 | 112 | if(window.getComputedStyle(txt).textAlign == 'justify'){ | 112 | if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){ |
780 | 113 | if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){ | 113 | new_text = new_text.replace(/(\s| )+(?![^<]*>)/g, |
781 | 114 | new_text = new_text.replace(/(\s| )+(?![^<]*>)/g, | 114 | function(match) { |
782 | 115 | function(match) { | 115 | return '</span>' + match + '<span>'; |
783 | 116 | return '</span>' + match + '<span>'; | 116 | }); |
784 | 117 | }); | 117 | new_text = '<span>' + new_text + '</span>'; |
785 | 118 | new_text = '<span>' + new_text + '</span>'; | 118 | } |
786 | 119 | } | 119 | } |
787 | 120 | } | 120 | text_fade('lyricsmain', new_text); |
788 | 121 | text_fade('lyricsmain', new_text); | 121 | } |
789 | 122 | } | 122 | |
790 | 123 | 123 | function text_fade(id, new_text){ | |
791 | 124 | function text_fade(id, new_text){ | 124 | /* |
792 | 125 | /* | 125 | Show the text. |
793 | 126 | Show the text. | 126 | */ |
794 | 127 | */ | 127 | var text = document.getElementById(id); |
795 | 128 | var text = document.getElementById(id); | 128 | if(text == null) return; |
796 | 129 | if(text == null) return; | 129 | if(!transition){ |
797 | 130 | if(!transition){ | 130 | text.innerHTML = new_text; |
798 | 131 | return; | ||
799 | 132 | } | ||
800 | 133 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. | ||
801 | 134 | text.style.opacity = '0.1'; | ||
802 | 135 | // Fade new text in after the old text has finished fading out. | ||
803 | 136 | timer = window.setTimeout(function(){_show_text(text, new_text)}, 400); | ||
804 | 137 | } | ||
805 | 138 | |||
806 | 139 | function _show_text(text, new_text) { | ||
807 | 140 | /* | ||
808 | 141 | Helper function to show the new_text delayed. | ||
809 | 142 | */ | ||
810 | 131 | text.innerHTML = new_text; | 143 | text.innerHTML = new_text; |
845 | 132 | return; | 144 | text.style.opacity = '1'; |
846 | 133 | } | 145 | // Wait until the text is completely visible. We want to save the timer id, to be able to call |
847 | 134 | // Fade text out. 0.1 to minimize the time "nothing" is shown on the screen. | 146 | // clearTimeout(timer) when the text has changed before finishing fading. |
848 | 135 | text.style.opacity = '0.1'; | 147 | timer = window.setTimeout(function(){timer = null;}, 400); |
849 | 136 | // Fade new text in after the old text has finished fading out. | 148 | } |
850 | 137 | timer = window.setTimeout(function(){_show_text(text, new_text)}, 400); | 149 | |
851 | 138 | } | 150 | function show_text_completed(){ |
852 | 139 | 151 | return (timer == null); | |
853 | 140 | function _show_text(text, new_text) { | 152 | } |
854 | 141 | /* | 153 | </script> |
855 | 142 | Helper function to show the new_text delayed. | 154 | </head> |
856 | 143 | */ | 155 | <body> |
857 | 144 | text.innerHTML = new_text; | 156 | <img id="bgimage" class="size" style="display:none;" /> |
858 | 145 | text.style.opacity = '1'; | 157 | <img id="image" class="size" style="display:none;" /> |
859 | 146 | // Wait until the text is completely visible. We want to save the timer id, to be able to call | 158 | plugin HTML |
860 | 147 | // clearTimeout(timer) when the text has changed before finishing fading. | 159 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> |
861 | 148 | timer = window.setTimeout(function(){timer = null;}, 400); | 160 | <div id="footer" class="footer"></div> |
862 | 149 | } | 161 | <div id="black" class="size"></div> |
863 | 150 | 162 | </body> | |
864 | 151 | function show_text_completed(){ | 163 | </html> |
865 | 152 | return (timer == null); | 164 | """ |
832 | 153 | } | ||
833 | 154 | </script> | ||
834 | 155 | </head> | ||
835 | 156 | <body> | ||
836 | 157 | <img id="bgimage" class="size" style="display:none;" /> | ||
837 | 158 | <img id="image" class="size" style="display:none;" /> | ||
838 | 159 | plugin HTML | ||
839 | 160 | <div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div> | ||
840 | 161 | <div id="footer" class="footer"></div> | ||
841 | 162 | <div id="black" class="size"></div> | ||
842 | 163 | </body> | ||
843 | 164 | </html> | ||
844 | 165 | """ | ||
866 | 166 | BACKGROUND_CSS_RADIAL = 'background: -webkit-gradient(radial, 5 50%, 100, 5 50%, 5, from(#000000), to(#FFFFFF)) fixed' | 165 | BACKGROUND_CSS_RADIAL = 'background: -webkit-gradient(radial, 5 50%, 100, 5 50%, 5, from(#000000), to(#FFFFFF)) fixed' |
867 | 167 | LYRICS_CSS = """ | 166 | LYRICS_CSS = """ |
876 | 168 | .lyricstable { | 167 | .lyricstable { |
877 | 169 | z-index: 5; | 168 | z-index: 5; |
878 | 170 | position: absolute; | 169 | position: absolute; |
879 | 171 | display: table; | 170 | display: table; |
880 | 172 | left: 10px; top: 20px; | 171 | left: 10px; top: 20px; |
881 | 173 | } | 172 | } |
882 | 174 | .lyricscell { | 173 | .lyricscell { |
883 | 175 | display: table-cell; | 174 | display: table-cell; |
884 | 175 | word-wrap: break-word; | ||
885 | 176 | -webkit-transition: opacity 0.4s ease; | ||
886 | 177 | lyrics_format_css | ||
887 | 178 | } | ||
888 | 179 | .lyricsmain { | ||
889 | 180 | text-shadow: #000000 5px 5px; | ||
890 | 181 | } | ||
891 | 182 | """ | ||
892 | 183 | LYRICS_OUTLINE_CSS = ' -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; ' | ||
893 | 184 | LYRICS_FORMAT_CSS = """ | ||
894 | 176 | word-wrap: break-word; | 185 | word-wrap: break-word; |
906 | 177 | -webkit-transition: opacity 0.4s ease; | 186 | text-align: justify; |
907 | 178 | lyrics_format_css | 187 | vertical-align: bottom; |
908 | 179 | } | 188 | font-family: Arial; |
909 | 180 | .lyricsmain { | 189 | font-size: 40pt; |
910 | 181 | text-shadow: #000000 5px 5px; | 190 | color: #FFFFFF; |
911 | 182 | } | 191 | line-height: 108%; |
912 | 183 | """ | 192 | margin: 0; |
913 | 184 | LYRICS_OUTLINE_CSS = ' -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; ' | 193 | padding: 0; |
914 | 185 | LYRICS_FORMAT_CSS = ' word-wrap: break-word; text-align: justify; vertical-align: bottom; ' + \ | 194 | padding-bottom: 0.5em; |
915 | 186 | 'font-family: Arial; font-size: 40pt; color: #FFFFFF; line-height: 108%; margin: 0;padding: 0; ' + \ | 195 | padding-left: 2px; |
916 | 187 | 'padding-bottom: 0.5em; padding-left: 2px; width: 1580px; height: 810px; font-style:italic; font-weight:bold; ' | 196 | width: 1580px; |
917 | 197 | height: 810px; | ||
918 | 198 | font-style: italic; | ||
919 | 199 | font-weight: bold; | ||
920 | 200 | """ | ||
921 | 188 | FOOTER_CSS_BASE = """ | 201 | FOOTER_CSS_BASE = """ |
922 | 189 | left: 10px; | 202 | left: 10px; |
923 | 190 | bottom: 0px; | 203 | bottom: 0px; |
Looks good but one comment which is general across all the code.