This commit is contained in:
Samuel Findlay 2012-05-19 20:49:05 +10:00
commit e28f654b0f
4 changed files with 34 additions and 40 deletions

View File

@ -26,12 +26,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
# Import uuid now, to avoid the rare bug described in the support system:
# http://support.openlp.org/issues/102
# If https://bugs.gentoo.org/show_bug.cgi?id=317557 is fixed, the import can be
# removed.
import uuid
from openlp.core import main

View File

@ -64,6 +64,9 @@ class ServiceManagerList(QtGui.QTreeWidget):
elif event.key() == QtCore.Qt.Key_Down:
self.serviceManager.onMoveSelectionDown()
event.accept()
elif event.key() == QtCore.Qt.Key_Delete:
self.serviceManager.onDeleteFromService()
event.accept()
event.ignore()
else:
event.ignore()
@ -218,6 +221,7 @@ class ServiceManager(QtGui.QWidget):
icon=u':/general/general_delete.png',
tooltip=translate('OpenLP.ServiceManager',
'Delete the selected item from the service.'),
shortcuts=[QtCore.Qt.Key_Delete],
triggers=self.onDeleteFromService)
self.orderToolbar.addSeparator()
self.serviceManagerList.expand = self.orderToolbar.addToolbarAction(
@ -298,17 +302,14 @@ class ServiceManager(QtGui.QWidget):
self.timeAction = create_widget_action(self.menu,
text=translate('OpenLP.ServiceManager', '&Start Time'),
icon=u':/media/media_time.png', triggers=self.onStartTimeForm)
self.deleteAction = create_widget_action(self.menu,
text=translate('OpenLP.ServiceManager', '&Delete From Service'),
icon=u':/general/general_delete.png',
triggers=self.onDeleteFromService)
# Add already existing delete action to the menu.
self.menu.addAction(self.serviceManagerList.delete)
self.menu.addSeparator()
self.previewAction = create_widget_action(self.menu,
text=translate('OpenLP.ServiceManager', 'Show &Preview'),
icon=u':/general/general_preview.png', triggers=self.makePreview)
self.liveAction = create_widget_action(self.menu,
text=translate('OpenLP.ServiceManager', 'Show &Live'),
icon=u':/general/general_live.png', triggers=self.makeLive)
# Add already existing make live action to the menu.
self.menu.addAction(self.serviceManagerList.makeLive)
self.menu.addSeparator()
self.themeMenu = QtGui.QMenu(
translate('OpenLP.ServiceManager', '&Change Item Theme'))
@ -560,14 +561,12 @@ class ServiceManager(QtGui.QWidget):
zip.write(audio_from, audio_to.encode(u'utf-8'))
except IOError:
log.exception(u'Failed to save service to disk: %s', temp_file_name)
# Add this line in after the release to notify the user that saving
# their file failed. Commented out due to string freeze.
#Receiver.send_message(u'openlp_error_message', {
# u'title': translate(u'OpenLP.ServiceManager',
# u'Error Saving File'),
# u'message': translate(u'OpenLP.ServiceManager',
# u'There was an error saving your file.')
#})
Receiver.send_message(u'openlp_error_message', {
u'title': translate(u'OpenLP.ServiceManager',
u'Error Saving File'),
u'message': translate(u'OpenLP.ServiceManager',
u'There was an error saving your file.')
})
success = False
finally:
if zip:
@ -1317,15 +1316,15 @@ class ServiceManager(QtGui.QWidget):
def findServiceItem(self):
"""
Finds the selected ServiceItem in the list and returns the position of
the serviceitem and its selected child item. For example, if the third
child item (in the Slidecontroller known as slide) in the second service
item is selected this will return::
Finds the first selected ServiceItem in the list and returns the
position of the serviceitem and its selected child item. For example,
if the third child item (in the Slidecontroller known as slide) in the
second service item is selected this will return::
(1, 2)
"""
items = self.serviceManagerList.selectedItems()
serviceItem = 0
serviceItem = -1
serviceItemChild = -1
for item in items:
parentitem = item.parent()
@ -1334,8 +1333,10 @@ class ServiceManager(QtGui.QWidget):
else:
serviceItem = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
serviceItemChild = item.data(0, QtCore.Qt.UserRole).toInt()[0]
# Adjust for zero based arrays.
serviceItem -= 1
# Adjust for zero based arrays.
serviceItem -= 1
# Only process the first item on the list for this method.
break
return serviceItem, serviceItemChild
def dragEnterEvent(self, event):

View File

@ -330,13 +330,7 @@ class BibleManager(object):
'Import Wizard to install one or more Bibles.')
})
return None
language_selection = self.get_meta_data(bible, u'book_name_language')
if language_selection:
language_selection = int(language_selection.value)
if language_selection is None or language_selection == -1:
language_selection = QtCore.QSettings().value(
self.settingsSection + u'/bookname language',
QtCore.QVariant(0)).toInt()[0]
language_selection = self.get_language_selection(bible)
reflist = parse_reference(versetext, self.db_cache[bible],
language_selection, book_ref_id)
if reflist:
@ -378,12 +372,16 @@ class BibleManager(object):
"""
log.debug(u'BibleManager.get_language_selection("%s")', bible)
language_selection = self.get_meta_data(bible, u'book_name_language')
if language_selection and language_selection.value != u'None':
return int(language_selection.value)
if language_selection is None or language_selection.value == u'None':
return QtCore.QSettings().value(
if language_selection:
try:
language_selection = int(language_selection.value)
except (ValueError, TypeError):
language_selection = LanguageSelection.Application
if language_selection is None or language_selection == -1:
language_selection = QtCore.QSettings().value(
self.settingsSection + u'/bookname language',
QtCore.QVariant(0)).toInt()[0]
return language_selection
def verse_search(self, bible, second_bible, text):
"""

View File

@ -843,10 +843,11 @@ class BibleMediaItem(MediaManagerItem):
items = []
language_selection = self.plugin.manager.get_language_selection(bible)
for count, verse in enumerate(search_results):
book = None
if language_selection == LanguageSelection.Bible:
book = verse.book.name
elif language_selection == LanguageSelection.Application:
book_names = BibleStrings().Booknames
book_names = BibleStrings().BookNames
data = BiblesResourcesDB.get_book_by_id(
verse.book.book_reference_id)
book = unicode(book_names[data[u'abbreviation']])