Fix presentation load from service file

This commit is contained in:
Tomas Groth 2020-04-02 20:24:58 +00:00
parent d451f21c0b
commit d1b051807b
5 changed files with 6 additions and 19 deletions

View File

@ -15,14 +15,14 @@ environment:
install:
# Install dependencies from pypi
- "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF==1.16.7 QDarkStyle python-vlc Pyro4 zeroconf flask-cors pytest-qt"
- "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF==1.16.7 QDarkStyle python-vlc Pyro4 zeroconf flask-cors pytest-qt pyenchant"
build: off
test_script:
- cd %APPVEYOR_BUILD_FOLDER%
# Run the tests
- "%PYTHON%\\python.exe -m pytest -v tests"
- "%PYTHON%\\python.exe -m pytest tests"
# Go back to the user root folder
- cd..

View File

@ -315,7 +315,6 @@ class Settings(QtCore.QSettings):
'songs/songselect searches': '',
'songs/enable chords': True,
'songs/chord notation': 'english', # Can be english, german or neo-latin
'songs/mainview chords': False,
'songs/disable chords import': False,
'songusage/status': PluginStatus.Inactive,
'songusage/db type': 'sqlite',

View File

@ -87,7 +87,8 @@ class PresentationMediaItem(MediaManagerItem):
for file_type in file_types:
if file_type not in file_type_string:
file_type_string += '*.{text} '.format(text=file_type)
self.service_manager.supported_suffixes(file_type)
file_type_string = file_type_string.strip()
self.service_manager.supported_suffixes(file_type_string.split(' '))
self.on_new_file_masks = translate('PresentationPlugin.MediaItem',
'Presentations ({text})').format(text=file_type_string)

View File

@ -62,9 +62,6 @@ class SongsTab(SettingsTab):
self.chords_info_label = QtWidgets.QLabel(self.chords_group_box)
self.chords_info_label.setWordWrap(True)
self.chords_layout.addWidget(self.chords_info_label)
self.mainview_chords_check_box = QtWidgets.QCheckBox(self.mode_group_box)
self.mainview_chords_check_box.setObjectName('mainview_chords_check_box')
self.chords_layout.addWidget(self.mainview_chords_check_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.chords_layout.addWidget(self.disable_chords_import_check_box)
@ -104,7 +101,6 @@ class SongsTab(SettingsTab):
self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_check_box_changed)
self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)
self.songbook_slide_check_box.stateChanged.connect(self.on_songbook_slide_check_box_changed)
self.mainview_chords_check_box.stateChanged.connect(self.on_mainview_chords_check_box_changed)
self.disable_chords_import_check_box.stateChanged.connect(self.on_disable_chords_import_check_box_changed)
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)
@ -123,7 +119,6 @@ class SongsTab(SettingsTab):
self.chords_info_label.setText(translate('SongsPlugin.SongsTab', 'If enabled all text between "[" and "]" will '
'be regarded as chords.'))
self.chords_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Chords'))
self.mainview_chords_check_box.setText(translate('SongsPlugin.SongsTab', 'Display chords in the main view'))
self.disable_chords_import_check_box.setText(translate('SongsPlugin.SongsTab',
'Ignore chords when importing songs'))
self.chord_notation_label.setText(translate('SongsPlugin.SongsTab', 'Chord notation to use:'))
@ -194,9 +189,6 @@ class SongsTab(SettingsTab):
def on_songbook_slide_check_box_changed(self, check_state):
self.songbook_slide = (check_state == QtCore.Qt.Checked)
def on_mainview_chords_check_box_changed(self, check_state):
self.mainview_chords = (check_state == QtCore.Qt.Checked)
def on_disable_chords_import_check_box_changed(self, check_state):
self.disable_chords_import = (check_state == QtCore.Qt.Checked)
@ -220,13 +212,11 @@ class SongsTab(SettingsTab):
self.songbook_slide = self.settings.value('add songbook slide')
self.enable_chords = self.settings.value('enable chords')
self.chord_notation = self.settings.value('chord notation')
self.mainview_chords = self.settings.value('mainview chords')
self.disable_chords_import = self.settings.value('disable chords import')
self.tool_bar_active_check_box.setChecked(self.tool_bar)
self.update_on_edit_check_box.setChecked(self.update_edit)
self.add_from_service_check_box.setChecked(self.update_load)
self.chords_group_box.setChecked(self.enable_chords)
self.mainview_chords_check_box.setChecked(self.mainview_chords)
self.disable_chords_import_check_box.setChecked(self.disable_chords_import)
if self.chord_notation == 'german':
self.german_notation_radio_button.setChecked(True)
@ -243,7 +233,6 @@ class SongsTab(SettingsTab):
self.settings.setValue('update service on edit', self.update_edit)
self.settings.setValue('add song from service', self.update_load)
self.settings.setValue('enable chords', self.chords_group_box.isChecked())
self.settings.setValue('mainview chords', self.mainview_chords)
self.settings.setValue('disable chords import', self.disable_chords_import)
self.settings.setValue('chord notation', self.chord_notation)
# Only save footer template if it has been changed. This allows future updates

View File

@ -90,7 +90,6 @@ def test_save_check_box_settings(form):
form.on_update_on_edit_check_box_changed(QtCore.Qt.Unchecked)
form.on_add_from_service_check_box_changed(QtCore.Qt.Checked)
form.on_songbook_slide_check_box_changed(QtCore.Qt.Unchecked)
form.on_mainview_chords_check_box_changed(QtCore.Qt.Checked)
form.on_disable_chords_import_check_box_changed(QtCore.Qt.Unchecked)
# WHEN: Save is invoked
form.save()
@ -100,7 +99,6 @@ def test_save_check_box_settings(form):
assert form.settings.value('songs/update service on edit') is False
assert form.settings.value('songs/add song from service') is True
assert form.settings.value('songs/add songbook slide') is False
assert form.settings.value('songs/mainview chords') is True
assert form.settings.value('songs/disable chords import') is False
@ -146,7 +144,7 @@ def test_footer_nochange(mocked_settings_set_val, form):
# WHEN: save is invoked
form.save()
# THEN: footer should not have been saved (one less call than the change test below)
assert mocked_settings_set_val.call_count == 8
assert mocked_settings_set_val.call_count == 7
@patch('openlp.core.common.settings.Settings.setValue')
@ -159,7 +157,7 @@ def test_footer_change(mocked_settings_set_val, form):
# WHEN: save is invoked
form.save()
# THEN: footer should have been saved (one more call to setValue than the nochange test)
assert mocked_settings_set_val.call_count == 9
assert mocked_settings_set_val.call_count == 8
assert form.footer_edit_box.toPlainText() == 'A new footer'