openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01780
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Bible search fix:
* Add feedback when a book is not found
* Caters for partial file-based bibles e.g. Just one testament
* Prevent an uncaught exception (the previous behaviour)
Fix lack of feedback when editing and deleting media manager items when none are selected
Fix Bible Import Wizard setField errors
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/27664
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2010-06-15 15:22:26 +0000
+++ openlp/core/lib/mediamanageritem.py 2010-06-16 01:58:26 +0000
@@ -325,6 +325,19 @@
"""
pass
+ def checkItemSelected(self, message):
+ """
+ Check if a list item is selected so an action may be performed on it
+
+ ``message``
+ The message to give the user if no item is selected
+ """
+ if not self.ListView.selectedIndexes():
+ QtGui.QMessageBox.information(self,
+ self.trUtf8('No Items Selected'), message)
+ return False
+ return True
+
def onFileClick(self):
files = QtGui.QFileDialog.getOpenFileNames(
self, self.OnNewPrompt,
@@ -392,7 +405,7 @@
if not self.ListView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self,
self.trUtf8('No Items Selected'),
- self.trUtf8('You must select one or more items.'))
+ self.trUtf8('You must select one or more items to preview.'))
else:
log.debug(self.PluginNameShort + u' Preview requested')
service_item = self.buildServiceItem()
@@ -404,7 +417,7 @@
if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self,
self.trUtf8('No Items Selected'),
- self.trUtf8('You must select one or more items.'))
+ self.trUtf8('You must select one or more items to send live.'))
else:
log.debug(self.PluginNameShort + u' Live requested')
service_item = self.buildServiceItem()
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2010-05-01 13:05:17 +0000
+++ openlp/core/lib/plugin.py 2010-06-16 01:58:26 +0000
@@ -231,7 +231,8 @@
Show a dialog when the user clicks on the 'About' button in the plugin
manager.
"""
- pass
+ raise NotImplementedError(
+ u'Plugin.about needs to be defined by the plugin')
def initialise(self):
"""
=== modified file 'openlp/plugins/bibles/forms/importwizardform.py'
--- openlp/plugins/bibles/forms/importwizardform.py 2010-06-15 15:22:26 +0000
+++ openlp/plugins/bibles/forms/importwizardform.py 2010-06-16 01:58:26 +0000
@@ -303,17 +303,20 @@
self.setField(u'csv_versefile', QtCore.QVariant(''))
self.setField(u'opensong_file', QtCore.QVariant(''))
self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
- self.setField(u'web_biblename', QtCore.QVariant(self.BibleComboBox))
+ self.setField(u'web_biblename',
+ QtCore.QVariant(self.BibleComboBox.currentIndex()))
self.setField(u'proxy_server',
settings.value(u'proxy address', QtCore.QVariant(u'')))
self.setField(u'proxy_username',
settings.value(u'proxy username', QtCore.QVariant(u'')))
self.setField(u'proxy_password',
settings.value(u'proxy password', QtCore.QVariant(u'')))
- self.setField(u'license_version', QtCore.QVariant(self.VersionNameEdit))
- self.setField(u'license_copyright', QtCore.QVariant(self.CopyrightEdit))
+ self.setField(u'license_version',
+ QtCore.QVariant(self.VersionNameEdit.text()))
+ self.setField(u'license_copyright',
+ QtCore.QVariant(self.CopyrightEdit.text()))
self.setField(u'license_permission',
- QtCore.QVariant(self.PermissionEdit))
+ QtCore.QVariant(self.PermissionEdit.text()))
self.onLocationComboBoxChanged(WebDownload.Crosswalk)
settings.endGroup()
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2010-06-14 02:42:47 +0000
+++ openlp/plugins/bibles/lib/db.py 2010-06-16 01:58:26 +0000
@@ -29,8 +29,9 @@
import re
from sqlalchemy import or_
-from PyQt4 import QtCore
+from PyQt4 import QtCore, QtGui
+from openlp.core.lib import translate
from openlp.plugins.bibles.lib.models import *
log = logging.getLogger(__name__)
@@ -304,14 +305,22 @@
if db_book:
book = db_book.name
log.debug(u'Book name corrected to "%s"', book)
- verses = self.session.query(Verse)\
- .filter_by(book_id=db_book.id)\
- .filter_by(chapter=chapter)\
- .filter(Verse.verse >= start_verse)\
- .filter(Verse.verse <= end_verse)\
- .order_by(Verse.verse)\
- .all()
- verse_list.extend(verses)
+ verses = self.session.query(Verse)\
+ .filter_by(book_id=db_book.id)\
+ .filter_by(chapter=chapter)\
+ .filter(Verse.verse >= start_verse)\
+ .filter(Verse.verse <= end_verse)\
+ .order_by(Verse.verse)\
+ .all()
+ verse_list.extend(verses)
+ else:
+ log.debug(u'OpenLP failed to find book %s', book)
+ QtGui.QMessageBox.information(self.bible_plugin.media_item,
+ translate(u'BibleDB', u'Book not found'),
+ translate(u'BibleDB', u'The book you requested could not '
+ u'be found in this bible. Please check your spelling '
+ u'and that this is a complete bible not just one '
+ u'testament.'))
return verse_list
def verse_search(self, text):
@@ -383,4 +392,3 @@
log.debug(u'...............................Verses ')
verses = self.session.query(Verse).all()
log.debug(verses)
-
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2010-06-09 21:15:37 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2010-06-16 01:58:26 +0000
@@ -79,7 +79,6 @@
self.hasNewIcon = False
self.hasEditIcon = False
self.hasDeleteIcon = False
- self.addToServiceItem = True
def addEndHeaderBar(self):
self.SearchTabWidget = QtGui.QTabWidget(self)
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2010-06-08 15:38:09 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2010-06-16 01:58:26 +0000
@@ -115,16 +115,24 @@
self.parent.edit_custom_form.exec_()
def onEditClick(self):
- item = self.ListView.currentItem()
- if item:
+ """
+ Edit a custom item
+ """
+ if self.checkItemSelected(translate(u'CustomPlugin.MediaItem',
+ u'You must select an item to edit.')):
+ item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.edit_custom_form.loadCustom(item_id, False)
self.parent.edit_custom_form.exec_()
self.initialise()
def onDeleteClick(self):
- item = self.ListView.currentItem()
- if item:
+ """
+ Remove a custom item from the list and database
+ """
+ if self.checkItemSelected(translate(u'CustomPlugin.MediaItem',
+ u'You must select an item to delete.')):
+ item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.custommanager.delete_custom(item_id)
row = self.ListView.row(item)
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2010-06-15 15:22:26 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2010-06-16 01:58:26 +0000
@@ -116,14 +116,18 @@
self.PageLayout.addWidget(self.ImageWidget)
def onDeleteClick(self):
- items = self.ListView.selectedIndexes()
- if items:
+ """
+ Remove an image item from the list
+ """
+ if self.checkItemSelected(translate(u'ImagePlugin.MediaItem',
+ u'You must select an item to delete.')):
+ items = self.ListView.selectedIndexes()
for item in items:
text = self.ListView.item(item.row())
if text:
try:
- os.remove(
- os.path.join(self.servicePath, unicode(text.text())))
+ os.remove(os.path.join(self.servicePath,
+ unicode(text.text())))
except OSError:
#if not present do not worry
pass
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2010-06-15 15:22:26 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2010-06-16 01:58:26 +0000
@@ -137,8 +137,12 @@
self.settingsSection))
def onDeleteClick(self):
- item = self.ListView.currentItem()
- if item:
+ """
+ Remove a media item from the list
+ """
+ if self.checkItemSelected(translate(u'MediaPlugin.MediaItem',
+ u'You must select an item to delete.')):
+ item = self.ListView.currentItem()
row = self.ListView.row(item)
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
@@ -152,4 +156,3 @@
item_name.setIcon(build_icon(img))
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
self.ListView.addItem(item_name)
-
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2010-06-09 21:15:37 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2010-06-16 01:58:26 +0000
@@ -174,8 +174,12 @@
self.ListView.addItem(item_name)
def onDeleteClick(self):
- item = self.ListView.currentItem()
- if item:
+ """
+ Remove a presentation item from the list
+ """
+ if self.checkItemSelected(translate(u'PresentationPlugin.MediaItem',
+ u'You must select an item to delete.')):
+ item = self.ListView.currentItem()
row = self.ListView.row(item)
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2010-06-15 15:22:26 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2010-06-16 01:58:26 +0000
@@ -275,15 +275,23 @@
self.edit_song_form.exec_()
def onEditClick(self):
- item = self.ListView.currentItem()
- if item:
+ """
+ Edit a song
+ """
+ if self.checkItemSelected(translate(u'SongsPlugin.MediaItem',
+ u'You must select an item to edit.')):
+ item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.edit_song_form.loadSong(item_id, False)
self.edit_song_form.exec_()
def onDeleteClick(self):
- items = self.ListView.selectedIndexes()
- if items:
+ """
+ Remove a song from the list and database
+ """
+ if self.checkItemSelected(translate(u'SongsPlugin.MediaItem',
+ u'You must select an item to delete.')):
+ items = self.ListView.selectedIndexes()
if len(items) == 1:
del_message = translate(u'SongsPlugin.MediaItem',
u'Delete song?')
@@ -371,4 +379,3 @@
song.title, author_audit, song.copyright, song.ccli_number
]
return True
-
Follow ups