From c10f71db3a260963c8e061ded78e783cb8478be9 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 20 Jul 2016 22:43:46 +0200 Subject: [PATCH] Started work on chords on maindisplay. --- openlp/core/lib/__init__.py | 8 +++----- openlp/core/lib/htmlbuilder.py | 26 ++++++++++++++++++++++++ openlp/core/lib/renderer.py | 4 ++-- openlp/core/lib/serviceitem.py | 13 ++++-------- openlp/plugins/remotes/html/js/chords.js | 20 +++++++++--------- openlp/plugins/remotes/lib/httprouter.py | 7 ++----- openlp/plugins/songs/lib/mediaitem.py | 3 --- 7 files changed, 47 insertions(+), 34 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 1990b5b90..7d4bcb762 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -301,15 +301,13 @@ def clean_tags(text, chords=False): return text -def expand_tags(text, chords=False): +def expand_tags(text): """ Expand tags HTML for display :param text: The text to be expanded. - :param chords: Convert ChordPro tags to html """ - if chords: - text = expand_chords(text) + text = expand_chords(text) for tag in FormattingTags.get_html_tags(): text = text.replace(tag['start tag'], tag['start html']) text = text.replace(tag['end tag'], tag['end html']) @@ -328,7 +326,7 @@ def expand_chords(text): # If a ChordPro is detected in the line, replace it with a html-span tag and wrap the line in a span tag. if '[' in line and ']' in line: new_line = '' - new_line += re.sub(r'(.*?)\[(.+?)\](.*?)', r'\1\3', line) + new_line += re.sub(r'(.*?)\[(.+?)\](.*?)', r'\1\2\3', line) new_line += '' expanded_text_lines.append(new_line) else: diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 6f2fee68c..bdcc0ed32 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -444,6 +444,32 @@ HTML_SRC = Template(""" position: relative; top: -0.3em; } + #chords { + /*font-size: 20pt; + color: gray; + background-color: gray; + color: white; + cursor: pointer;*/ + } + .chordline { + line-height: 2.0; + } + .chordline1 { + line-height: 1.0 + } + .chordline span.chord span { + position: relative; + } + .chordline span.chord span strong { + position: absolute; + top: -1em; + left: 0; + font-size: 75%; + font-weight: normal; + line-height: normal; + /*font: 30pt sans-serif; + color: yellow;*/ + }