forked from openlp/openlp
added option to turn off song key warning
This commit is contained in:
parent
bf9aba52da
commit
7320f2ddc9
@ -342,6 +342,7 @@ class Settings(QtCore.QSettings):
|
|||||||
'songs/songselect password': '',
|
'songs/songselect password': '',
|
||||||
'songs/songselect searches': '',
|
'songs/songselect searches': '',
|
||||||
'songs/enable chords': True,
|
'songs/enable chords': True,
|
||||||
|
'songs/warn about missing song key': True,
|
||||||
'songs/chord notation': 'english', # Can be english, german or neo-latin
|
'songs/chord notation': 'english', # Can be english, german or neo-latin
|
||||||
'songs/disable chords import': False,
|
'songs/disable chords import': False,
|
||||||
'songs/auto play audio': False,
|
'songs/auto play audio': False,
|
||||||
|
@ -258,13 +258,14 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
|||||||
if not self._validate_tags(tags):
|
if not self._validate_tags(tags):
|
||||||
misplaced_tags.append('{field1} {field2}'.format(field1=VerseType.translated_name(field[0]),
|
misplaced_tags.append('{field1} {field2}'.format(field1=VerseType.translated_name(field[0]),
|
||||||
field2=field[1:]))
|
field2=field[1:]))
|
||||||
if Registry().get('settings').value('songs/enable chords') and len(chords) > 0 and \
|
if Registry().get('settings').value('songs/enable chords') and \
|
||||||
not chords[0].startswith("="):
|
Registry().get('settings').value('songs/warn about missing song key') and len(chords) > 0 and \
|
||||||
|
not chords[0].startswith("="):
|
||||||
QtWidgets.QMessageBox.warning(self, translate('SongsPlugin.EditVerseForm', 'Song key warning'),
|
QtWidgets.QMessageBox.warning(self, translate('SongsPlugin.EditVerseForm', 'Song key warning'),
|
||||||
translate('SongsPlugin.EditVerseForm', 'No song key is present or song key '
|
translate('SongsPlugin.EditVerseForm', 'No song key is present or song key '
|
||||||
'is not the first chord.\nFor optimal chord experience, please, '
|
'is not the first chord.\nFor optimal chord experience, please, '
|
||||||
'include a song key\nbefore any chord. Ex.: [=G]'),
|
'include a song key\nbefore any chord. Ex.: [=G]'
|
||||||
QtWidgets.QMessageBox.checkBox)
|
'You can disable this warning message in songs settings.'))
|
||||||
if misplaced_tags:
|
if misplaced_tags:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
message=translate('SongsPlugin.EditSongForm',
|
message=translate('SongsPlugin.EditSongForm',
|
||||||
|
@ -124,13 +124,15 @@ class EditVerseForm(QtWidgets.QDialog, Ui_EditVerseDialog):
|
|||||||
try:
|
try:
|
||||||
lyrics_stripped = re.sub(r'\[---\]', "\n", re.sub(r'---\[.*?\]---', "\n", re.sub(r'\[--}{--\]', "\n",
|
lyrics_stripped = re.sub(r'\[---\]', "\n", re.sub(r'---\[.*?\]---', "\n", re.sub(r'\[--}{--\]', "\n",
|
||||||
self.verse_text_edit.toPlainText())))
|
self.verse_text_edit.toPlainText())))
|
||||||
chords = re.search(r'\[(.*?)\]', lyrics_stripped)
|
chords = re.findall(r'\[(.*?)\]', lyrics_stripped)
|
||||||
if chords and len(chords) > 0 and not chords[1].startswith("="):
|
if Registry().get('settings').value('songs/warn about missing song key') and chords and len(chords) > 0 and\
|
||||||
|
not chords[0].startswith("="):
|
||||||
QtWidgets.QMessageBox.warning(self, translate('SongsPlugin.EditVerseForm', 'Song key warning'),
|
QtWidgets.QMessageBox.warning(self, translate('SongsPlugin.EditVerseForm', 'Song key warning'),
|
||||||
translate('SongsPlugin.EditVerseForm',
|
translate('SongsPlugin.EditVerseForm',
|
||||||
'No song key is present or song key is not the first '
|
'No song key is present or song key is not the first '
|
||||||
'chord.\nFor optimal chord experience, please, include a '
|
'chord.\nFor optimal chord experience, please, include a '
|
||||||
'song key\nbefore any chord. Ex.: [=G]'))
|
'song key\nbefore any chord. Ex.: [=G]\n'
|
||||||
|
'You can disable this warning message in songs settings.'))
|
||||||
transposed_lyrics = transpose_lyrics(self.verse_text_edit.toPlainText(), 1)
|
transposed_lyrics = transpose_lyrics(self.verse_text_edit.toPlainText(), 1)
|
||||||
self.verse_text_edit.setPlainText(transposed_lyrics)
|
self.verse_text_edit.setPlainText(transposed_lyrics)
|
||||||
except KeyError as ke:
|
except KeyError as ke:
|
||||||
@ -150,13 +152,15 @@ class EditVerseForm(QtWidgets.QDialog, Ui_EditVerseDialog):
|
|||||||
try:
|
try:
|
||||||
lyrics_stripped = re.sub(r'\[---\]', "\n", re.sub(r'---\[.*?\]---', "\n", re.sub(r'\[--}{--\]', "\n",
|
lyrics_stripped = re.sub(r'\[---\]', "\n", re.sub(r'---\[.*?\]---', "\n", re.sub(r'\[--}{--\]', "\n",
|
||||||
self.verse_text_edit.toPlainText())))
|
self.verse_text_edit.toPlainText())))
|
||||||
chords = re.search(r'\[(.*?)\]', lyrics_stripped)
|
chords = re.findall(r'\[(.*?)\]', lyrics_stripped)
|
||||||
if chords and len(chords) > 0 and not chords[1].startswith("="):
|
if Registry().get('settings').value('songs/warn about missing song key') and chords and len(chords) > 0 and\
|
||||||
|
not chords[0].startswith("="):
|
||||||
QtWidgets.QMessageBox.warning(self, translate('SongsPlugin.EditVerseForm', 'Song key warning'),
|
QtWidgets.QMessageBox.warning(self, translate('SongsPlugin.EditVerseForm', 'Song key warning'),
|
||||||
translate('SongsPlugin.EditVerseForm',
|
translate('SongsPlugin.EditVerseForm',
|
||||||
'No song key is present or song key is not the first '
|
'No song key is present or song key is not the first '
|
||||||
'chord.\nFor optimal chord experience, please, include a '
|
'chord.\nFor optimal chord experience, please, include a '
|
||||||
'song key\nbefore any chord. Ex.: [=G]'))
|
'song key\nbefore any chord. Ex.: [=G]\n'
|
||||||
|
'You can disable this warning message in songs settings.'))
|
||||||
transposed_lyrics = transpose_lyrics(self.verse_text_edit.toPlainText(), -1)
|
transposed_lyrics = transpose_lyrics(self.verse_text_edit.toPlainText(), -1)
|
||||||
self.verse_text_edit.setPlainText(transposed_lyrics)
|
self.verse_text_edit.setPlainText(transposed_lyrics)
|
||||||
except KeyError as ke:
|
except KeyError as ke:
|
||||||
|
@ -67,7 +67,10 @@ class SongsTab(SettingsTab):
|
|||||||
self.chords_layout.addWidget(self.chords_info_label)
|
self.chords_layout.addWidget(self.chords_info_label)
|
||||||
self.disable_chords_import_check_box = QtWidgets.QCheckBox(self.mode_group_box)
|
self.disable_chords_import_check_box = QtWidgets.QCheckBox(self.mode_group_box)
|
||||||
self.disable_chords_import_check_box.setObjectName('disable_chords_import_check_box')
|
self.disable_chords_import_check_box.setObjectName('disable_chords_import_check_box')
|
||||||
|
self.song_key_warning_check_box = QtWidgets.QCheckBox(self.mode_group_box)
|
||||||
|
self.song_key_warning_check_box.setObjectName('song_key_warning_checkbox')
|
||||||
self.chords_layout.addWidget(self.disable_chords_import_check_box)
|
self.chords_layout.addWidget(self.disable_chords_import_check_box)
|
||||||
|
self.chords_layout.addWidget(self.song_key_warning_check_box)
|
||||||
|
|
||||||
# Chords notation group box
|
# Chords notation group box
|
||||||
self.chord_notation_label = QtWidgets.QLabel(self.chords_group_box)
|
self.chord_notation_label = QtWidgets.QLabel(self.chords_group_box)
|
||||||
@ -128,6 +131,7 @@ class SongsTab(SettingsTab):
|
|||||||
self.songbook_slide_check_box.stateChanged.connect(self.on_songbook_slide_check_box_changed)
|
self.songbook_slide_check_box.stateChanged.connect(self.on_songbook_slide_check_box_changed)
|
||||||
self.auto_play_check_box.stateChanged.connect(self.on_auto_play_check_box_changed)
|
self.auto_play_check_box.stateChanged.connect(self.on_auto_play_check_box_changed)
|
||||||
self.disable_chords_import_check_box.stateChanged.connect(self.on_disable_chords_import_check_box_changed)
|
self.disable_chords_import_check_box.stateChanged.connect(self.on_disable_chords_import_check_box_changed)
|
||||||
|
self.song_key_warning_check_box.stateChanged.connect(self.on_song_key_warning_check_box_changed)
|
||||||
self.english_notation_radio_button.clicked.connect(self.on_english_notation_button_clicked)
|
self.english_notation_radio_button.clicked.connect(self.on_english_notation_button_clicked)
|
||||||
self.german_notation_radio_button.clicked.connect(self.on_german_notation_button_clicked)
|
self.german_notation_radio_button.clicked.connect(self.on_german_notation_button_clicked)
|
||||||
self.neolatin_notation_radio_button.clicked.connect(self.on_neolatin_notation_button_clicked)
|
self.neolatin_notation_radio_button.clicked.connect(self.on_neolatin_notation_button_clicked)
|
||||||
@ -156,6 +160,7 @@ class SongsTab(SettingsTab):
|
|||||||
self.german_notation_radio_button.setText(translate('SongsPlugin.SongsTab', 'German') + ' (C-D-E-F-G-A-H)')
|
self.german_notation_radio_button.setText(translate('SongsPlugin.SongsTab', 'German') + ' (C-D-E-F-G-A-H)')
|
||||||
self.neolatin_notation_radio_button.setText(
|
self.neolatin_notation_radio_button.setText(
|
||||||
translate('SongsPlugin.SongsTab', 'Neo-Latin') + ' (Do-Re-Mi-Fa-Sol-La-Si)')
|
translate('SongsPlugin.SongsTab', 'Neo-Latin') + ' (Do-Re-Mi-Fa-Sol-La-Si)')
|
||||||
|
self.song_key_warning_check_box.setText(translate('SongsPlugin.SongsTab', 'Warn about missing song key'))
|
||||||
self.footer_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Footer'))
|
self.footer_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Footer'))
|
||||||
# Keep this in sync with the list in mediaitem.py
|
# Keep this in sync with the list in mediaitem.py
|
||||||
const = '<code>"{}"</code>'
|
const = '<code>"{}"</code>'
|
||||||
@ -224,6 +229,9 @@ class SongsTab(SettingsTab):
|
|||||||
def on_disable_chords_import_check_box_changed(self, check_state):
|
def on_disable_chords_import_check_box_changed(self, check_state):
|
||||||
self.disable_chords_import = (check_state == QtCore.Qt.Checked)
|
self.disable_chords_import = (check_state == QtCore.Qt.Checked)
|
||||||
|
|
||||||
|
def on_song_key_warning_check_box_changed(self, check_state):
|
||||||
|
self.song_key_warning = (check_state == QtCore.Qt.Checked)
|
||||||
|
|
||||||
def on_english_notation_button_clicked(self):
|
def on_english_notation_button_clicked(self):
|
||||||
self.chord_notation = 'english'
|
self.chord_notation = 'english'
|
||||||
|
|
||||||
@ -245,11 +253,13 @@ class SongsTab(SettingsTab):
|
|||||||
self.enable_chords = self.settings.value('songs/enable chords')
|
self.enable_chords = self.settings.value('songs/enable chords')
|
||||||
self.chord_notation = self.settings.value('songs/chord notation')
|
self.chord_notation = self.settings.value('songs/chord notation')
|
||||||
self.disable_chords_import = self.settings.value('songs/disable chords import')
|
self.disable_chords_import = self.settings.value('songs/disable chords import')
|
||||||
|
self.song_key_warning = self.settings.value('songs/warn about missing song key')
|
||||||
self.tool_bar_active_check_box.setChecked(self.tool_bar)
|
self.tool_bar_active_check_box.setChecked(self.tool_bar)
|
||||||
self.update_on_edit_check_box.setChecked(self.update_edit)
|
self.update_on_edit_check_box.setChecked(self.update_edit)
|
||||||
self.add_from_service_check_box.setChecked(self.update_load)
|
self.add_from_service_check_box.setChecked(self.update_load)
|
||||||
self.chords_group_box.setChecked(self.enable_chords)
|
self.chords_group_box.setChecked(self.enable_chords)
|
||||||
self.disable_chords_import_check_box.setChecked(self.disable_chords_import)
|
self.disable_chords_import_check_box.setChecked(self.disable_chords_import)
|
||||||
|
self.song_key_warning_check_box.setChecked(self.song_key_warning)
|
||||||
if self.chord_notation == 'german':
|
if self.chord_notation == 'german':
|
||||||
self.german_notation_radio_button.setChecked(True)
|
self.german_notation_radio_button.setChecked(True)
|
||||||
elif self.chord_notation == 'neo-latin':
|
elif self.chord_notation == 'neo-latin':
|
||||||
@ -267,6 +277,7 @@ class SongsTab(SettingsTab):
|
|||||||
self.settings.setValue('songs/auto play audio', self.auto_play)
|
self.settings.setValue('songs/auto play audio', self.auto_play)
|
||||||
self.settings.setValue('songs/enable chords', self.chords_group_box.isChecked())
|
self.settings.setValue('songs/enable chords', self.chords_group_box.isChecked())
|
||||||
self.settings.setValue('songs/disable chords import', self.disable_chords_import)
|
self.settings.setValue('songs/disable chords import', self.disable_chords_import)
|
||||||
|
self.settings.setValue('songs/warn about missing song key', self.song_key_warning)
|
||||||
self.settings.setValue('songs/chord notation', self.chord_notation)
|
self.settings.setValue('songs/chord notation', self.chord_notation)
|
||||||
self.settings.setValue('songs/songselect username', self.ccli_username.text())
|
self.settings.setValue('songs/songselect username', self.ccli_username.text())
|
||||||
# Only save password if it's blank or the user acknowleges the warning
|
# Only save password if it's blank or the user acknowleges the warning
|
||||||
|
Loading…
Reference in New Issue
Block a user