Fix bug #1216234 by disabling the layout combobox when a second Bible is selected

Fixes: https://launchpad.net/bugs/1216234
This commit is contained in:
Raoul Snyman 2014-01-01 18:02:12 +02:00
parent e4a95be2b8
commit a8999f188a
2 changed files with 16 additions and 5 deletions

View File

@ -39,6 +39,7 @@ from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class BiblesTab(SettingsTab): class BiblesTab(SettingsTab):
""" """
BiblesTab is the Bibles settings tab in the settings dialog. BiblesTab is the Bibles settings tab in the settings dialog.

View File

@ -47,6 +47,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class BibleSearch(object): class BibleSearch(object):
""" """
Enumeration class for the different search methods for the "quick search". Enumeration class for the different search methods for the "quick search".
@ -62,7 +63,6 @@ class BibleMediaItem(MediaManagerItem):
log.info(u'Bible Media Item loaded') log.info(u'Bible Media Item loaded')
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.IconPath = u'songs/song'
self.lockIcon = build_icon(u':/bibles/bibles_search_lock.png') self.lockIcon = build_icon(u':/bibles/bibles_search_lock.png')
self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png') self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png')
MediaManagerItem.__init__(self, parent, plugin, icon) MediaManagerItem.__init__(self, parent, plugin, icon)
@ -180,6 +180,8 @@ class BibleMediaItem(MediaManagerItem):
tab.setVisible(False) tab.setVisible(False)
QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'), QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'),
self.onLockButtonToggled) self.onLockButtonToggled)
QtCore.QObject.connect(secondComboBox, QtCore.SIGNAL(u'currentIndexChanged(QString)'),
self.onSecondBibleComboBoxCurrentIndexChanged)
setattr(self, prefix + u'VersionLabel', versionLabel) setattr(self, prefix + u'VersionLabel', versionLabel)
setattr(self, prefix + u'VersionComboBox', versionComboBox) setattr(self, prefix + u'VersionComboBox', versionComboBox)
setattr(self, prefix + u'SecondLabel', secondLabel) setattr(self, prefix + u'SecondLabel', secondLabel)
@ -299,15 +301,15 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'configUpdated') log.debug(u'configUpdated')
if Settings().value(self.settingsSection + u'/second bibles', if Settings().value(self.settingsSection + u'/second bibles',
QtCore.QVariant(True)).toBool(): QtCore.QVariant(True)).toBool():
self.advancedSecondLabel.setVisible(True)
self.advancedSecondComboBox.setVisible(True)
self.quickSecondLabel.setVisible(True) self.quickSecondLabel.setVisible(True)
self.quickSecondComboBox.setVisible(True) self.quickSecondComboBox.setVisible(True)
self.advancedSecondLabel.setVisible(True)
self.advancedSecondComboBox.setVisible(True)
else: else:
self.advancedSecondLabel.setVisible(False)
self.advancedSecondComboBox.setVisible(False)
self.quickSecondLabel.setVisible(False) self.quickSecondLabel.setVisible(False)
self.quickSecondComboBox.setVisible(False) self.quickSecondComboBox.setVisible(False)
self.advancedSecondLabel.setVisible(False)
self.advancedSecondComboBox.setVisible(False)
self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style) self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style)
self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style) self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style)
@ -542,6 +544,14 @@ class BibleMediaItem(MediaManagerItem):
books.sort(cmp=locale_compare) books.sort(cmp=locale_compare)
set_case_insensitive_completer(books, self.quickSearchEdit) set_case_insensitive_completer(books, self.quickSearchEdit)
def onSecondBibleComboBoxCurrentIndexChanged(self, text):
if text is None or not unicode(text):
self.quickStyleComboBox.setEnabled(True)
self.advancedStyleComboBox.setEnabled(True)
else:
self.quickStyleComboBox.setEnabled(False)
self.advancedStyleComboBox.setEnabled(False)
def onImportClick(self): def onImportClick(self):
if not hasattr(self, u'import_wizard'): if not hasattr(self, u'import_wizard'):
self.import_wizard = BibleImportForm(self, self.plugin.manager, self.import_wizard = BibleImportForm(self, self.plugin.manager,