forked from openlp/openlp
New features and fixes.
bzr-revno: 499
This commit is contained in:
commit
2816277af1
@ -556,15 +556,21 @@ class Renderer(object):
|
||||
"""
|
||||
Set the fonts from the current theme settings.
|
||||
"""
|
||||
footer_weight = 50
|
||||
if self._theme.font_footer_weight == u'Bold':
|
||||
footer_weight = 75
|
||||
self.footerFont = QtGui.QFont(self._theme.font_footer_name,
|
||||
int(self._theme.font_footer_proportion), # size
|
||||
QtGui.QFont.Normal, # weight
|
||||
0)# italic
|
||||
int(footer_weight), # weight
|
||||
self._theme.font_footer_italics)# italic
|
||||
self.footerFont.setPixelSize(int(self._theme.font_footer_proportion))
|
||||
main_weight = 50
|
||||
if self._theme.font_main_weight == u'Bold':
|
||||
main_weight = 75
|
||||
self.mainFont = QtGui.QFont(self._theme.font_main_name,
|
||||
int(self._theme.font_main_proportion), # size
|
||||
QtGui.QFont.Normal, # weight
|
||||
0)# italic
|
||||
int(main_weight), # weight
|
||||
self._theme.font_main_italics)# italic
|
||||
self.mainFont.setPixelSize(int(self._theme.font_main_proportion))
|
||||
|
||||
def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False, color=None):
|
||||
|
@ -46,12 +46,16 @@ blankthemexml=\
|
||||
<name>Arial</name>
|
||||
<color>#000000</color>
|
||||
<proportion>30</proportion>
|
||||
<weight>Normal</weight>
|
||||
<italics>False</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>Normal</weight>
|
||||
<italics>False</italics>
|
||||
<location override="False" x="0" y="0" width="0" height="0"/>
|
||||
</font>
|
||||
<display>
|
||||
@ -157,7 +161,7 @@ class ThemeXML(object):
|
||||
#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=u'Bold', italics=False,
|
||||
xpos=0, ypos=0, width=0, height=0):
|
||||
"""
|
||||
Add a Font.
|
||||
@ -177,6 +181,12 @@ class ThemeXML(object):
|
||||
``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 @@ class ThemeXML(object):
|
||||
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)
|
||||
@ -329,13 +341,16 @@ class ThemeXML(object):
|
||||
setattr(self, master + element.tag + u'_'+ e[0], e[1])
|
||||
else:
|
||||
field = master + e[0]
|
||||
e1 = e[1]
|
||||
if e[1] == u'True' or e[1] == u'False':
|
||||
e1 = str_to_bool(e[1])
|
||||
setattr(self, field, e1)
|
||||
setattr(self, field, str_to_bool(e[1]))
|
||||
else:
|
||||
setattr(self, field, e[1])
|
||||
else:
|
||||
if element.tag is not None:
|
||||
field = master + element.tag
|
||||
if element.text == u'True' or element.text == u'False':
|
||||
setattr(self, field, str_to_bool(element.text))
|
||||
else:
|
||||
setattr(self, field, element.text)
|
||||
|
||||
def __str__(self):
|
||||
|
@ -165,6 +165,16 @@ class Ui_AmendThemeDialog(object):
|
||||
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 @@ class Ui_AmendThemeDialog(object):
|
||||
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 @@ class Ui_AmendThemeDialog(object):
|
||||
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 @@ class Ui_AmendThemeDialog(object):
|
||||
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:'))
|
||||
|
@ -53,7 +53,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
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 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
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 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
|
||||
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 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
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 = u'Normal'
|
||||
self.theme.font_main_italics = False
|
||||
elif value == 1:
|
||||
self.theme.font_main_weight = u'Bold'
|
||||
self.theme.font_main_italics = False
|
||||
elif value == 2:
|
||||
self.theme.font_main_weight = u'Normal'
|
||||
self.theme.font_main_italics = True
|
||||
else:
|
||||
self.theme.font_main_weight = u'Bold'
|
||||
self.theme.font_main_italics = True
|
||||
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 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
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 = u'Normal'
|
||||
self.theme.font_footer_italics = False
|
||||
elif value == 1:
|
||||
self.theme.font_footer_weight = u'Bold'
|
||||
self.theme.font_footer_italics = False
|
||||
elif value == 2:
|
||||
self.theme.font_footer_weight = u'Normal'
|
||||
self.theme.font_footer_italics = True
|
||||
else:
|
||||
self.theme.font_footer_weight = u'Bold'
|
||||
self.theme.font_footer_italics = True
|
||||
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 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
self.GradientComboBox.setCurrentIndex(2)
|
||||
|
||||
self.FontMainSizeSpinBox.setValue(int(self.theme.font_main_proportion))
|
||||
if not self.theme.font_main_italics and self.theme.font_main_weight == u'Normal':
|
||||
self.FontMainWeightComboBox.setCurrentIndex(0)
|
||||
elif not self.theme.font_main_italics and self.theme.font_main_weight == u'Bold':
|
||||
self.FontMainWeightComboBox.setCurrentIndex(1)
|
||||
elif self.theme.font_main_italics and self.theme.font_main_weight == u'Normal':
|
||||
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 not self.theme.font_footer_italics and self.theme.font_footer_weight == u'Normal':
|
||||
self.FontFooterWeightComboBox.setCurrentIndex(0)
|
||||
elif not self.theme.font_footer_italics and self.theme.font_footer_weight == u'Bold':
|
||||
self.FontFooterWeightComboBox.setCurrentIndex(1)
|
||||
elif self.theme.font_footer_italics and self.theme.font_footer_weight == u'Normal':
|
||||
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 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
else:
|
||||
self.ShadowColorPushButton.setEnabled(False)
|
||||
|
||||
|
||||
def previewTheme(self, theme):
|
||||
if self.allowPreview:
|
||||
frame = self.thememanager.generateImage(theme)
|
||||
|
@ -300,7 +300,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
Used when moving items as the move takes place in supporting array,
|
||||
and when regenerating all the items due to theme changes
|
||||
"""
|
||||
#Correct order of idems in array
|
||||
#Correct order of items in array
|
||||
count = 1
|
||||
for item in self.serviceItems:
|
||||
item[u'order'] = count
|
||||
@ -398,7 +398,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
"""
|
||||
Set the theme for the current service
|
||||
"""
|
||||
self.service_theme = self.ThemeComboBox.currentText()
|
||||
self.service_theme = unicode(self.ThemeComboBox.currentText())
|
||||
self.parent.RenderManager.set_service_theme(self.service_theme)
|
||||
self.config.set_config(u'theme service theme', self.service_theme)
|
||||
self.regenerateServiceItems()
|
||||
|
@ -100,6 +100,10 @@ class ThemeManager(QtGui.QWidget):
|
||||
except:
|
||||
#if not present do not worry
|
||||
pass
|
||||
#As we do not reload the themes push out the change
|
||||
self.parent.EventManager.post_event(Event(EventType.ThemeListChanged))
|
||||
self.parent.ServiceManagerContents.updateThemeList(self.getThemes())
|
||||
self.parent.settingsForm.ThemesTab.updateThemeList(self.getThemes())
|
||||
|
||||
def onExportTheme(self):
|
||||
pass
|
||||
|
@ -155,6 +155,8 @@ class MigrateSongs():
|
||||
if bb is None:
|
||||
author = Author()
|
||||
author.display_name = authors_temp.authorname
|
||||
author.first_name = u''
|
||||
author.last_name = u''
|
||||
else:
|
||||
id = int(bb[0])
|
||||
author = self.session.query(Author).get(bb[0])
|
||||
|
@ -96,7 +96,7 @@ class CWExtract(BibleCommon):
|
||||
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 @@ class CWExtract(BibleCommon):
|
||||
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)
|
||||
|
@ -56,22 +56,9 @@ class BiblesTab(SettingsTab):
|
||||
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 @@ class BiblesTab(SettingsTab):
|
||||
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 @@ class BiblesTab(SettingsTab):
|
||||
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 @@ class BiblesTab(SettingsTab):
|
||||
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 @@ class BiblesTab(SettingsTab):
|
||||
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))
|
||||
|
||||
|
@ -28,9 +28,7 @@ from bibleOSISimpl import BibleOSISImpl
|
||||
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 @@ class BibleManager(object):
|
||||
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 @@ class BibleManager(object):
|
||||
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 @@ class BibleManager(object):
|
||||
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):
|
||||
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,6 +338,7 @@ class BibleManager(object):
|
||||
## 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())
|
||||
@ -334,26 +348,29 @@ class BibleManager(object):
|
||||
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)
|
||||
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)
|
||||
|
@ -135,6 +135,12 @@ class BibleMediaItem(MediaManagerItem):
|
||||
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 @@ class BibleMediaItem(MediaManagerItem):
|
||||
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 @@ class BibleMediaItem(MediaManagerItem):
|
||||
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 @@ class BibleMediaItem(MediaManagerItem):
|
||||
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,6 +396,8 @@ class BibleMediaItem(MediaManagerItem):
|
||||
service_item.theme = None
|
||||
else:
|
||||
service_item.theme = self.parent.bibles_tab.bible_theme
|
||||
#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)
|
||||
@ -425,10 +446,6 @@ class BibleMediaItem(MediaManagerItem):
|
||||
|
||||
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)
|
||||
|
@ -48,16 +48,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
QtCore.SIGNAL(u'clicked()'), self.onAuthorRemovefromSongItemClicked)
|
||||
QtCore.QObject.connect(self.AuthorsListView,
|
||||
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onAuthorsListViewPressed)
|
||||
# QtCore.QObject.connect(self.AddTopicButton,
|
||||
# QtCore.SIGNAL(u'clicked()'), self.onAddTopicButtonClicked)
|
||||
QtCore.QObject.connect(self.AddTopicsToSongButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onTopicAddtoSongItemClicked)
|
||||
QtCore.QObject.connect(self.TopicRemoveItem,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onTopicRemovefromSongItemClicked)
|
||||
QtCore.QObject.connect(self.TopicsListView,
|
||||
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onTopicListViewPressed)
|
||||
# QtCore.QObject.connect(self.AddSongBookButton,
|
||||
# QtCore.SIGNAL(u'clicked()'), self.onAddSongBookButtonClicked)
|
||||
QtCore.QObject.connect(self.CopyrightInsertItem,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertItemTriggered)
|
||||
QtCore.QObject.connect(self.AddButton,
|
||||
@ -75,9 +71,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
# Create other objects and forms
|
||||
self.songmanager = songmanager
|
||||
self.eventmanager = eventmanager
|
||||
# self.authors_form = AuthorsForm(self.songmanager)
|
||||
# self.topics_form = TopicsForm(self.songmanager)
|
||||
# self.song_book_form = SongBookForm(self.songmanager)
|
||||
self.verse_form = EditVerseForm()
|
||||
self.initialise()
|
||||
self.AuthorsListView.setSortingEnabled(False)
|
||||
@ -253,30 +246,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
row = self.TopicsListView.row(item)
|
||||
self.TopicsListView.takeItem(row)
|
||||
|
||||
# def onAddAuthorsButtonClicked(self):
|
||||
# """
|
||||
# Slot documentation goes here.
|
||||
# """
|
||||
# self.authors_form.load_form()
|
||||
# self.authors_form.exec_()
|
||||
# self.loadAuthors()
|
||||
#
|
||||
# def onAddTopicButtonClicked(self):
|
||||
# """
|
||||
# Slot documentation goes here.
|
||||
# """
|
||||
# self.topics_form.load_form()
|
||||
# self.topics_form.exec_()
|
||||
# self.loadTopics()
|
||||
#
|
||||
# def onAddSongBookButtonClicked(self):
|
||||
# """
|
||||
# Slot documentation goes here.
|
||||
# """
|
||||
# self.song_book_form.load_form()
|
||||
# self.song_book_form.exec_()
|
||||
# self.loadBooks()
|
||||
|
||||
def onSongBookComboChanged(self, item):
|
||||
if item == 0:
|
||||
self.song.song_book_id = 0
|
||||
|
Loading…
Reference in New Issue
Block a user