small bugfixes

hide entry in tools menu if there are no bibles to upgrade
This commit is contained in:
Armin Köhler 2011-05-15 20:42:08 +02:00
parent b10fbf98eb
commit fbd5349c2f
3 changed files with 12 additions and 5 deletions

View File

@ -28,7 +28,8 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
SettingsManager
from openlp.core.lib.ui import base_action, UiStrings
from openlp.core.utils.actions import ActionList
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
@ -59,7 +60,8 @@ class BiblePlugin(Plugin):
#action_list.add_action(self.exportBibleItem, UiStrings().Export)
# Set to invisible until we can export bibles
self.exportBibleItem.setVisible(False)
self.toolsUpgradeItem.setVisible(True)
if SettingsManager.get_files(u'bibles', u'.sqlite'):
self.toolsUpgradeItem.setVisible(True)
def finalise(self):
"""

View File

@ -422,8 +422,6 @@ class BibleUpgradeForm(OpenLPWizard):
self.customSignals()
self.retranslateUi()
self.maxBibles = len(self.files)
self.finishButton.setVisible(False)
self.cancelButton.setVisible(True)
for number, filename in enumerate(self.files):
self.checkBox[number].setCheckState(QtCore.Qt.Checked)
if os.path.exists(os.path.join(self.newpath, filename)):
@ -439,6 +437,8 @@ class BibleUpgradeForm(OpenLPWizard):
self.deleteAllCheckBox.hide()
self.deleteAllCheckBox.setCheckState(QtCore.Qt.Unchecked)
self.restart()
self.finishButton.setVisible(False)
self.cancelButton.setVisible(True)
settings.endGroup()
def preWizard(self):
@ -469,6 +469,8 @@ class BibleUpgradeForm(OpenLPWizard):
self.maxBibles += 1
number = 0
for biblenumber, filename in enumerate(self.files):
if self.stop_import_flag:
break
bible_failed = False
self.success[biblenumber] = False
if not self.checkBox[biblenumber].checkState() == QtCore.Qt.Checked:
@ -563,6 +565,8 @@ class BibleUpgradeForm(OpenLPWizard):
continue
self.progressBar.setMaximum(len(books))
for book in books:
if self.stop_import_flag:
break
self.incrementProgressBar(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n'
@ -604,6 +608,8 @@ class BibleUpgradeForm(OpenLPWizard):
books = oldbible.get_books()
self.progressBar.setMaximum(len(books))
for book in books:
if self.stop_import_flag:
break
self.incrementProgressBar(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n'

View File

@ -799,7 +799,6 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
log.debug(u'BiblesResourcesDB.get_language("%s")', name)
if not isinstance(name, unicode):
name = unicode(name)
name = name.title()
language = BiblesResourcesDB.run_sql(u'SELECT id, name, code FROM '
u'language WHERE name = ? OR code = ?', (name, name.lower()))
if language: