openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00189
[Merge] lp:~trb143/openlp/bugfixes into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bugfixes into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Fixes and New feature time:
- Bibles now can have verse per slide
- Themes can have bold fonts.
- Http biles now tell you when downloading
- Http bibles stop at end of chapter(oops)
--
https://code.launchpad.net/~trb143/openlp/bugfixes/+merge/9546
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2009-07-21 20:04:27 +0000
+++ openlp/core/lib/renderer.py 2009-08-01 18:03:07 +0000
@@ -558,13 +558,15 @@
"""
self.footerFont = QtGui.QFont(self._theme.font_footer_name,
int(self._theme.font_footer_proportion), # size
- QtGui.QFont.Normal, # weight
- 0)# italic
+ int(self._theme.font_footer_weight), # weight
+ 0)# italic
+ self.footerFont.setItalic(int(self._theme.font_footer_italics))
self.footerFont.setPixelSize(int(self._theme.font_footer_proportion))
self.mainFont = QtGui.QFont(self._theme.font_main_name,
int(self._theme.font_main_proportion), # size
- QtGui.QFont.Normal, # weight
+ int(self._theme.font_main_weight), # weight
0)# italic
+ self.mainFont.setItalic(int(self._theme.font_main_italics))
self.mainFont.setPixelSize(int(self._theme.font_main_proportion))
def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False, color=None):
=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py 2009-07-10 13:16:15 +0000
+++ openlp/core/lib/themexmlhandler.py 2009-08-01 19:25:53 +0000
@@ -46,12 +46,16 @@
<name>Arial</name>
<color>#000000</color>
<proportion>30</proportion>
+ <weight>50</weight>
+ <italics>0</italics>
<location override="False" x="0" y="0" width="0" height="0"/>
</font>
<font type="footer">
<name>Arial</name>
<color>#000000</color>
<proportion>12</proportion>
+ <weight>50</weight>
+ <italics>0</italics>
<location override="False" x="0" y="0" width="0" height="0"/>
</font>
<display>
@@ -157,7 +161,7 @@
#Create Filename element
self.child_element(background, u'filename', filename)
- def add_font(self, name, color, proportion, override, fonttype=u'main',
+ def add_font(self, name, color, proportion, override, fonttype=u'main', weight=50, italics=0,
xpos=0, ypos=0, width=0, height=0):
"""
Add a Font.
@@ -177,6 +181,12 @@
``fonttype``
The type of font, ``main`` or ``footer``. Defaults to ``main``.
+ ``weight``
+ The weight of then font Defaults to 50 Normal
+
+ ``italics``
+ Does the font render to italics Defaults to 0 Normal
+
``xpos``
The X position of the text block.
@@ -198,8 +208,10 @@
self.child_element(background, u'color', color)
#Create Proportion name element
self.child_element(background, u'proportion', proportion)
- #Create Proportion name element
- self.child_element(background, u'proportion', proportion)
+ #Create weight name element
+ self.child_element(background, u'weight', weight)
+ #Create italics name element
+ self.child_element(background, u'italics', italics)
#Create Location element
element = self.theme_xml.createElement(u'location')
element.setAttribute(u'override',override)
=== modified file 'openlp/core/ui/amendthemedialog.py'
--- openlp/core/ui/amendthemedialog.py 2009-06-16 18:21:24 +0000
+++ openlp/core/ui/amendthemedialog.py 2009-08-01 18:03:07 +0000
@@ -165,6 +165,16 @@
self.FontMainSizeSpinBox.setMaximum(999)
self.FontMainSizeSpinBox.setObjectName(u'FontMainSizeSpinBox')
self.MainFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontMainSizeSpinBox)
+ self.FontMainWeightComboBox = QtGui.QComboBox(self.FontMainGroupBox)
+ self.FontMainWeightComboBox.setObjectName("FontMainWeightComboBox")
+ self.FontMainWeightComboBox.addItem(QtCore.QString())
+ self.FontMainWeightComboBox.addItem(QtCore.QString())
+ self.FontMainWeightComboBox.addItem(QtCore.QString())
+ self.FontMainWeightComboBox.addItem(QtCore.QString())
+ self.MainFontLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontMainWeightComboBox)
+ self.FontMainWeightLabel = QtGui.QLabel(self.FontMainGroupBox)
+ self.FontMainWeightLabel.setObjectName("FontMainWeightLabel")
+ self.MainFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontMainWeightLabel)
self.MainLeftLayout.addWidget(self.FontMainGroupBox)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.MainLeftLayout.addItem(spacerItem1)
@@ -292,6 +302,16 @@
self.FontFooterSizeSpinBox.setMaximum(999)
self.FontFooterSizeSpinBox.setObjectName(u'FontFooterSizeSpinBox')
self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontFooterSizeSpinBox)
+ self.FontFooterWeightComboBox = QtGui.QComboBox(self.FooterFontGroupBox)
+ self.FontFooterWeightComboBox.setObjectName("FontFooterWeightComboBox")
+ self.FontFooterWeightComboBox.addItem(QtCore.QString())
+ self.FontFooterWeightComboBox.addItem(QtCore.QString())
+ self.FontFooterWeightComboBox.addItem(QtCore.QString())
+ self.FontFooterWeightComboBox.addItem(QtCore.QString())
+ self.FooterFontLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontFooterWeightComboBox)
+ self.FontFooterWeightLabel = QtGui.QLabel(self.FooterFontGroupBox)
+ self.FontFooterWeightLabel.setObjectName("FontFooterWeightLabel")
+ self.FooterFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontFooterWeightLabel)
self.FooterLeftLayout.addWidget(self.FooterFontGroupBox)
spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.FooterLeftLayout.addItem(spacerItem3)
@@ -550,6 +570,11 @@
self.FontMainColorLabel.setText(translate(u'AmendThemeDialog', u'Font Color:'))
self.FontMainSize.setText(translate(u'AmendThemeDialog', u'Size:'))
self.FontMainSizeSpinBox.setSuffix(translate(u'AmendThemeDialog', u'pt'))
+ self.FontMainWeightComboBox.setItemText(0, translate("AmendThemeDialog", u'Normal'))
+ self.FontMainWeightComboBox.setItemText(1, translate("AmendThemeDialog", u'Bold'))
+ self.FontMainWeightComboBox.setItemText(2, translate("AmendThemeDialog", u'Italics'))
+ self.FontMainWeightComboBox.setItemText(3, translate("AmendThemeDialog", u'Bold/Italics'))
+ self.FontMainWeightLabel.setText(translate("AmendThemeDialog", u'Font Weight:'))
self.MainLocationGroupBox.setTitle(translate(u'AmendThemeDialog', u'Display Location'))
self.DefaultLocationLabel.setText(translate(u'AmendThemeDialog', u'Use Default Location:'))
self.FontMainXLabel.setText(translate(u'AmendThemeDialog', u'X Position:'))
@@ -566,6 +591,11 @@
self.FontFooterColorLabel.setText(translate(u'AmendThemeDialog', u'Font Color:'))
self.FontFooterSizeLabel.setText(translate(u'AmendThemeDialog', u'Size:'))
self.FontFooterSizeSpinBox.setSuffix(translate(u'AmendThemeDialog', u'pt'))
+ self.FontFooterWeightComboBox.setItemText(0, translate("AmendThemeDialog", u'Normal'))
+ self.FontFooterWeightComboBox.setItemText(1, translate("AmendThemeDialog", u'Bold'))
+ self.FontFooterWeightComboBox.setItemText(2, translate("AmendThemeDialog", u'Italics'))
+ self.FontFooterWeightComboBox.setItemText(3, translate("AmendThemeDialog", u'Bold/Italics'))
+ self.FontFooterWeightLabel.setText(translate("AmendThemeDialog", u'Font Weight:'))
self.LocationFooterGroupBox.setTitle(translate(u'AmendThemeDialog', u'Display Location'))
self.FontFooterDefaultLabel.setText(translate(u'AmendThemeDialog', u'Use Default Location:'))
self.FontFooterXLabel.setText(translate(u'AmendThemeDialog', u'X Position:'))
=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py 2009-07-14 19:41:44 +0000
+++ openlp/core/ui/amendthemeform.py 2009-08-01 19:25:53 +0000
@@ -53,7 +53,6 @@
QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked)
QtCore.QObject.connect(self.ImageToolButton,
QtCore.SIGNAL(u'pressed()'), self.onImageToolButtonClicked)
-
#Combo boxes
QtCore.QObject.connect(self.BackgroundComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected)
@@ -63,13 +62,17 @@
QtCore.SIGNAL(u'activated(int)'), self.onGradientComboBoxSelected)
QtCore.QObject.connect(self.FontMainComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontMainComboBoxSelected)
+ QtCore.QObject.connect(self.FontMainWeightComboBox,
+ QtCore.SIGNAL(u'activated(int)'), self.onFontMainWeightComboBoxSelected)
QtCore.QObject.connect(self.FontFooterComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontFooterComboBoxSelected)
+ QtCore.QObject.connect(self.FontFooterWeightComboBox,
+ QtCore.SIGNAL(u'activated(int)'), self.onFontFooterWeightComboBoxSelected)
QtCore.QObject.connect(self.HorizontalComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected)
QtCore.QObject.connect(self.VerticalComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected)
-
+ #Spin boxes
QtCore.QObject.connect(self.FontMainSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterSizeSpinBox,
@@ -118,10 +121,12 @@
new_theme.add_font(unicode(self.theme.font_main_name), unicode(self.theme.font_main_color),
unicode(self.theme.font_main_proportion), unicode(self.theme.font_main_override), u'main',
+ unicode(self.theme.font_main_weight), unicode(self.theme.font_main_italics),
unicode(self.theme.font_main_x), unicode(self.theme.font_main_y), unicode(self.theme.font_main_width),
unicode(self.theme.font_main_height))
new_theme.add_font(unicode(self.theme.font_footer_name), unicode(self.theme.font_footer_color),
unicode(self.theme.font_footer_proportion), unicode(self.theme.font_footer_override), u'footer',
+ unicode(self.theme.font_footer_weight), unicode(self.theme.font_footer_italics),
unicode(self.theme.font_footer_x), unicode(self.theme.font_footer_y), unicode(self.theme.font_footer_width),
unicode(self.theme.font_footer_height) )
new_theme.add_display(unicode(self.theme.display_shadow), unicode(self.theme.display_shadow_color),
@@ -159,6 +164,21 @@
self.theme.font_main_name = self.FontMainComboBox.currentFont().family()
self.previewTheme(self.theme)
+ def onFontMainWeightComboBoxSelected(self, value):
+ if value ==0:
+ self.theme.font_main_weight = 50
+ self.theme.font_main_italics = 0
+ elif value == 1:
+ self.theme.font_main_weight = 75
+ self.theme.font_main_italics = 0
+ elif value == 2:
+ self.theme.font_main_weight = 50
+ self.theme.font_main_italics = 1
+ else:
+ self.theme.font_main_weight = 75
+ self.theme.font_main_italics = 1
+ self.previewTheme(self.theme)
+
def onFontMainColorPushButtonClicked(self):
self.theme.font_main_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.font_main_color), self).name()
@@ -217,6 +237,21 @@
self.theme.font_footer_name = self.FontFooterComboBox.currentFont().family()
self.previewTheme(self.theme)
+ def onFontFooterWeightComboBoxSelected(self, value):
+ if value == 0:
+ self.theme.font_footer_weight = 50
+ self.theme.font_footer_italics = 0
+ elif value == 1:
+ self.theme.font_footer_weight = 75
+ self.theme.font_footer_italics = 0
+ elif value == 2:
+ self.theme.font_footer_weight = 50
+ self.theme.font_footer_italics = 1
+ else:
+ self.theme.font_footer_weight = 75
+ self.theme.font_footer_italics = 1
+ self.previewTheme(self.theme)
+
def onFontFooterColorPushButtonClicked(self):
self.theme.font_footer_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.font_footer_color), self).name()
@@ -410,11 +445,28 @@
self.GradientComboBox.setCurrentIndex(2)
self.FontMainSizeSpinBox.setValue(int(self.theme.font_main_proportion))
+ if int(self.theme.font_main_italics) == 0 and int(self.theme.font_main_weight) == 50:
+ self.FontMainWeightComboBox.setCurrentIndex(0)
+ elif int(self.theme.font_main_italics) == 0 and int(self.theme.font_main_weight) == 75:
+ self.FontMainWeightComboBox.setCurrentIndex(1)
+ elif int(self.theme.font_main_italics) == 1 and int(self.theme.font_main_weight) == 50:
+ self.FontMainWeightComboBox.setCurrentIndex(2)
+ else:
+ self.FontMainWeightComboBox.setCurrentIndex(3)
+
self.FontMainXSpinBox.setValue(int(self.theme.font_main_x))
self.FontMainYSpinBox.setValue(int(self.theme.font_main_y))
self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width))
self.FontMainHeightSpinBox.setValue(int(self.theme.font_main_height))
self.FontFooterSizeSpinBox.setValue(int(self.theme.font_footer_proportion))
+ if int(self.theme.font_footer_italics) == 0 and int(self.theme.font_footer_weight) == 50:
+ self.FontFooterWeightComboBox.setCurrentIndex(0)
+ elif int(self.theme.font_footer_italics) == 0 and int(self.theme.font_footer_weight) == 75:
+ self.FontFooterWeightComboBox.setCurrentIndex(1)
+ elif int(self.theme.font_footer_italics) == 1 and int(self.theme.font_footer_weight) == 50:
+ self.FontFooterWeightComboBox.setCurrentIndex(2)
+ else:
+ self.FontFooterWeightComboBox.setCurrentIndex(3)
self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x))
self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y))
self.FontFooterWidthSpinBox.setValue(int(self.theme.font_footer_width))
@@ -529,7 +581,6 @@
else:
self.ShadowColorPushButton.setEnabled(False)
-
def previewTheme(self, theme):
if self.allowPreview:
frame = self.thememanager.generateImage(theme)
=== modified file 'openlp/plugins/bibles/lib/bibleHTTPimpl.py'
--- openlp/plugins/bibles/lib/bibleHTTPimpl.py 2009-07-13 20:11:36 +0000
+++ openlp/plugins/bibles/lib/bibleHTTPimpl.py 2009-08-02 13:44:41 +0000
@@ -96,7 +96,7 @@
chapter - chapter number
"""
log.debug(u'get_bible_chapter %s,%s,%s,%s', version, bookid, bookname, chapter)
- bookname = bookname.replace(u' ', '')
+ bookname = bookname.replace(u' ', u'')
urlstring = u'http://bible.crosswalk.com/OnlineStudyBible/bible.cgi?word=%s+%d&version=%s' % (bookname, chapter, version)
xml_string = self._get_web_text(urlstring, self.proxyurl)
#log.debug(u'Return data %s', xml_string)
@@ -151,8 +151,8 @@
verseText = xml_string[versePos: i]
versePos = i
#print verseText
+ #print self._clean_text(verseText)
bible[verse] = self._clean_text(verseText)
- #bible[verse] = verseText
#log.debug( bible)
return SearchResults(book_title, book_chapter, bible)
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2009-06-16 18:21:24 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2009-07-23 05:17:26 +0000
@@ -56,22 +56,9 @@
self.VerseDisplayLayout = QtGui.QGridLayout(self.VerseDisplayGroupBox)
self.VerseDisplayLayout.setMargin(8)
self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout')
- self.VerseTypeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
- self.VerseTypeWidget.setObjectName(u'VerseTypeWidget')
- self.VerseTypeLayout = QtGui.QHBoxLayout(self.VerseTypeWidget)
- self.VerseTypeLayout.setSpacing(8)
- self.VerseTypeLayout.setMargin(0)
- self.VerseTypeLayout.setObjectName(u'VerseTypeLayout')
- self.VerseRadioButton = QtGui.QRadioButton(self.VerseTypeWidget)
- self.VerseRadioButton.setObjectName(u'VerseRadioButton')
- self.VerseTypeLayout.addWidget(self.VerseRadioButton)
- self.ParagraphRadioButton = QtGui.QRadioButton(self.VerseTypeWidget)
- self.ParagraphRadioButton.setObjectName(u'ParagraphRadioButton')
- self.VerseTypeLayout.addWidget(self.ParagraphRadioButton)
- self.VerseDisplayLayout.addWidget(self.VerseTypeWidget, 0, 0, 1, 1)
self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.NewChaptersCheckBox.setObjectName(u'NewChaptersCheckBox')
- self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 1, 0, 1, 1)
+ self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 0, 0, 1, 1)
self.DisplayStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.DisplayStyleWidget.setObjectName(u'DisplayStyleWidget')
self.DisplayStyleLayout = QtGui.QHBoxLayout(self.DisplayStyleWidget)
@@ -88,7 +75,24 @@
self.DisplayStyleComboBox.addItem(QtCore.QString())
self.DisplayStyleComboBox.addItem(QtCore.QString())
self.DisplayStyleLayout.addWidget(self.DisplayStyleComboBox)
- self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 2, 0, 1, 1)
+ self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 1, 0, 1, 1)
+ self.LayoutStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
+ self.LayoutStyleWidget.setObjectName(u'LayoutStyleWidget')
+ self.LayoutStyleLayout = QtGui.QHBoxLayout(self.LayoutStyleWidget)
+ self.LayoutStyleLayout.setSpacing(8)
+ self.LayoutStyleLayout.setMargin(0)
+ self.LayoutStyleLayout.setObjectName(u'LayoutStyleLayout')
+ self.LayoutStyleLabel = QtGui.QLabel(self.LayoutStyleWidget)
+ self.LayoutStyleLabel.setObjectName(u'LayoutStyleLabel')
+ self.LayoutStyleLayout.addWidget(self.LayoutStyleLabel)
+ self.LayoutStyleComboBox = QtGui.QComboBox(self.LayoutStyleWidget)
+ self.LayoutStyleComboBox.setObjectName(u'LayoutStyleComboBox')
+ self.LayoutStyleComboBox.addItem(QtCore.QString())
+ self.LayoutStyleComboBox.addItem(QtCore.QString())
+ self.LayoutStyleComboBox.addItem(QtCore.QString())
+ self.LayoutStyleLayout.addWidget(self.LayoutStyleComboBox)
+ self.VerseDisplayLayout.addWidget(self.LayoutStyleWidget, 2, 0, 1, 1)
+
self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.BibleThemeWidget.setObjectName(u'BibleThemeWidget')
self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget)
@@ -136,22 +140,22 @@
QtCore.SIGNAL(u'stateChanged(int)'), self.onNewChaptersCheckBoxChanged)
QtCore.QObject.connect(self.BibleSearchCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onBibleSearchCheckBoxChanged)
- QtCore.QObject.connect(self.VerseRadioButton,
- QtCore.SIGNAL(u'pressed()'), self.onVerseRadioButtonPressed)
- QtCore.QObject.connect(self.ParagraphRadioButton,
- QtCore.SIGNAL(u'pressed()'), self.onParagraphRadioButtonPressed)
QtCore.QObject.connect(self.DisplayStyleComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onDisplayStyleComboBoxChanged)
QtCore.QObject.connect(self.BibleThemeComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onBibleThemeComboBoxChanged)
+ QtCore.QObject.connect(self.LayoutStyleComboBox,
+ QtCore.SIGNAL(u'activated(int)'), self.onLayoutStyleComboBoxChanged)
def retranslateUi(self):
self.VerseDisplayGroupBox.setTitle(translate(u'SettingsForm', u'Verse Display'))
- self.VerseRadioButton.setText(translate(u'SettingsForm', u'Verse style'))
- self.ParagraphRadioButton.setText(translate(u'SettingsForm', u'Paragraph style'))
self.NewChaptersCheckBox.setText(translate(u'SettingsForm', u'Only show new chapter numbers'))
+ self.LayoutStyleLabel.setText(translate(u'SettingsForm', u'Layout Style:'))
self.DisplayStyleLabel.setText(translate(u'SettingsForm', u'Display Style:'))
self.BibleThemeLabel.setText(translate(u'SettingsForm', u'Bible Theme:'))
+ self.LayoutStyleComboBox.setItemText(0, translate(u'SettingsForm', u'verse per slide'))
+ self.LayoutStyleComboBox.setItemText(1, translate(u'SettingsForm', u'verse per line'))
+ self.LayoutStyleComboBox.setItemText(2, translate(u'SettingsForm', u'continuous'))
self.DisplayStyleComboBox.setItemText(0, translate(u'SettingsForm', u'No brackets'))
self.DisplayStyleComboBox.setItemText(1, translate(u'SettingsForm', u'( and )'))
self.DisplayStyleComboBox.setItemText(2, translate(u'SettingsForm', u'{ and }'))
@@ -166,11 +170,8 @@
def onDisplayStyleComboBoxChanged(self):
self.display_style = self.DisplayStyleComboBox.currentIndex()
- def onVerseRadioButtonPressed(self):
- self.paragraph_style = False
-
- def onParagraphRadioButtonPressed(self):
- self.paragraph_style = True
+ def onLayoutStyleComboBoxChanged(self):
+ self.layout_style = self.LayoutStyleComboBox.currentIndex()
def onNewChaptersCheckBoxChanged(self):
check_state = self.NewChaptersCheckBox.checkState()
@@ -187,23 +188,20 @@
self.bible_search = True
def load(self):
- self.paragraph_style = str_to_bool(self.config.get_config(u'paragraph style', u'True'))
self.show_new_chapters = str_to_bool(self.config.get_config(u'display new chapter', u'False'))
self.display_style = int(self.config.get_config(u'display brackets', u'0'))
+ self.layout_style = int(self.config.get_config(u'verse layout style', u'0'))
self.bible_theme = self.config.get_config(u'bible theme', u'0')
self.bible_search = str_to_bool(self.config.get_config(u'search as type', u'True'))
- if self.paragraph_style:
- self.ParagraphRadioButton.setChecked(True)
- else:
- self.VerseRadioButton.setChecked(True)
self.NewChaptersCheckBox.setChecked(self.show_new_chapters)
self.DisplayStyleComboBox.setCurrentIndex(self.display_style)
+ self.LayoutStyleComboBox.setCurrentIndex(self.layout_style)
self.BibleSearchCheckBox.setChecked(self.bible_search)
def save(self):
- self.config.set_config(u'paragraph style', unicode(self.paragraph_style))
self.config.set_config(u'display new chapter', unicode(self.show_new_chapters))
self.config.set_config(u'display brackets', unicode(self.display_style))
+ self.config.set_config(u'verse layout style', unicode(self.layout_style))
self.config.set_config(u'search as type', unicode(self.bible_search))
self.config.set_config(u'bible theme', unicode(self.bible_theme))
@@ -220,4 +218,4 @@
# Not Found
id = 0
self.bible_theme = u''
- self.BibleThemeComboBox.setCurrentIndex(id)
\ No newline at end of file
+ self.BibleThemeComboBox.setCurrentIndex(id)
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py 2009-07-18 05:43:50 +0000
+++ openlp/plugins/bibles/lib/manager.py 2009-08-02 13:44:41 +0000
@@ -28,9 +28,7 @@
from bibleCSVimpl import BibleCSVImpl
from bibleDBimpl import BibleDBImpl
from bibleHTTPimpl import BibleHTTPImpl
-
-#from openlp.plugins.bibles.lib.tables import *
-#from openlp.plugins.bibles.lib.classes import *
+from openlp.core.lib import Receiver
class BibleMode(object):
Full = 1
@@ -68,6 +66,15 @@
self.dialogobject = None
self.reload_bibles()
+ def set_media_manager(self, media):
+ """
+ Sets the reference to the media manager.
+
+ ``media``
+ The reference to the media manager.
+ """
+ self.media = media
+
def reload_bibles(self):
log.debug(u'Reload bibles')
files = self.config.get_files(self.bibleSuffix)
@@ -228,8 +235,7 @@
Advanced Search, and when the mode is ``BibleMode.Partial``
this method returns all the bibles for the Quick Search.
- ``mode``
- Defaults to ``BibleMode.Full``. The Bible mode.
+c
"""
log.debug(u'get_bibles')
bible_list = []
@@ -293,17 +299,24 @@
Returns a list of verses for a given Book, Chapter and ranges of verses.
If the end verse(everse) is less then the start verse(sverse)
then only one verse is returned
- bible - Which bible to use.
+
+ ``bible``
+ The name of the bible to be used
+
Rest can be guessed at !
"""
text = []
+ self.media.setQuickMsg1(u'')
+ self.media.setQuickMsg2(u'')
log.debug(u'get_verse_text %s,%s,%s,%s,%s,%s', bible, bookname, schapter, echapter, sverse, everse)
- if not self.bible_http_cache[bible] == None:
- # check to see if book/chapter exists
+ # check to see if book/chapter exists fow HTTP bibles and load cache if necessary
+ if self.bible_http_cache[bible] is not None:
book= self.bible_db_cache[bible].get_bible_book(bookname)
if book == None:
+ self.media.setQuickMsg1(u'Downloading')
log.debug(u'get_verse_text : new book')
- for chapter in range(schapter, echapter+1):
+ for chapter in range(schapter, echapter + 1):
+ self.media.setQuickMsg2(u'%s: %s'% (bookname, chapter))
search_results = self.bible_http_cache [bible].get_bible_chapter(bible, 0, bookname, chapter)
if search_results.has_verselist() :
## We have found a book of the bible lets check to see if it was there.
@@ -325,35 +338,39 @@
## Book exists check chapter and texts only.
v = self.bible_db_cache[bible].get_bible_chapter(book.id, chapter)
if v == None:
+ self.media.setQuickMsg2(u'%s: %s'%(bookname, chapter))
self.bible_db_cache[bible].create_chapter(book.id, \
chapter, \
search_results.get_verselist())
else:
log.debug(u'get_verse_text : old book')
- for chapter in range(schapter, echapter+1):
+ for chapter in range(schapter, echapter + 1):
v = self.bible_db_cache[bible].get_bible_chapter(book.id, chapter)
if v == None:
try:
+ self.media.setQuickMsg1(u'Downloading')
+ self.media.setQuickMsg2(u'%s: %s'% (bookname, chapter))
search_results = self.bible_http_cache [bible].get_bible_chapter(bible, book.id, bookname, chapter)
- self.bible_db_cache[bible].create_chapter(book.id, \
- search_results.get_chapter(),\
- search_results.get_verselist())
+ if search_results.has_verselist():
+ self.bible_db_cache[bible].create_chapter(book.id, \
+ search_results.get_chapter(),\
+ search_results.get_verselist())
except :
log.error(u'Errow thrown %s', sys.exc_info()[1])
-
+ #Now get verses from database
if schapter == echapter:
text = self.bible_db_cache[bible].get_bible_text(bookname, schapter, sverse, everse)
else:
for i in range (schapter, echapter + 1):
if i == schapter:
start = sverse
- end = self.get_book_verse_count(bible, bookname,i )[0]
+ end = self.get_book_verse_count(bible, bookname, i)
elif i == echapter:
start = 1
end = everse
else:
start = 1
- end = self.get_book_verse_count(bible, bookname,i )[0]
+ end = self.get_book_verse_count(bible, bookname, i)
txt = self.bible_db_cache[bible].get_bible_text(bookname, i, start, end)
text.extend(txt)
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2009-07-13 20:11:36 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2009-08-02 13:44:41 +0000
@@ -135,6 +135,12 @@
self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab)
self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox')
self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 3, 1, 1, 1)
+ self.QuickMsg1 = QtGui.QLabel(self.QuickTab)
+ self.QuickMsg1.setObjectName(u'QuickSearchLabel')
+ self.QuickLayout.addWidget(self.QuickMsg1, 4, 0, 1, 1)
+ self.QuickMsg2 = QtGui.QLabel(self.QuickTab)
+ self.QuickMsg2.setObjectName(u'QuickSearchLabel')
+ self.QuickLayout.addWidget(self.QuickMsg2, 4, 1, 1, 1)
self.SearchTabWidget.addTab(self.QuickTab, 'Quick')
QuickSpacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
@@ -254,6 +260,14 @@
def initialise(self):
log.debug(u'initialise')
self.loadBibles()
+ self.parent.biblemanager.set_media_manager(self)
+
+ def setQuickMsg1(self, text):
+ self.QuickMsg1.setText(translate(u'BibleMediaItem', unicode(text)))
+
+ def setQuickMsg2(self, text):
+ self.QuickMsg2.setText(translate(u'BibleMediaItem', unicode(text)))
+ Receiver().send_message(u'openlpprocessevents')
def loadBibles(self):
log.debug(u'Loading Bibles')
@@ -355,7 +369,7 @@
verse = unicode(self.search_results[0].verse)
text = self.search_results[0].text
#Paragraph style force new line per verse
- if self.parent.bibles_tab.paragraph_style:
+ if self.parent.bibles_tab.layout_style == 1:
text = text + u'\n\n'
if self.parent.bibles_tab.display_style == 1:
loc = self.formatVerse(old_chapter, chapter, verse, u'(u', u')')
@@ -367,8 +381,13 @@
loc = self.formatVerse(old_chapter, chapter, verse, u'', u'')
old_chapter = chapter
bible_text = bible_text + u' '+ loc + u' '+ text
+ #if we are verse per slide then create slide
+ if self.parent.bibles_tab.layout_style == 0:
+ raw_slides.append(bible_text)
+ bible_text = u''
service_item.title = book + u' ' + loc
footer = book + u' (' + self.version + u' ' + self.copyright +u')'
+ #If not found throws and error so add.s
try:
raw_footer.index(footer)
except:
@@ -377,7 +396,9 @@
service_item.theme = None
else:
service_item.theme = self.parent.bibles_tab.bible_theme
- raw_slides.append(bible_text)
+ #if we are verse per slide we have already been added
+ if self.parent.bibles_tab.layout_style != 0:
+ raw_slides.append(bible_text)
for slide in raw_slides:
service_item.add_from_text(slide[:30], slide)
service_item.raw_footer = raw_footer
@@ -425,10 +446,6 @@
def displayResults(self, bible):
for verse in self.search_results:
- #bible_text = unicode(u' %s %d:%d (%s)'%(book , chap,vse, bible))
- #bible_verse = QtGui.QListWidgetItem(bible_text)
- #bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(bible_text))
- #self.ListView.addItem(bible_verse)
bible_text = u' %s %d:%d (%s)' % (verse.book.name,
verse.chapter, verse.verse, bible)
bible_verse = QtGui.QListWidgetItem(bible_text)
Follow ups