~alisonken1/openlp/pjlink2-f

« back to all changes in this revision

Viewing changes to openlp/core/lib/htmlbuilder.py

  • Committer: Tim Bentley
  • Author(s): Tomas Groth
  • Date: 2017-05-17 20:30:47 UTC
  • mfrom: (2587.3.78 chords)
  • Revision ID: tim.bentley@gmail.com-20170517203047-o11dl9bfu3re2tu0
Added support for chords in Chord Pro format (using brackets), with support for chord transposing and 3 different notations.
Added support for import of song in ChordPro file format
Added support for importing chords and verseorder from songbeamer.
Add support for export and import of chords in openlyrics
Added support for importing chords from opensong.
Added support for importing chords from videopsalm.
Added support for printing chords.

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
            position: relative;
125
125
            top: -0.3em;
126
126
        }
 
127
        /* Chords css */
 
128
        .chordline {
 
129
          line-height: 1.0em;
 
130
        }
 
131
        .chordline span.chord span {
 
132
          position: relative;
 
133
        }
 
134
        .chordline span.chord span strong {
 
135
          position: absolute;
 
136
          top: -0.8em;
 
137
          left: 0;
 
138
          font-size: 75%;
 
139
          font-weight: normal;
 
140
          line-height: normal;
 
141
          display: none;
 
142
        }
 
143
        .firstchordline {
 
144
            line-height: 1.0em;
 
145
        }
127
146
        </style>
128
147
        <script>
129
148
            var timer = null;
444
463
        position: relative;
445
464
        top: -0.3em;
446
465
    }
 
466
    /* Chords css */${chords_css}
447
467
    </style>
448
468
    <script>
449
469
        var timer = null;
592
612
    height: ${height}px;${font_style}${font_weight}
593
613
    """)
594
614
 
 
615
CHORDS_FORMAT = Template("""
 
616
    .chordline {
 
617
      line-height: ${chord_line_height};
 
618
    }
 
619
    .chordline span.chord span {
 
620
      position: relative;
 
621
    }
 
622
    .chordline span.chord span strong {
 
623
      position: absolute;
 
624
      top: -0.8em;
 
625
      left: 0;
 
626
      font-size: 75%;
 
627
      font-weight: normal;
 
628
      line-height: normal;
 
629
      display: ${chords_display};
 
630
    }
 
631
    .firstchordline {
 
632
        line-height: ${first_chord_line_height};
 
633
    }
 
634
    .ws {
 
635
        display: ${chords_display};
 
636
        white-space: pre-wrap;
 
637
    }""")
 
638
 
595
639
 
596
640
def build_html(item, screen, is_live, background, image=None, plugins=None):
597
641
    """
636
680
                               js_additions=js_additions,
637
681
                               bg_image=bgimage_src,
638
682
                               image=image_src,
639
 
                               html_additions=html_additions)
 
683
                               html_additions=html_additions,
 
684
                               chords_css=build_chords_css())
640
685
 
641
686
 
642
687
def webkit_version():
768
813
    return FOOTER_SRC.substitute(left=item.footer.x(), bottom=bottom, width=item.footer.width(),
769
814
                                 family=theme.font_footer_name, size=theme.font_footer_size,
770
815
                                 color=theme.font_footer_color, space=whitespace)
 
816
 
 
817
 
 
818
def build_chords_css():
 
819
    if Settings().value('songs/enable chords') and Settings().value('songs/mainview chords'):
 
820
        chord_line_height = '2.0em'
 
821
        chords_display = 'inline'
 
822
        first_chord_line_height = '2.1em'
 
823
    else:
 
824
        chord_line_height = '1.0em'
 
825
        chords_display = 'none'
 
826
        first_chord_line_height = '1.0em'
 
827
    return CHORDS_FORMAT.substitute(chord_line_height=chord_line_height, chords_display=chords_display,
 
828
                                    first_chord_line_height=first_chord_line_height)