CodecForTr was dropped in Qt5

The deletion of songs still depended on that.

Just a minor edit to drop the dependency

bzr-revno: 2590
This commit is contained in:
simon.hanna@serve-me.info 2016-01-08 17:24:48 +00:00 committed by Tim Bentley
commit a6ef19683d
3 changed files with 19 additions and 4 deletions

View File

@ -190,8 +190,7 @@ class CustomMediaItem(MediaManagerItem):
if QtWidgets.QMessageBox.question( if QtWidgets.QMessageBox.question(
self, UiStrings().ConfirmDelete, self, UiStrings().ConfirmDelete,
translate('CustomPlugin.MediaItem', translate('CustomPlugin.MediaItem',
'Are you sure you want to delete the %n selected custom slide(s)?', 'Are you sure you want to delete the "%d" selected custom slide(s)?') %len(items),
'', QtCore.QCoreApplication.CodecForTr, len(items)),
QtWidgets.QMessageBox.StandardButtons( QtWidgets.QMessageBox.StandardButtons(
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No: QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No:

View File

@ -363,8 +363,8 @@ class SongMediaItem(MediaManagerItem):
items = self.list_view.selectedIndexes() items = self.list_view.selectedIndexes()
if QtWidgets.QMessageBox.question( if QtWidgets.QMessageBox.question(
self, UiStrings().ConfirmDelete, self, UiStrings().ConfirmDelete,
translate('SongsPlugin.MediaItem', 'Are you sure you want to delete the %n selected song(s)?', '', translate('SongsPlugin.MediaItem',
QtCore.QCoreApplication.CodecForTr, len(items)), 'Are you sure you want to delete the "%d" selected song(s)?') % len(items),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No), QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No: QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No:
return return

View File

@ -60,6 +60,22 @@ class TestMediaManagerItem(TestCase, TestMixin):
# THEN: on_preview_click() should have been called # THEN: on_preview_click() should have been called
mocked_on_preview_click.assert_called_with() mocked_on_preview_click.assert_called_with()
def required_icons_test(self):
"""
Test the default icons for plugins
"""
# GIVEN: A MediaManagerItem
mmi = MediaManagerItem(None)
# WHEN: Object is created
mmi.required_icons()
# THEN: Default icons should be populated
self.assertFalse(mmi.has_import_icon, 'There should be no import icon by default')
self.assertTrue(mmi.has_new_icon, 'By default a new icon should be present')
self.assertFalse(mmi.has_file_icon, 'There should be no file icon by default')
self.assertTrue(mmi.has_delete_icon, 'By default a delete icon should be present')
self.assertFalse(mmi.add_to_service_item, 'There should be no add_to_service icon by default')
@patch(u'openlp.core.lib.mediamanageritem.Settings') @patch(u'openlp.core.lib.mediamanageritem.Settings')
@patch(u'openlp.core.lib.mediamanageritem.MediaManagerItem.on_live_click') @patch(u'openlp.core.lib.mediamanageritem.MediaManagerItem.on_live_click')
def on_double_clicked_go_live_test(self, mocked_on_live_click, MockedSettings): def on_double_clicked_go_live_test(self, mocked_on_live_click, MockedSettings):