Attempt to get Bibles to work properly.

Merge from HEAD
This commit is contained in:
Raoul Snyman 2010-03-13 23:48:04 +02:00
commit 7da00bc26f
12 changed files with 32 additions and 29 deletions

View File

@ -216,6 +216,8 @@ class ServiceManager(QtGui.QWidget):
def contextMenu(self, point):
item = self.ServiceManagerList.itemAt(point)
if item is None:
return
if item.parent() is None:
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:

View File

@ -177,20 +177,20 @@ class ThemeManager(QtGui.QWidget):
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('You are unable to delete the default theme!'),
self.trUtf8('You are unable to delete the default theme.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
else:
for plugin in self.parent.plugin_manager.plugins:
if not plugin.can_delete_theme(theme):
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('theme %s is use in %s plugin' % (theme, plugin.name)),
self.trUtf8('Theme %s is use in %s plugin' % (theme, plugin.name)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return
if unicode(self.parent.ServiceManagerContents.ThemeComboBox.currentText()) == theme:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('theme %s is use Service Manager' % theme),
self.trUtf8('Theme %s is use by Service Manager' % theme),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return
self.themelist.remove(theme)
@ -216,7 +216,7 @@ class ThemeManager(QtGui.QWidget):
item = self.ThemeListWidget.currentItem()
if item is None:
QtGui.QMessageBox.critical(self, self.trUtf8('Error'),
self.trUtf8('You have not selected a theme!'),
self.trUtf8('You have not selected a theme.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return
theme = unicode(item.data(QtCore.Qt.UserRole).toString())
@ -359,7 +359,7 @@ class ThemeManager(QtGui.QWidget):
except:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('File is not a valid theme!'),
self.trUtf8('File is not a valid theme.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
log.exception(u'Importing theme from zip file failed %s' % filename)
finally:

View File

@ -85,7 +85,7 @@ class AlertEditForm(QtGui.QDialog, Ui_AlertEditDialog):
if self.AlertLineEdit.text():
QtGui.QMessageBox.information(self,
self.trUtf8('Item selected to Edit'),
self.trUtf8('Please Save or Clear seletced item'))
self.trUtf8('Please save or clear selected item'))
else:
self.EditButton.setEnabled(True)
self.DeleteButton.setEnabled(True)

View File

@ -93,7 +93,6 @@ class BiblePlugin(Plugin):
'displayed on the screen during the service.')
return about_text
def can_delete_theme(self, theme):
if self.settings_tab.bible_theme == theme:
return False

View File

@ -111,7 +111,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid Bible Location'),
self.trUtf8('You need to specify a file to import your '
'Bible from!'),
'Bible from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OSISLocationEdit.setFocus()
return False
@ -120,7 +120,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid Books File'),
self.trUtf8('You need to specify a file with books of '
'the Bible to use in the import!'),
'the Bible to use in the import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.BooksLocationEdit.setFocus()
return False
@ -128,7 +128,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid Verse File'),
self.trUtf8('You need to specify a file of Bible '
'verses to import!'),
'verses to import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CsvVerseLocationEdit.setFocus()
return False
@ -137,7 +137,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid OpenSong Bible'),
self.trUtf8('You need to specify an OpenSong Bible '
'file to import!'),
'file to import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongFileEdit.setFocus()
return False
@ -148,7 +148,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
QtGui.QMessageBox.critical(self,
self.trUtf8('Empty Version Name'),
self.trUtf8('You need to specify a version name for your '
'Bible!'),
'Bible.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus()
return False

View File

@ -124,7 +124,8 @@ class BibleManager(object):
self.db_cache = {}
for filename in files:
name, extension = os.path.splitext(filename)
self.db_cache[name] = BibleDB(self.parent, path=self.path, name=name, config=self.config)
self.db_cache[name] = BibleDB(self.parent, path=self.path,
name=name, config=self.config)
# look to see if lazy load bible exists and get create getter.
source = self.db_cache[name].get_meta(u'download source')
if source:

View File

@ -45,6 +45,7 @@ class BibleListView(BaseListWithDnD):
def resizeEvent(self, event):
self.parent.onListViewResize(event.size().width(), event.size().width())
class BibleMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Bibles.
@ -452,14 +453,14 @@ class BibleMediaItem(MediaManagerItem):
for item in items:
bitem = self.ListView.item(item.row())
reference = bitem.data(QtCore.Qt.UserRole).toPyObject()
bible = unicode(reference[QtCore.QString('bible')])
book = unicode(reference[QtCore.QString('book')])
chapter = unicode(reference[QtCore.QString('chapter')])
verse = unicode(reference[QtCore.QString('verse')])
text = unicode(reference[QtCore.QString('text')])
version = unicode(reference[QtCore.QString('version')])
copyright = unicode(reference[QtCore.QString('copyright')])
permission = unicode(reference[QtCore.QString('permission')])
bible = unicode(reference[QtCore.QString('bible')].toPyObject())
book = unicode(reference[QtCore.QString('book')].toPyObject())
chapter = unicode(reference[QtCore.QString('chapter')].toPyObject())
verse = unicode(reference[QtCore.QString('verse')].toPyObject())
text = unicode(reference[QtCore.QString('text')].toPyObject())
version = unicode(reference[QtCore.QString('version')].toPyObject())
copyright = unicode(reference[QtCore.QString('copyright')].toPyObject())
permission = unicode(reference[QtCore.QString('permission')].toPyObject())
if self.parent.settings_tab.display_style == 1:
verse_text = self.formatVerse(old_chapter, chapter, verse, u'(u', u')')
elif self.parent.settings_tab.display_style == 2:
@ -563,7 +564,7 @@ class BibleMediaItem(MediaManagerItem):
permission = u''
else:
permission = permission.value
for count, verse in enumerate(self.search_results):
for count, verse in enumerate(self.search_results):
bible_text = u' %s %d:%d (%s)' % \
(verse.book.name, verse.chapter, verse.verse, bible)
bible_verse = QtGui.QListWidgetItem(bible_text)

View File

@ -69,7 +69,7 @@ class CustomPlugin(Plugin):
def about(self):
about_text = self.trUtf8('<b>Custom Plugin</b><br>This plugin '
'allows slides to be displayed on the screen in the same way '
'songs are. This plugin provides greater freedom over the '
'songs are. This plugin provides greater freedom over the '
'songs plugin.<br>')
return about_text

View File

@ -61,7 +61,7 @@ class ImageMediaItem(MediaManagerItem):
def retranslateUi(self):
self.OnNewPrompt = self.trUtf8('Select Image(s)')
self.OnNewFileMasks = \
self.trUtf8('Images (*.jpg *jpeg *.gif *.png *.bmp);; All files (*)')
self.trUtf8('Images (*.jpg *.jpeg *.gif *.png *.bmp);; All files (*)')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -101,7 +101,7 @@ class ImageMediaItem(MediaManagerItem):
self.OverrideCheckBox.setChecked(False)
self.OverrideCheckBox.setText(self.trUtf8('Override background'))
self.OverrideCheckBox.setStatusTip(
self.trUtf8('Allow background of live slide to be overridden'))
self.trUtf8('Allow the background of live slide to be overridden'))
self.OverrideLayout.addWidget(self.OverrideCheckBox)
self.OverrideLabel = QtGui.QLabel(self.ImageWidget)
self.OverrideLabel.setObjectName(u'OverrideLabel')

View File

@ -114,6 +114,6 @@ class PresentationPlugin(Plugin):
def about(self):
about_text = self.trUtf8('<b>Presentation Plugin</b> <br> Delivers '
'the ability to show presentations using a number of different '
'programs. The choice of available presentation programs is '
'programs. The choice of available presentation programs is '
'available to the user in a drop down box.')
return about_text

View File

@ -41,8 +41,8 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
def accept(self):
ret = QtGui.QMessageBox.question(self,
self.trUtf8('Delete Selected Audit Events?'),
self.trUtf8('Are you sure you want to delete selected Audit Data?'),
self.trUtf8('Delete Selected Song Usage Events?'),
self.trUtf8('Are you sure you want to delete selected Song Usage data?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok |
QtGui.QMessageBox.Cancel),

View File

@ -81,7 +81,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
instance.copyright, instance.ccl_number , instance.authors)
file.write(record)
except:
log.exception(u'Failed to write out audit records')
log.exception(u'Failed to write out song usage records')
finally:
if file:
file.close()