new checkbox "Display verse numbers" instead of option "No Display" in display_style_combo_box

This commit is contained in:
Oliver Wieland 2013-08-11 16:43:27 +02:00
parent 6bebf6a407
commit e474a3ce7d
4 changed files with 42 additions and 17 deletions

View File

@ -48,6 +48,7 @@ __default_settings__ = {
u'bibles/verse layout style': LayoutStyle.VersePerSlide,
u'bibles/book name language': LanguageSelection.Bible,
u'bibles/display brackets': DisplayStyle.NoBrackets,
u'bibles/display verse': True,
u'bibles/display new chapter': False,
u'bibles/second bibles': True,
u'bibles/advanced bible': u'',

View File

@ -60,7 +60,6 @@ class DisplayStyle(object):
Round = 1
Curly = 2
Square = 3
NoDisplay = 4
class LanguageSelection(object):

View File

@ -58,13 +58,16 @@ class BiblesTab(SettingsTab):
self.verse_display_group_box.setObjectName(u'verse_display_group_box')
self.verse_display_layout = QtGui.QFormLayout(self.verse_display_group_box)
self.verse_display_layout.setObjectName(u'verse_display_layout')
self.display_verse_check_box = QtGui.QCheckBox(self.verse_display_group_box)
self.display_verse_check_box.setObjectName(u'verse_display_check_box')
self.verse_display_layout.addRow(self.display_verse_check_box)
self.new_chapters_check_box = QtGui.QCheckBox(self.verse_display_group_box)
self.new_chapters_check_box.setObjectName(u'new_chapters_check_box')
self.verse_display_layout.addRow(self.new_chapters_check_box)
self.display_style_label = QtGui.QLabel(self.verse_display_group_box)
self.display_style_label.setObjectName(u'display_style_label')
self.display_style_combo_box = QtGui.QComboBox(self.verse_display_group_box)
self.display_style_combo_box.addItems([u'', u'', u'', u'', u''])
self.display_style_combo_box.addItems([u'', u'', u'', u''])
self.display_style_combo_box.setObjectName(u'display_style_combo_box')
self.verse_display_layout.addRow(self.display_style_label, self.display_style_combo_box)
self.layout_style_label = QtGui.QLabel(self.verse_display_group_box)
@ -134,6 +137,7 @@ class BiblesTab(SettingsTab):
self.left_layout.addStretch()
self.right_layout.addStretch()
# Signals and slots
self.display_verse_check_box.stateChanged.connect(self.on_display_verse_check_box_changed)
self.new_chapters_check_box.stateChanged.connect(self.on_new_chapters_check_box_changed)
self.display_style_combo_box.activated.connect(self.on_display_style_combo_box_changed)
self.bible_theme_combo_box.activated.connect(self.on_bible_theme_combo_box_changed)
@ -156,6 +160,7 @@ class BiblesTab(SettingsTab):
def retranslateUi(self):
self.verse_display_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'Verse Display'))
self.display_verse_check_box.setText(translate('BiblesPlugin.BiblesTab', 'Display verse numbers'))
self.new_chapters_check_box.setText(translate('BiblesPlugin.BiblesTab', 'Only show new chapter numbers'))
self.layout_style_label.setText(UiStrings().LayoutStyle)
self.display_style_label.setText(UiStrings().DisplayStyle)
@ -171,8 +176,6 @@ class BiblesTab(SettingsTab):
translate('BiblesPlugin.BiblesTab', '{ And }'))
self.display_style_combo_box.setItemText(DisplayStyle.Square,
translate('BiblesPlugin.BiblesTab', '[ And ]'))
self.display_style_combo_box.setItemText(DisplayStyle.NoDisplay,
translate('BiblesPlugin.BiblesTab', 'Hide verse numbers'))
self.change_note_label.setText(translate('BiblesPlugin.BiblesTab',
'Note:\nChanges do not affect verses already in the service.'))
self.bible_second_check_box.setText(translate('BiblesPlugin.BiblesTab', 'Display second Bible verses'))
@ -210,6 +213,14 @@ class BiblesTab(SettingsTab):
def on_language_selection_combo_box_changed(self):
self.language_selection = self.language_selection_combo_box.currentIndex()
def on_display_verse_check_box_changed(self, check_state):
self.display_verse = False
# We have a set value convert to True/False.
if check_state == QtCore.Qt.Checked:
self.display_verse = True
self.check_display_verse()
def on_new_chapters_check_box_changed(self, check_state):
self.show_new_chapters = False
# We have a set value convert to True/False.
@ -301,11 +312,14 @@ class BiblesTab(SettingsTab):
def load(self):
settings = Settings()
settings.beginGroup(self.settings_section)
self.display_verse = settings.value(u'display verse')
self.show_new_chapters = settings.value(u'display new chapter')
self.display_style = settings.value(u'display brackets')
self.layout_style = settings.value(u'verse layout style')
self.bible_theme = settings.value(u'bible theme')
self.second_bibles = settings.value(u'second bibles')
self.display_verse_check_box.setChecked(self.display_verse)
self.check_display_verse()
self.new_chapters_check_box.setChecked(self.show_new_chapters)
self.display_style_combo_box.setCurrentIndex(self.display_style)
self.layout_style_combo_box.setCurrentIndex(self.layout_style)
@ -353,6 +367,7 @@ class BiblesTab(SettingsTab):
def save(self):
settings = Settings()
settings.beginGroup(self.settings_section)
settings.setValue(u'display verse', self.display_verse)
settings.setValue(u'display new chapter', self.show_new_chapters)
settings.setValue(u'display brackets', self.display_style)
settings.setValue(u'verse layout style', self.layout_style)
@ -407,3 +422,12 @@ class BiblesTab(SettingsTab):
color.setAlpha(128)
palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Text, color)
return palette
def check_display_verse(self):
"""
Enables / Disables verse settings dependent on display_verse
"""
self.new_chapters_check_box.setEnabled(self.display_verse)
self.display_style_label.setEnabled(self.display_verse)
self.display_style_combo_box.setEnabled(self.display_verse)

View File

@ -943,19 +943,20 @@ class BibleMediaItem(MediaManagerItem):
The verse number (int).
"""
verse_separator = get_reference_separator(u'sep_v_display')
if not self.settings.show_new_chapters or old_chapter != chapter:
verse_text = unicode(chapter) + verse_separator + unicode(verse)
else:
verse_text = unicode(verse)
if self.settings.display_style == DisplayStyle.Round:
return u'{su}(%s){/su}' % verse_text
elif self.settings.display_style == DisplayStyle.Curly:
return u'{su}{%s}{/su}' % verse_text
elif self.settings.display_style == DisplayStyle.Square:
return u'{su}[%s]{/su}' % verse_text
elif self.settings.display_style == DisplayStyle.NoDisplay:
return u''
return u'{su}%s{/su}' % verse_text
if self.settings.display_verse:
if not self.settings.show_new_chapters or old_chapter != chapter:
verse_text = unicode(chapter) + verse_separator + unicode(verse)
else:
verse_text = unicode(verse)
if self.settings.display_style == DisplayStyle.Round:
return u'{su}(%s){/su}' % verse_text
elif self.settings.display_style == DisplayStyle.Curly:
return u'{su}{%s}{/su}' % verse_text
elif self.settings.display_style == DisplayStyle.Square:
return u'{su}[%s]{/su}' % verse_text
return u'{su}%s{/su}' % verse_text
return u''
def search(self, string, showError):
"""