forked from openlp/openlp
Merged from trunk.
This commit is contained in:
commit
4e1656961b
3
cnvdb.py
3
cnvdb.py
@ -20,6 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
import codecs
|
||||
import sys
|
||||
import chardet
|
||||
|
||||
def convert_file(inname, outname):
|
||||
"""
|
||||
@ -31,7 +32,7 @@ def convert_file(inname, outname):
|
||||
``outname``
|
||||
The output file name.
|
||||
"""
|
||||
infile = codecs.open(inname, 'r', encoding='iso-8859-1')
|
||||
infile = codecs.open(inname, 'r', encoding='CP1252')
|
||||
writefile = codecs.open(outname, 'w', encoding='utf-8')
|
||||
for line in infile:
|
||||
#replace the quotes with quotes
|
||||
|
@ -40,6 +40,7 @@ class Renderer(object):
|
||||
self._debug = 0
|
||||
self._right_margin = 64 # the amount of right indent
|
||||
self._shadow_offset = 5
|
||||
self._shadow_offset_footer = 3
|
||||
self._outline_offset = 2
|
||||
self.theme_name = None
|
||||
self._theme = None
|
||||
@ -482,15 +483,17 @@ class Renderer(object):
|
||||
# dont allow alignment messing with footers
|
||||
if footer:
|
||||
align = 0
|
||||
shadow_offset = self._shadow_offset_footer
|
||||
else:
|
||||
align = int(self._theme .display_horizontalAlign)
|
||||
shadow_offset = self._shadow_offset
|
||||
for linenum in range(len(lines)):
|
||||
line = lines[linenum]
|
||||
#find out how wide line is
|
||||
w , h = self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=False)
|
||||
if self._theme.display_shadow:
|
||||
w += self._shadow_offset
|
||||
h += self._shadow_offset
|
||||
w += shadow_offset
|
||||
h += shadow_offset
|
||||
if self._theme.display_outline:
|
||||
# pixels either side
|
||||
w += 2 * self._outline_offset
|
||||
@ -515,7 +518,7 @@ class Renderer(object):
|
||||
if live:
|
||||
# now draw the text, and any outlines/shadows
|
||||
if self._theme.display_shadow:
|
||||
self._get_extent_and_render(line, footer, tlcorner=(x+self._shadow_offset,y+self._shadow_offset),
|
||||
self._get_extent_and_render(line, footer, tlcorner=(x + shadow_offset, y + shadow_offset),
|
||||
draw=True, color = self._theme.display_shadow_color)
|
||||
if self._theme.display_outline:
|
||||
self._get_extent_and_render(line, footer, (x+self._outline_offset,y), draw=True,
|
||||
@ -553,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)
|
||||
|
@ -24,8 +24,20 @@ from time import sleep
|
||||
from openlp.core.lib import translate
|
||||
|
||||
class MainDisplay(QtGui.QWidget):
|
||||
"""
|
||||
This is the form that is used to display things on the projector.
|
||||
"""
|
||||
|
||||
def __init__(self, parent , screens):
|
||||
def __init__(self, parent, screens):
|
||||
"""
|
||||
The constructor for the display form.
|
||||
|
||||
``parent``
|
||||
The parent widget.
|
||||
|
||||
``screens``
|
||||
The list of screens.
|
||||
"""
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
self.setWindowTitle(u'OpenLP Display')
|
||||
self.screens = screens
|
||||
@ -37,7 +49,7 @@ class MainDisplay(QtGui.QWidget):
|
||||
self.display.setScaledContents(True)
|
||||
self.layout.addWidget(self.display)
|
||||
self.displayBlank = False
|
||||
self.blankFrame= None
|
||||
self.blankFrame = None
|
||||
self.alertactive = False
|
||||
self.alerttext = u''
|
||||
self.alertTab = None
|
||||
@ -62,12 +74,22 @@ class MainDisplay(QtGui.QWidget):
|
||||
self.showFullScreen()
|
||||
else:
|
||||
self.showMinimized()
|
||||
#Build a custom splash screen
|
||||
self.InitialFrame = QtGui.QImage(screen[u'size'].width(),
|
||||
screen[u'size'].height(), QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
splash_image = QtGui.QImage(u':/graphics/openlp-splash-screen.png')
|
||||
painter_image = QtGui.QPainter()
|
||||
painter_image.begin(self.InitialFrame)
|
||||
painter_image.fillRect(self.InitialFrame.rect(), QtCore.Qt.white)
|
||||
painter_image.drawImage((screen[u'size'].width() - splash_image.width()) / 2,
|
||||
(screen[u'size'].height() - splash_image.height()) / 2 , splash_image)
|
||||
self.frameView(self.InitialFrame)
|
||||
#Build a Black screen
|
||||
painter = QtGui.QPainter()
|
||||
self.blankFrame = QtGui.QImage(screen[u'size'].width(),
|
||||
screen[u'size'].height(), QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
painter.begin(self.blankFrame)
|
||||
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black)
|
||||
self.frameView(self.blankFrame)
|
||||
|
||||
def frameView(self, frame):
|
||||
"""
|
||||
|
@ -129,13 +129,20 @@ class MainWindow(object):
|
||||
Hook to close the main window and display windows on exit
|
||||
"""
|
||||
if self.oosNotSaved == True:
|
||||
box = QtGui.QMessageBox()
|
||||
box.setWindowTitle(translate(u'mainWindow', u'Question?'))
|
||||
box.setText(translate(u'mainWindow', u'Save changes to Order of Service?'))
|
||||
box.setIcon(QtGui.QMessageBox.Question)
|
||||
box.setStandardButtons(QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Cancel);
|
||||
box.setDefaultButton(QtGui.QMessageBox.Save);
|
||||
ret = box.exec_()
|
||||
ret = QtGui.QMessageBox.question(self,
|
||||
translate(u'mainWindow', u'Save Changes to Service?'),
|
||||
translate(u'mainWindow', u'Your service has been changed, do you want to save those changes?'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save),
|
||||
QtGui.QMessageBox.Save)
|
||||
#
|
||||
#
|
||||
# box = QtGui.QMessageBox()
|
||||
# box.setWindowTitle(translate(u'mainWindow', u'Question?'))
|
||||
# box.setText(translate(u'mainWindow', u'Save changes to Order of Service?'))
|
||||
# box.setIcon(QtGui.QMessageBox.Question)
|
||||
# box.setStandardButtons(QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Cancel);
|
||||
# box.setDefaultButton(QtGui.QMessageBox.Save);
|
||||
# ret = box.exec_()
|
||||
if ret == QtGui.QMessageBox.Save:
|
||||
self.ServiceManagerContents.onSaveService()
|
||||
self.mainDisplay.close()
|
||||
|
@ -41,10 +41,39 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
||||
if event.key() == QtCore.Qt.Key_Enter:
|
||||
self.parent.makeLive()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_Home:
|
||||
self.parent.onServiceTop()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_End:
|
||||
self.parent.onServiceEnd()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_PageUp:
|
||||
self.parent.onServiceUp()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_PageDown:
|
||||
self.parent.onServiceDown()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_Up:
|
||||
self.parent.onMoveSelectionUp()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_Down:
|
||||
self.parent.onMoveSelectionDown()
|
||||
event.accept()
|
||||
event.ignore()
|
||||
else:
|
||||
event.ignore()
|
||||
|
||||
class Iter(QtGui.QTreeWidgetItemIterator):
|
||||
def __init__(self, *args):
|
||||
QtGui.QTreeWidgetItemIterator.__init__(self, *args)
|
||||
def next(self):
|
||||
self.__iadd__(1)
|
||||
value = self.value()
|
||||
if value:
|
||||
return self.value()
|
||||
else:
|
||||
return None
|
||||
|
||||
class ServiceManager(QtGui.QWidget):
|
||||
"""
|
||||
Manages the orders of service. Currently this involves taking
|
||||
@ -134,6 +163,52 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.servicePath = self.config.get_data_path()
|
||||
self.service_theme = self.config.get_config(u'theme service theme', u'')
|
||||
|
||||
def onMoveSelectionUp(self):
|
||||
"""
|
||||
Moves the selection up the window
|
||||
Called by the up arrow
|
||||
"""
|
||||
it = Iter(self.ServiceManagerList)
|
||||
item = it.value()
|
||||
tempItem = None
|
||||
setLastItem = False
|
||||
while item is not None:
|
||||
if item.isSelected() and tempItem is None:
|
||||
setLastItem = True
|
||||
item.setSelected(False)
|
||||
if item.isSelected():
|
||||
#We are on the first record
|
||||
if tempItem is not None:
|
||||
tempItem.setSelected(True)
|
||||
item.setSelected(False)
|
||||
else:
|
||||
tempItem = item
|
||||
lastItem = item
|
||||
item = it.next()
|
||||
#Top Item was selected so set the last one
|
||||
if setLastItem:
|
||||
lastItem.setSelected(True)
|
||||
|
||||
def onMoveSelectionDown(self):
|
||||
"""
|
||||
Moves the selection down the window
|
||||
Called by the down arrow
|
||||
"""
|
||||
it = Iter(self.ServiceManagerList)
|
||||
item = it.value()
|
||||
firstItem = item
|
||||
setSelected = False
|
||||
while item is not None:
|
||||
if setSelected:
|
||||
setSelected = False
|
||||
item.setSelected(True)
|
||||
elif item.isSelected():
|
||||
item.setSelected(False)
|
||||
setSelected = True
|
||||
item = it.next()
|
||||
if setSelected:
|
||||
firstItem.setSelected(True)
|
||||
|
||||
def collapsed(self, item):
|
||||
"""
|
||||
Record if an item is collapsed
|
||||
@ -159,7 +234,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
temp = self.serviceItems[item]
|
||||
self.serviceItems.remove(self.serviceItems[item])
|
||||
self.serviceItems.insert(0, temp)
|
||||
self.repaintServiceList()
|
||||
self.repaintServiceList(0, count)
|
||||
self.parent.OosChanged(False, self.serviceName)
|
||||
|
||||
def onServiceUp(self):
|
||||
@ -172,7 +247,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
temp = self.serviceItems[item]
|
||||
self.serviceItems.remove(self.serviceItems[item])
|
||||
self.serviceItems.insert(item - 1, temp)
|
||||
self.repaintServiceList()
|
||||
self.repaintServiceList(item - 1 , count)
|
||||
self.parent.OosChanged(False, self.serviceName)
|
||||
|
||||
def onServiceDown(self):
|
||||
@ -185,7 +260,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
temp = self.serviceItems[item]
|
||||
self.serviceItems.remove(self.serviceItems[item])
|
||||
self.serviceItems.insert(item + 1, temp)
|
||||
self.repaintServiceList()
|
||||
self.repaintServiceList(item + 1 , count)
|
||||
self.parent.OosChanged(False, self.serviceName)
|
||||
|
||||
def onServiceEnd(self):
|
||||
@ -197,7 +272,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
temp = self.serviceItems[item]
|
||||
self.serviceItems.remove(self.serviceItems[item])
|
||||
self.serviceItems.insert(len(self.serviceItems), temp)
|
||||
self.repaintServiceList()
|
||||
self.repaintServiceList(len(self.serviceItems) - 1, count)
|
||||
self.parent.OosChanged(False, self.serviceName)
|
||||
|
||||
def onNewService(self):
|
||||
@ -216,36 +291,36 @@ class ServiceManager(QtGui.QWidget):
|
||||
item, count = self.findServiceItem()
|
||||
if item is not -1:
|
||||
self.serviceItems.remove(self.serviceItems[item])
|
||||
self.repaintServiceList()
|
||||
self.repaintServiceList(0, 0)
|
||||
self.parent.OosChanged(False, self.serviceName)
|
||||
|
||||
def repaintServiceList(self):
|
||||
def repaintServiceList(self, serviceItem, serviceItemCount):
|
||||
"""
|
||||
Clear the existing service list and prepaint all the items
|
||||
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
|
||||
count += 1
|
||||
#Repaint the screen
|
||||
self.ServiceManagerList.clear()
|
||||
for item in self.serviceItems:
|
||||
for itemcount, item in enumerate(self.serviceItems):
|
||||
serviceitem = item[u'data']
|
||||
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
|
||||
treewidgetitem.setText(0,serviceitem.title)
|
||||
treewidgetitem.setIcon(0,serviceitem.iconic_representation)
|
||||
treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(item[u'order']))
|
||||
treewidgetitem.setExpanded(item[u'expanded'])
|
||||
count = 0
|
||||
for frame in serviceitem.frames:
|
||||
for count , frame in enumerate(serviceitem.frames):
|
||||
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
|
||||
text = frame[u'title']
|
||||
treewidgetitem1.setText(0,text[:40])
|
||||
treewidgetitem1.setData(0, QtCore.Qt.UserRole,QtCore.QVariant(count))
|
||||
count = count + 1
|
||||
if serviceItem == itemcount and serviceItemCount == count:
|
||||
self.ServiceManagerList.setCurrentItem(treewidgetitem1)
|
||||
|
||||
def onSaveService(self):
|
||||
"""
|
||||
@ -323,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()
|
||||
|
@ -24,7 +24,6 @@ from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import SettingsTab
|
||||
from openlp.core.resources import *
|
||||
from openlp.core.ui import GeneralTab, ThemesTab, AlertsTab
|
||||
|
||||
from settingsdialog import Ui_SettingsDialog
|
||||
|
||||
log = logging.getLogger(u'SettingsForm')
|
||||
|
@ -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):
|
||||
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 @@ 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())
|
||||
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)
|
||||
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)
|
||||
|
@ -96,3 +96,4 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
||||
return False
|
||||
else:
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
|
@ -248,30 +248,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
|
||||
|
@ -49,3 +49,4 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
|
||||
return False
|
||||
else:
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
|
@ -47,3 +47,4 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
|
||||
return False
|
||||
else:
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
|
@ -283,7 +283,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
else:
|
||||
verses = song.lyrics.split(u'\n\n')
|
||||
for slide in verses:
|
||||
service_item.add_from_text(slide[:30], slide)
|
||||
service_item.add_from_text(slide[:30], unicode(slide))
|
||||
service_item.title = song.title
|
||||
for author in song.authors:
|
||||
if len(author_list) > 1:
|
||||
|
Loading…
Reference in New Issue
Block a user