forked from openlp/openlp
More white space and line length fixes
This commit is contained in:
parent
47d0dfe089
commit
98ea9141f4
@ -136,7 +136,8 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.Toolbar = OpenLPToolbar(self)
|
||||
self.PageLayout.addWidget(self.Toolbar)
|
||||
|
||||
def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None):
|
||||
def addToolbarButton(self, title, tooltip, icon, slot=None,
|
||||
objectname=None):
|
||||
"""
|
||||
A method to help developers easily add a button to the toolbar.
|
||||
|
||||
@ -192,31 +193,43 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
## File Button ##
|
||||
if self.hasFileIcon:
|
||||
self.addToolbarButton(
|
||||
translate(self.TranslationContext, u'Load '+self.PluginTextShort),
|
||||
translate(self.TranslationContext, u'Load a new '+self.PluginTextShort),
|
||||
u':'+self.IconPath+ u'_load.png', self.onFileClick, self.PluginTextShort+u'FileItem')
|
||||
translate(self.TranslationContext,
|
||||
u'Load ' + self.PluginTextShort),
|
||||
translate(self.TranslationContext,
|
||||
u'Load a new ' + self.PluginTextShort),
|
||||
u':' + self.IconPath + u'_load.png', self.onFileClick,
|
||||
self.PluginTextShort + u'FileItem')
|
||||
## New Button ##
|
||||
if self.hasNewIcon:
|
||||
self.addToolbarButton(
|
||||
translate(self.TranslationContext, u'New '+self.PluginTextShort),
|
||||
translate(self.TranslationContext, u'Add a new '+self.PluginTextShort),
|
||||
u':'+self.IconPath+ u'_new.png', self.onNewClick, self.PluginTextShort+u'NewItem')
|
||||
translate(self.TranslationContext,
|
||||
u'New ' + self.PluginTextShort),
|
||||
translate(self.TranslationContext,
|
||||
u'Add a new ' + self.PluginTextShort),
|
||||
u':' + self.IconPath + u'_new.png', self.onNewClick,
|
||||
self.PluginTextShort + u'NewItem')
|
||||
## Edit Button ##
|
||||
if self.hasEditIcon:
|
||||
self.addToolbarButton(
|
||||
translate(self.TranslationContext, u'Edit '+self.PluginTextShort),
|
||||
translate(self.TranslationContext, u'Edit the selected '+self.PluginTextShort),
|
||||
u':'+self.IconPath+ u'_edit.png', self.onEditClick, self.PluginTextShort+u'EditItem')
|
||||
translate(self.TranslationContext,
|
||||
u'Edit ' + self.PluginTextShort),
|
||||
translate(self.TranslationContext,
|
||||
u'Edit the selected ' + self.PluginTextShort),
|
||||
u':' + self.IconPath + u'_edit.png', self.onEditClick,
|
||||
self.PluginTextShort + u'EditItem')
|
||||
## Delete Button ##
|
||||
self.addToolbarButton(
|
||||
translate(self.TranslationContext, u'Delete '+self.PluginTextShort),
|
||||
translate(self.TranslationContext,
|
||||
u'Delete ' + self.PluginTextShort),
|
||||
translate(self.TranslationContext, u'Delete the selected item'),
|
||||
u':'+self.IconPath+ u'_delete.png', self.onDeleteClick, self.PluginTextShort+u'DeleteItem')
|
||||
u':' + self.IconPath + u'_delete.png', self.onDeleteClick,
|
||||
self.PluginTextShort + u'DeleteItem')
|
||||
## Separator Line ##
|
||||
self.addToolbarSeparator()
|
||||
## Preview ##
|
||||
self.addToolbarButton(
|
||||
translate(self.TranslationContext, u'Preview '+self.PluginTextShort),
|
||||
translate(self.TranslationContext,
|
||||
u'Preview ' + self.PluginTextShort),
|
||||
translate(self.TranslationContext, u'Preview the selected item'),
|
||||
u':/system/system_preview.png', self.onPreviewClick, u'PreviewItem')
|
||||
## Live Button ##
|
||||
@ -226,9 +239,12 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
u':/system/system_live.png', self.onLiveClick, u'LiveItem')
|
||||
## Add to service Button ##
|
||||
self.addToolbarButton(
|
||||
translate(self.TranslationContext, u'Add '+self.PluginTextShort+u' To Service'),
|
||||
translate(self.TranslationContext, u'Add the selected item(s) to the service'),
|
||||
u':/system/system_add.png', self.onAddClick, self.PluginTextShort+u'AddItem')
|
||||
translate(self.TranslationContext,
|
||||
u'Add ' + self.PluginTextShort + u' To Service'),
|
||||
translate(self.TranslationContext,
|
||||
u'Add the selected item(s) to the service'),
|
||||
u':/system/system_add.png', self.onAddClick,
|
||||
self.PluginTextShort + u'AddItem')
|
||||
|
||||
def addListViewToToolBar(self):
|
||||
#Add the List widget
|
||||
@ -236,7 +252,8 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.ListView.uniformItemSizes = True
|
||||
self.ListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
|
||||
self.ListView.setSpacing(1)
|
||||
self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.ListView.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.ListView.setAlternatingRowColors(True)
|
||||
self.ListView.setDragEnabled(True)
|
||||
self.ListView.setObjectName(self.PluginTextShort+u'ListView')
|
||||
@ -247,12 +264,14 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
if self.hasEditIcon:
|
||||
self.ListView.addAction(contextMenuAction(self.ListView,
|
||||
':' +self.IconPath+u'_new.png',
|
||||
translate(self.TranslationContext, u'&Edit '+self.PluginTextShort),
|
||||
translate(self.TranslationContext,
|
||||
u'&Edit ' + self.PluginTextShort),
|
||||
self.onEditClick))
|
||||
self.ListView.addAction(contextMenuSeparator(self.ListView))
|
||||
self.ListView.addAction(contextMenuAction(
|
||||
self.ListView, ':/system/system_preview.png',
|
||||
translate(self.TranslationContext, u'&Preview '+self.PluginTextShort),
|
||||
translate(self.TranslationContext,
|
||||
u'&Preview ' + self.PluginTextShort),
|
||||
self.onPreviewClick))
|
||||
self.ListView.addAction(contextMenuAction(
|
||||
self.ListView, ':/system/system_live.png',
|
||||
@ -301,20 +320,23 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
count = 0
|
||||
filelist = []
|
||||
while count < self.ListView.count():
|
||||
bitem = self.ListView.item(count)
|
||||
bitem = self.ListView.item(count)
|
||||
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
|
||||
filelist.append(filename)
|
||||
count += 1
|
||||
return filelist
|
||||
|
||||
def loadList(self, list):
|
||||
raise NotImplementedError(u'MediaManagerItem.loadList needs to be defined by the plugin')
|
||||
raise NotImplementedError(
|
||||
u'MediaManagerItem.loadList needs to be defined by the plugin')
|
||||
|
||||
def onNewClick(self):
|
||||
raise NotImplementedError(u'MediaManagerItem.onNewClick needs to be defined by the plugin')
|
||||
raise NotImplementedError(
|
||||
u'MediaManagerItem.onNewClick needs to be defined by the plugin')
|
||||
|
||||
def onEditClick(self):
|
||||
raise NotImplementedError(u'MediaManagerItem.onEditClick needs to be defined by the plugin')
|
||||
raise NotImplementedError(
|
||||
u'MediaManagerItem.onEditClick needs to be defined by the plugin')
|
||||
|
||||
def onDeleteClick(self):
|
||||
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to be defined by the plugin')
|
||||
@ -323,7 +345,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
|
||||
|
||||
def onPreviewClick(self):
|
||||
log.debug(self.PluginTextShort+u' Preview Requested')
|
||||
log.debug(self.PluginTextShort + u' Preview Requested')
|
||||
service_item = self.buildServiceItem()
|
||||
if service_item is not None:
|
||||
self.parent.preview_controller.addServiceItem(service_item)
|
||||
@ -335,7 +357,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.parent.live_controller.addServiceItem(service_item)
|
||||
|
||||
def onAddClick(self):
|
||||
log.debug(self.PluginTextShort+u' Add Requested')
|
||||
log.debug(self.PluginTextShort + u' Add Requested')
|
||||
service_item = self.buildServiceItem()
|
||||
if service_item is not None:
|
||||
self.parent.service_manager.addServiceItem(service_item)
|
||||
@ -345,7 +367,8 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
Common method for generating a service item
|
||||
"""
|
||||
service_item = ServiceItem(self.parent)
|
||||
service_item.addIcon(u':/media/media_'+self.PluginTextShort.lower()+u'.png')
|
||||
service_item.addIcon(
|
||||
u':/media/media_' + self.PluginTextShort.lower() + u'.png')
|
||||
if self.generateSlideData(service_item):
|
||||
self.ListView.clearSelection()
|
||||
return service_item
|
||||
|
@ -26,7 +26,7 @@ import os
|
||||
import sys
|
||||
import logging
|
||||
|
||||
from openlp.core.lib import Plugin, PluginStatus
|
||||
from openlp.core.lib import Plugin, PluginStatus
|
||||
|
||||
class PluginManager(object):
|
||||
"""
|
||||
|
@ -188,13 +188,13 @@ class Renderer(object):
|
||||
else:
|
||||
pos = len(line)
|
||||
split_text = line
|
||||
while metrics.width(split_text, -1) > line_width:
|
||||
while metrics.width(split_text, -1) > line_width:
|
||||
#Find the next space to the left
|
||||
pos = line[:pos].rfind(u' ')
|
||||
#no more spaces found
|
||||
if pos == 0:
|
||||
split_text = line
|
||||
while metrics.width(split_text, -1) > line_width:
|
||||
while metrics.width(split_text, -1) > line_width:
|
||||
split_text = split_text[:-1]
|
||||
pos = len(split_text)
|
||||
else:
|
||||
@ -242,7 +242,7 @@ class Renderer(object):
|
||||
# reset the frame. first time do not worry about what you paint on.
|
||||
self._frame = QtGui.QImage(self.bg_frame)
|
||||
x, y = self._correctAlignment(self._rect, bbox)
|
||||
bbox = self._render_lines_unaligned(lines, False, (x, y), True)
|
||||
bbox = self._render_lines_unaligned(lines, False, (x, y), True)
|
||||
if footer_lines is not None:
|
||||
bbox = self._render_lines_unaligned(footer_lines, True,
|
||||
(self._rect_footer.left(), self._rect_footer.top()), True)
|
||||
@ -327,7 +327,8 @@ class Renderer(object):
|
||||
# centre align
|
||||
y = rect.top() + (rect.height() - bbox.height()) / 2
|
||||
else:
|
||||
log.error(u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)
|
||||
log.error(u'Invalid value for theme.VerticalAlign:%s',
|
||||
self._theme.display_verticalAlign)
|
||||
return x, y
|
||||
|
||||
def _render_lines_unaligned(self, lines, footer, tlcorner=(0, 0),
|
||||
@ -400,7 +401,7 @@ class Renderer(object):
|
||||
startx = x
|
||||
starty = y
|
||||
rightextent = None
|
||||
#print "inputs", startx, starty, maxx, maxy
|
||||
#print "inputs", startx, starty, maxx, maxy
|
||||
# dont allow alignment messing with footers
|
||||
if footer:
|
||||
align = 0
|
||||
@ -412,7 +413,7 @@ class Renderer(object):
|
||||
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),
|
||||
w, h = self._get_extent_and_render(line, footer, tlcorner=(x, y),
|
||||
draw=False)
|
||||
if self._theme.display_shadow:
|
||||
w += shadow_offset
|
||||
|
@ -121,7 +121,8 @@ class RenderManager(object):
|
||||
else:
|
||||
if theme is not None:
|
||||
self.theme = theme
|
||||
elif self.global_style == u'Song' or self.global_style == u'Service':
|
||||
elif self.global_style == u'Song' or \
|
||||
self.global_style == u'Service':
|
||||
if self.service_theme == u'':
|
||||
self.theme = self.global_theme
|
||||
else:
|
||||
@ -129,9 +130,10 @@ class RenderManager(object):
|
||||
else:
|
||||
self.theme = self.global_theme
|
||||
if self.theme != self.renderer.theme_name:
|
||||
log.debug(u'theme is now %s', self.theme)
|
||||
log.debug(u'theme is now %s', self.theme)
|
||||
self.themedata = self.theme_manager.getThemeData(self.theme)
|
||||
self.calculate_default(self.screen_list[self.current_display][u'size'])
|
||||
self.calculate_default(
|
||||
self.screen_list[self.current_display][u'size'])
|
||||
self.renderer.set_theme(self.themedata)
|
||||
self.build_text_rectangle(self.themedata)
|
||||
|
||||
@ -212,7 +214,7 @@ class RenderManager(object):
|
||||
self.renderer.set_frame_dest(self.width, self.height)
|
||||
return self.renderer.generate_frame_from_lines(main_text, footer_text)
|
||||
|
||||
def resize_image(self, image, width = 0, height = 0):
|
||||
def resize_image(self, image, width=0, height=0):
|
||||
"""
|
||||
Resize an image to fit on the current screen.
|
||||
|
||||
@ -253,6 +255,7 @@ class RenderManager(object):
|
||||
self.width = screen.width()
|
||||
self.height = screen.height()
|
||||
self.screen_ratio = float(self.height) / float(self.width)
|
||||
log.debug(u'calculate default %d, %d, %f', self.width, self.height, self.screen_ratio )
|
||||
log.debug(u'calculate default %d, %d, %f',
|
||||
self.width, self.height, self.screen_ratio )
|
||||
# 90% is start of footer
|
||||
self.footer_start = int(self.height * 0.90)
|
||||
|
@ -39,5 +39,5 @@ from thememanager import ThemeManager
|
||||
from mainwindow import MainWindow
|
||||
|
||||
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MasterToolbar',
|
||||
'MainWindow', 'MainDisplay', 'SlideController', 'ServiceManager',
|
||||
'MainWindow', 'MainDisplay', 'SlideController', 'ServiceManager',
|
||||
'ThemeManager', 'AmendThemeForm']
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate
|
||||
from openlp.core.lib import SettingsTab, translate
|
||||
|
||||
class AlertsTab(SettingsTab):
|
||||
"""
|
||||
@ -33,7 +33,8 @@ class AlertsTab(SettingsTab):
|
||||
def __init__(self):
|
||||
self.font_color = '#ffffff'
|
||||
self.bg_color = '#660000'
|
||||
SettingsTab.__init__(self, translate(u'AlertsTab', u'Alerts'), u'Alerts')
|
||||
SettingsTab.__init__(
|
||||
self, translate(u'AlertsTab', u'Alerts'), u'Alerts')
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'AlertsTab')
|
||||
@ -110,10 +111,12 @@ class AlertsTab(SettingsTab):
|
||||
self.SlideRightLayout.setMargin(0)
|
||||
self.SlideRightLayout.setObjectName(u'SlideRightLayout')
|
||||
self.PreviewGroupBox = QtGui.QGroupBox(self.AlertRightColumn)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.PreviewGroupBox.sizePolicy().hasHeightForWidth())
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.PreviewGroupBox.sizePolicy().hasHeightForWidth())
|
||||
self.PreviewGroupBox.setSizePolicy(sizePolicy)
|
||||
self.PreviewGroupBox.setObjectName(u'PreviewGroupBox')
|
||||
self.PreviewLayout = QtGui.QVBoxLayout(self.PreviewGroupBox)
|
||||
@ -124,7 +127,8 @@ class AlertsTab(SettingsTab):
|
||||
self.FontPreview.setMinimumSize(QtCore.QSize(280, 100))
|
||||
self.FontPreview.setReadOnly(True)
|
||||
self.FontPreview.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
self.FontPreview.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
|
||||
self.FontPreview.setAlignment(
|
||||
QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
|
||||
self.FontPreview.setObjectName(u'FontPreview')
|
||||
self.PreviewLayout.addWidget(self.FontPreview)
|
||||
self.SlideRightLayout.addWidget(self.PreviewGroupBox)
|
||||
@ -146,11 +150,13 @@ class AlertsTab(SettingsTab):
|
||||
self.FontGroupBox.setTitle(translate(u'AlertsTab', u'Font'))
|
||||
self.FontLabel.setText(translate(u'AlertsTab', u'Font Name:'))
|
||||
self.FontColorLabel.setText(translate(u'AlertsTab', u'Font Color:'))
|
||||
self.BackgroundColorLabel.setText(translate(u'AlertsTab', u'Background Color:'))
|
||||
self.BackgroundColorLabel.setText(
|
||||
translate(u'AlertsTab', u'Background Color:'))
|
||||
self.TimeoutLabel.setText(translate(u'AlertsTab', u'Alert timeout:'))
|
||||
self.TimeoutSpinBox.setSuffix(translate(u'AlertsTab', u's'))
|
||||
self.PreviewGroupBox.setTitle(translate(u'AlertsTab', u'Preview'))
|
||||
self.FontPreview.setText(translate(u'AlertsTab', u'openlp.org 2.0 rocks!'))
|
||||
self.FontPreview.setText(
|
||||
translate(u'AlertsTab', u'openlp.org 2.0 rocks!'))
|
||||
|
||||
def onBackgroundColorButtonClicked(self):
|
||||
self.bg_color = QtGui.QColorDialog.getColor(
|
||||
@ -174,12 +180,17 @@ class AlertsTab(SettingsTab):
|
||||
|
||||
def load(self):
|
||||
self.timeout = int(self.config.get_config(u'timeout', 5))
|
||||
self.font_color = unicode(self.config.get_config(u'font color', u'#ffffff'))
|
||||
self.bg_color = unicode(self.config.get_config(u'background color', u'#660000'))
|
||||
self.font_face = unicode(self.config.get_config(u'font face', QtGui.QFont().family()))
|
||||
self.font_color = unicode(
|
||||
self.config.get_config(u'font color', u'#ffffff'))
|
||||
self.bg_color = unicode(
|
||||
self.config.get_config(u'background color', u'#660000'))
|
||||
self.font_face = unicode(
|
||||
self.config.get_config(u'font face', QtGui.QFont().family()))
|
||||
self.TimeoutSpinBox.setValue(self.timeout)
|
||||
self.FontColorButton.setStyleSheet(u'background-color: %s' % self.font_color)
|
||||
self.BackgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
|
||||
self.FontColorButton.setStyleSheet(
|
||||
u'background-color: %s' % self.font_color)
|
||||
self.BackgroundColorButton.setStyleSheet(
|
||||
u'background-color: %s' % self.bg_color)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily(self.font_face)
|
||||
self.FontComboBox.setCurrentFont(font)
|
||||
@ -198,5 +209,5 @@ class AlertsTab(SettingsTab):
|
||||
font.setBold(True)
|
||||
font.setPointSize(16)
|
||||
self.FontPreview.setFont(font)
|
||||
self.FontPreview.setStyleSheet(
|
||||
u'background-color: %s; color: %s' % (self.bg_color, self.font_color))
|
||||
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % \
|
||||
(self.bg_color, self.font_color))
|
||||
|
@ -33,7 +33,7 @@ from amendthemedialog import Ui_AmendThemeDialog
|
||||
|
||||
log = logging.getLogger(u'AmendThemeForm')
|
||||
|
||||
class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
|
||||
def __init__(self, thememanager, parent=None):
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
|
@ -26,7 +26,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from time import sleep
|
||||
from openlp.core.lib import translate, Receiver
|
||||
from openlp.core.lib import translate, Receiver
|
||||
|
||||
class MainDisplay(QtGui.QWidget):
|
||||
"""
|
||||
@ -129,7 +129,7 @@ class MainDisplay(QtGui.QWidget):
|
||||
self.displayBlank = False
|
||||
self.frameView(self.frame)
|
||||
|
||||
def displayAlert(self, text=u''):
|
||||
def displayAlert(self, text=u''):
|
||||
"""
|
||||
Called from the Alert Tab to display an alert
|
||||
|
||||
@ -141,7 +141,8 @@ class MainDisplay(QtGui.QWidget):
|
||||
painter = QtGui.QPainter(alertframe)
|
||||
top = alertframe.rect().height() * 0.9
|
||||
painter.fillRect(
|
||||
QtCore.QRect(0, top, alertframe.rect().width(), alertframe.rect().height() - top),
|
||||
QtCore.QRect(0, top,
|
||||
alertframe.rect().width(), alertframe.rect().height() - top),
|
||||
QtGui.QColor(alertTab.bg_color))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily(alertTab.font_face)
|
||||
|
@ -28,7 +28,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
|
||||
ServiceManager, ThemeManager, MainDisplay, SlideController, \
|
||||
ServiceManager, ThemeManager, MainDisplay, SlideController, \
|
||||
PluginForm
|
||||
from openlp.core.lib import translate, Plugin, MediaManagerItem, \
|
||||
SettingsTab, RenderManager, PluginConfig, str_to_bool, OpenLPDockWidget, \
|
||||
@ -119,7 +119,7 @@ class Ui_MainWindow(object):
|
||||
|
||||
# self.MediaManagerDock.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored,
|
||||
# QtGui.QSizePolicy.Maximum))
|
||||
# geometry = self.MediaManagerDock.geometry()
|
||||
# geometry = self.MediaManagerDock.geometry()
|
||||
# geometry.setWidth(self.settingsmanager.mainwindow_left)
|
||||
# self.MediaManagerDock.setGeometry(geometry)
|
||||
# self.MediaManagerDock.setMinimumWidth(10)
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import translate, PluginStatus
|
||||
from openlp.core.lib import translate, PluginStatus
|
||||
|
||||
class PluginForm(QtGui.QDialog):
|
||||
global log
|
||||
@ -45,14 +45,18 @@ class PluginForm(QtGui.QDialog):
|
||||
self.ButtonBox.setObjectName(u'ButtonBox')
|
||||
|
||||
self.retranslateUi(PluginForm)
|
||||
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), PluginForm.close)
|
||||
QtCore.QObject.connect(self.ButtonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), PluginForm.close)
|
||||
QtCore.QMetaObject.connectSlotsByName(PluginForm)
|
||||
|
||||
def retranslateUi(self, PluginForm):
|
||||
PluginForm.setWindowTitle(translate(u'PluginForm', u'Plugin list'))
|
||||
self.PluginViewList.horizontalHeaderItem(0).setText(translate(u'PluginForm', u'Name'))
|
||||
self.PluginViewList.horizontalHeaderItem(1).setText(translate(u'PluginForm', u'Version'))
|
||||
self.PluginViewList.horizontalHeaderItem(2).setText(translate(u'PluginForm', u'Status'))
|
||||
self.PluginViewList.horizontalHeaderItem(0).setText(
|
||||
translate(u'PluginForm', u'Name'))
|
||||
self.PluginViewList.horizontalHeaderItem(1).setText(
|
||||
translate(u'PluginForm', u'Version'))
|
||||
self.PluginViewList.horizontalHeaderItem(2).setText(
|
||||
translate(u'PluginForm', u'Status'))
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
@ -68,14 +72,14 @@ class PluginForm(QtGui.QDialog):
|
||||
item2 = QtGui.QTableWidgetItem(plugin.version)
|
||||
item2.setTextAlignment(QtCore.Qt.AlignVCenter)
|
||||
if plugin.status == PluginStatus.Active:
|
||||
item3 = QtGui.QTableWidgetItem(translate(u'PluginForm', u'Active'))
|
||||
item3 = QtGui.QTableWidgetItem(
|
||||
translate(u'PluginForm', u'Active'))
|
||||
else:
|
||||
item3 = QtGui.QTableWidgetItem(translate(u'PluginForm', u'Inactive'))
|
||||
item3 = QtGui.QTableWidgetItem(
|
||||
translate(u'PluginForm', u'Inactive'))
|
||||
item3.setTextAlignment(QtCore.Qt.AlignVCenter)
|
||||
self.PluginViewList.setItem(row, 0, item1)
|
||||
self.PluginViewList.setItem(row, 1, item2)
|
||||
self.PluginViewList.setItem(row, 2, item3)
|
||||
self.PluginViewList.setRowHeight(row, 15)
|
||||
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ import shutil
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
|
||||
RenderManager, translate, buildIcon, ServiceType, \
|
||||
contextMenuAction, contextMenuSeparator, Receiver
|
||||
contextMenuAction, contextMenuSeparator, Receiver
|
||||
from openlp.core.utils import ConfigHelper
|
||||
|
||||
class ServiceManagerList(QtGui.QTreeWidget):
|
||||
@ -285,7 +285,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
temp = self.serviceItems[item]
|
||||
self.serviceItems.remove(self.serviceItems[item])
|
||||
self.serviceItems.insert(item - 1, temp)
|
||||
self.repaintServiceList(item - 1, count)
|
||||
self.repaintServiceList(item - 1, count)
|
||||
self.parent.serviceChanged(False, self.serviceName)
|
||||
|
||||
def onServiceDown(self):
|
||||
@ -298,7 +298,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
temp = self.serviceItems[item]
|
||||
self.serviceItems.remove(self.serviceItems[item])
|
||||
self.serviceItems.insert(item + 1, temp)
|
||||
self.repaintServiceList(item + 1, count)
|
||||
self.repaintServiceList(item + 1, count)
|
||||
self.parent.serviceChanged(False, self.serviceName)
|
||||
|
||||
def onServiceEnd(self):
|
||||
@ -539,7 +539,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
pos = 0
|
||||
count = 0
|
||||
for item in items:
|
||||
parentitem = item.parent()
|
||||
parentitem = item.parent()
|
||||
if parentitem is None:
|
||||
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
else:
|
||||
|
@ -60,8 +60,8 @@ class SlideList(QtGui.QTableWidget):
|
||||
|
||||
class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
SlideController is the slide controller widget. This widget is what the user
|
||||
uses to control the displaying of verses/slides/etc on the screen.
|
||||
SlideController is the slide controller widget. This widget is what the
|
||||
user uses to control the displaying of verses/slides/etc on the screen.
|
||||
"""
|
||||
global log
|
||||
log = logging.getLogger(u'SlideController')
|
||||
@ -74,7 +74,8 @@ class SlideController(QtGui.QWidget):
|
||||
self.settingsmanager = settingsmanager
|
||||
self.isLive = isLive
|
||||
self.parent = parent
|
||||
self.image_list = [u'Start Loop', u'Stop Loop', u'Loop Separator', u'Image SpinBox']
|
||||
self.image_list = [
|
||||
u'Start Loop', u'Stop Loop', u'Loop Separator', u'Image SpinBox']
|
||||
self.timer_id = 0
|
||||
self.commandItem = None
|
||||
self.Panel = QtGui.QWidget(parent.ControlSplitter)
|
||||
@ -177,7 +178,8 @@ class SlideController(QtGui.QWidget):
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.SlidePreview.sizePolicy().hasHeightForWidth())
|
||||
self.SlidePreview.setSizePolicy(sizePolicy)
|
||||
self.SlidePreview.setFixedSize(QtCore.QSize(self.settingsmanager.slidecontroller_image, 225))
|
||||
self.SlidePreview.setFixedSize(
|
||||
QtCore.QSize(self.settingsmanager.slidecontroller_image, 225))
|
||||
self.SlidePreview.setFrameShape(QtGui.QFrame.Box)
|
||||
self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain)
|
||||
self.SlidePreview.setLineWidth(1)
|
||||
@ -238,7 +240,8 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
log.debug(u'addServiceItem')
|
||||
#If old item was a command tell it to stop
|
||||
if self.commandItem is not None and self.commandItem.service_item_type == ServiceType.Command:
|
||||
if self.commandItem is not None and \
|
||||
self.commandItem.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
|
||||
self.commandItem = item
|
||||
before = time.time()
|
||||
@ -246,8 +249,9 @@ class SlideController(QtGui.QWidget):
|
||||
log.info(u'Rendering took %4s' % (time.time() - before))
|
||||
self.enableToolBar(item)
|
||||
if item.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_start'%item.name.lower(), \
|
||||
[item.shortname, item.service_item_path, item.service_frames[0][u'title']])
|
||||
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
||||
[item.shortname, item.service_item_path,
|
||||
item.service_frames[0][u'title']])
|
||||
else:
|
||||
self.displayServiceManagerItems(item, 0)
|
||||
|
||||
@ -259,13 +263,15 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
log.debug(u'addServiceItem')
|
||||
#If old item was a command tell it to stop
|
||||
if self.commandItem is not None and self.commandItem.service_item_type == ServiceType.Command:
|
||||
if self.commandItem is not None and \
|
||||
self.commandItem.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
|
||||
self.commandItem = item
|
||||
self.enableToolBar(item)
|
||||
if item.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_start'%item.name.lower(), \
|
||||
[item.shortname, item.service_item_path, item.service_frames[0][u'title']])
|
||||
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
||||
[item.shortname, item.service_item_path,
|
||||
item.service_frames[0][u'title']])
|
||||
else:
|
||||
self.displayServiceManagerItems(item, slideno)
|
||||
|
||||
@ -279,9 +285,11 @@ class SlideController(QtGui.QWidget):
|
||||
self.serviceitem = serviceitem
|
||||
self.PreviewListWidget.clear()
|
||||
self.PreviewListWidget.setRowCount(0)
|
||||
self.PreviewListWidget.setColumnWidth(0, self.settingsmanager.slidecontroller_image)
|
||||
self.PreviewListWidget.setColumnWidth(
|
||||
0, self.settingsmanager.slidecontroller_image)
|
||||
for framenumber, frame in enumerate(self.serviceitem.frames):
|
||||
self.PreviewListWidget.setRowCount(self.PreviewListWidget.rowCount() + 1)
|
||||
self.PreviewListWidget.setRowCount(
|
||||
self.PreviewListWidget.rowCount() + 1)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
label = QtGui.QLabel()
|
||||
label.setMargin(8)
|
||||
@ -294,9 +302,11 @@ class SlideController(QtGui.QWidget):
|
||||
label.setText(frame[u'text'])
|
||||
self.PreviewListWidget.setCellWidget(framenumber, 0, label)
|
||||
self.PreviewListWidget.setItem(framenumber, 0, item)
|
||||
slide_height = self.settingsmanager.slidecontroller_image * self.parent.RenderManager.screen_ratio
|
||||
slide_height = self.settingsmanager.slidecontroller_image * \
|
||||
self.parent.RenderManager.screen_ratio
|
||||
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
|
||||
self.PreviewListWidget.setColumnWidth(0, self.PreviewListWidget.viewport().size().width())
|
||||
self.PreviewListWidget.setColumnWidth(
|
||||
0, self.PreviewListWidget.viewport().size().width())
|
||||
if slideno > self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
|
||||
else:
|
||||
@ -357,7 +367,8 @@ class SlideController(QtGui.QWidget):
|
||||
Go to the previous slide.
|
||||
"""
|
||||
if self.commandItem.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_previous'% self.commandItem.name.lower())
|
||||
Receiver().send_message(
|
||||
u'%s_previous'% self.commandItem.name.lower())
|
||||
else:
|
||||
row = self.PreviewListWidget.currentRow() - 1
|
||||
if row == -1:
|
||||
@ -377,7 +388,8 @@ class SlideController(QtGui.QWidget):
|
||||
Start the timer loop running and store the timer id
|
||||
"""
|
||||
if self.PreviewListWidget.rowCount() > 1:
|
||||
self.timer_id = self.startTimer(int(self.DelaySpinBox.value()) * 1000)
|
||||
self.timer_id = self.startTimer(
|
||||
int(self.DelaySpinBox.value()) * 1000)
|
||||
|
||||
def onStopLoop(self):
|
||||
"""
|
||||
@ -398,4 +410,5 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
row = self.PreviewListWidget.currentRow()
|
||||
if row > -1 and row < self.PreviewListWidget.rowCount():
|
||||
self.parent.LiveController.addServiceManagerItem(self.commandItem, row)
|
||||
self.parent.LiveController.addServiceManagerItem(
|
||||
self.commandItem, row)
|
||||
|
@ -29,36 +29,42 @@ class SplashScreen(object):
|
||||
def __init__(self, version):
|
||||
self.splash_screen = QtGui.QSplashScreen()
|
||||
self.setupUi()
|
||||
starting = translate(u'SplashScreen',u'Starting')
|
||||
self.message=starting+u'..... '+version
|
||||
starting = translate(u'SplashScreen', u'Starting')
|
||||
self.message = starting + u'..... ' + version
|
||||
|
||||
def setupUi(self):
|
||||
self.splash_screen.setObjectName(u'splash_screen')
|
||||
self.splash_screen.setWindowModality(QtCore.Qt.NonModal)
|
||||
self.splash_screen.setEnabled(True)
|
||||
self.splash_screen.resize(370, 370)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.splash_screen.sizePolicy().hasHeightForWidth())
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.splash_screen.sizePolicy().hasHeightForWidth())
|
||||
self.splash_screen.setSizePolicy(sizePolicy)
|
||||
self.splash_screen.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
icon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
splash_image = QtGui.QPixmap(u':/graphics/openlp-splash-screen.png')
|
||||
self.splash_screen.setWindowIcon(icon)
|
||||
self.splash_screen.setPixmap(splash_image)
|
||||
self.splash_screen.setMask(splash_image.mask())
|
||||
self.splash_screen.setWindowFlags(QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint)
|
||||
self.splash_screen.setWindowFlags(
|
||||
QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint)
|
||||
self.retranslateUi()
|
||||
QtCore.QMetaObject.connectSlotsByName(self.splash_screen)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.splash_screen.setWindowTitle(translate(u'splash_screen', u'Splash Screen'))
|
||||
self.splash_screen.setWindowTitle(
|
||||
translate(u'splash_screen', u'Splash Screen'))
|
||||
|
||||
def show(self):
|
||||
self.splash_screen.show()
|
||||
self.splash_screen.showMessage(self.message, QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom, QtCore.Qt.black)
|
||||
self.splash_screen.showMessage(self.message,
|
||||
QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom, QtCore.Qt.black)
|
||||
self.splash_screen.repaint()
|
||||
|
||||
def finish(self, widget):
|
||||
|
@ -97,10 +97,10 @@ class ThemeManager(QtGui.QWidget):
|
||||
|
||||
def changeGlobalFromTab(self, themeName):
|
||||
log.debug(u'changeGlobalFromTab %s', themeName)
|
||||
for count in range (0, self.ThemeListWidget.count()):
|
||||
for count in range (0, self.ThemeListWidget.count()):
|
||||
#reset the old name
|
||||
item = self.ThemeListWidget.item(count)
|
||||
oldName = item.text()
|
||||
oldName = item.text()
|
||||
newName = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
if oldName != newName:
|
||||
self.ThemeListWidget.item(count).setText(newName)
|
||||
@ -112,9 +112,9 @@ class ThemeManager(QtGui.QWidget):
|
||||
|
||||
def changeGlobalFromScreen(self, index):
|
||||
log.debug(u'changeGlobalFromScreen %s', index)
|
||||
for count in range (0, self.ThemeListWidget.count()):
|
||||
for count in range (0, self.ThemeListWidget.count()):
|
||||
item = self.ThemeListWidget.item(count)
|
||||
oldName = item.text()
|
||||
oldName = item.text()
|
||||
#reset the old name
|
||||
if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()):
|
||||
self.ThemeListWidget.item(count).setText(
|
||||
@ -194,12 +194,13 @@ class ThemeManager(QtGui.QWidget):
|
||||
path = unicode(path)
|
||||
if path != u'':
|
||||
self.config.set_last_dir(path, 1)
|
||||
themePath = os.path.join(path, theme + u'.theme')
|
||||
themePath = os.path.join(path, theme + u'.theme')
|
||||
zip = zipfile.ZipFile(themePath, 'w')
|
||||
source = os.path.join(self.path, theme)
|
||||
for root, dirs, files in os.walk(source):
|
||||
for name in files:
|
||||
zip.write(os.path.join(source, name), os.path.join(theme, name))
|
||||
zip.write(
|
||||
os.path.join(source, name), os.path.join(theme, name))
|
||||
zip.close()
|
||||
|
||||
def onImportTheme(self):
|
||||
@ -226,7 +227,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
for name in files:
|
||||
if name.endswith(u'.png'):
|
||||
#check to see file is in theme root directory
|
||||
theme = os.path.join(self.path, name)
|
||||
theme = os.path.join(self.path, name)
|
||||
if os.path.exists(theme):
|
||||
(path, filename) = os.path.split(unicode(file))
|
||||
textName = os.path.splitext(name)[0]
|
||||
@ -244,7 +245,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
self.pushThemes()
|
||||
|
||||
def pushThemes(self):
|
||||
Receiver().send_message(u'update_themes', self.getThemes() )
|
||||
Receiver().send_message(u'update_themes', self.getThemes() )
|
||||
|
||||
def getThemes(self):
|
||||
return self.themelist
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
|
||||
class ThemesTab(SettingsTab):
|
||||
"""
|
||||
@ -32,7 +32,8 @@ class ThemesTab(SettingsTab):
|
||||
"""
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
SettingsTab.__init__(self, translate(u'ThemesTab', u'Themes'), u'Themes')
|
||||
SettingsTab.__init__(
|
||||
self, translate(u'ThemesTab', u'Themes'), u'Themes')
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'ThemesTab')
|
||||
@ -106,15 +107,19 @@ class ThemesTab(SettingsTab):
|
||||
def retranslateUi(self):
|
||||
self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme'))
|
||||
self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level'))
|
||||
self.SongLevelRadioButton.setText(translate(u'ThemesTab', u'Song level'))
|
||||
self.SongLevelRadioButton.setText(
|
||||
translate(u'ThemesTab', u'Song level'))
|
||||
self.SongLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from each song in the database. If a song doesn\'t have a theme associated with it, then use the service\'s theme. If the service doesn\'t have a theme, then use the global theme.'))
|
||||
self.ServiceLevelRadioButton.setText(translate(u'ThemesTab', u'Service level'))
|
||||
self.ServiceLevelRadioButton.setText(
|
||||
translate(u'ThemesTab', u'Service level'))
|
||||
self.ServiceLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from the service, overriding any of the individual songs\' themes. If the service doesn\'t have a theme, then use the global theme.'))
|
||||
self.GlobalLevelRadioButton.setText(translate(u'ThemesTab', u'Global level'))
|
||||
self.GlobalLevelRadioButton.setText(
|
||||
translate(u'ThemesTab', u'Global level'))
|
||||
self.GlobalLevelLabel.setText(translate(u'ThemesTab', u'Use the global theme, overriding any themes associated with either the service or the songs.'))
|
||||
|
||||
def load(self):
|
||||
self.global_style = self.config.get_config(u'theme global style', u'Global')
|
||||
self.global_style = self.config.get_config(
|
||||
u'theme global style', u'Global')
|
||||
self.global_theme = self.config.get_config(u'theme global theme', u'')
|
||||
if self.global_style == u'Global':
|
||||
self.GlobalLevelRadioButton.setChecked(True)
|
||||
@ -126,29 +131,35 @@ class ThemesTab(SettingsTab):
|
||||
def save(self):
|
||||
self.config.set_config(u'theme global style', self.global_style )
|
||||
self.config.set_config(u'theme global theme',self.global_theme)
|
||||
Receiver().send_message(u'update_global_theme', self.global_theme )
|
||||
Receiver().send_message(u'update_global_theme', self.global_theme )
|
||||
|
||||
def postSetUp(self):
|
||||
Receiver().send_message(u'update_global_theme', self.global_theme )
|
||||
Receiver().send_message(u'update_global_theme', self.global_theme )
|
||||
|
||||
def onSongLevelButtonPressed(self):
|
||||
self.global_style= u'Song'
|
||||
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
|
||||
self.parent.RenderManager.set_global_theme(
|
||||
self.global_theme, self.global_style)
|
||||
|
||||
def onServiceLevelButtonPressed(self):
|
||||
self.global_style= u'Service'
|
||||
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
|
||||
self.parent.RenderManager.set_global_theme(
|
||||
self.global_theme, self.global_style)
|
||||
|
||||
def onGlobalLevelButtonPressed(self):
|
||||
self.global_style= u'Global'
|
||||
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
|
||||
self.parent.RenderManager.set_global_theme(
|
||||
self.global_theme, self.global_style)
|
||||
|
||||
def onDefaultComboBoxChanged(self, value):
|
||||
self.global_theme = unicode(self.DefaultComboBox.currentText())
|
||||
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
|
||||
image = self.parent.ThemeManagerContents.getPreviewImage(self.global_theme)
|
||||
self.parent.RenderManager.set_global_theme(
|
||||
self.global_theme, self.global_style)
|
||||
image = self.parent.ThemeManagerContents.getPreviewImage(
|
||||
self.global_theme)
|
||||
preview = QtGui.QPixmap(unicode(image))
|
||||
display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
|
||||
QtCore.Qt.SmoothTransformation)
|
||||
self.DefaultListView.setPixmap(display)
|
||||
|
||||
def updateThemeList(self, theme_list):
|
||||
@ -160,14 +171,18 @@ class ThemesTab(SettingsTab):
|
||||
self.DefaultComboBox.clear()
|
||||
for theme in theme_list:
|
||||
self.DefaultComboBox.addItem(theme)
|
||||
id = self.DefaultComboBox.findText(self.global_theme, QtCore.Qt.MatchExactly)
|
||||
id = self.DefaultComboBox.findText(
|
||||
self.global_theme, QtCore.Qt.MatchExactly)
|
||||
if id == -1:
|
||||
id = 0 # Not Found
|
||||
self.global_theme = u''
|
||||
self.DefaultComboBox.setCurrentIndex(id)
|
||||
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
|
||||
self.parent.RenderManager.set_global_theme(
|
||||
self.global_theme, self.global_style)
|
||||
if self.global_theme is not u'':
|
||||
image = self.parent.ThemeManagerContents.getPreviewImage(self.global_theme)
|
||||
image = self.parent.ThemeManagerContents.getPreviewImage(
|
||||
self.global_theme)
|
||||
preview = QtGui.QPixmap(unicode(image))
|
||||
display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
|
||||
QtCore.Qt.SmoothTransformation)
|
||||
self.DefaultListView.setPixmap(display)
|
||||
|
@ -31,17 +31,18 @@ from openlp.core.lib import PluginConfig
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.sql import select
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker, mapper, relation, clear_mappers
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker, mapper, relation, \
|
||||
clear_mappers
|
||||
from openlp.plugins.songs.lib.models import metadata, session, \
|
||||
engine, songs_table, Song, Author, Topic, Book
|
||||
engine, songs_table, Song, Author, Topic, Book
|
||||
from openlp.plugins.songs.lib.tables import *
|
||||
from openlp.plugins.songs.lib.classes import *
|
||||
|
||||
def init_models(url):
|
||||
engine = create_engine(url)
|
||||
metadata.bind = engine
|
||||
session = scoped_session(sessionmaker(autoflush=True, autocommit=False,
|
||||
bind=engine))
|
||||
session = scoped_session(
|
||||
sessionmaker(autoflush=True, autocommit=False, bind=engine))
|
||||
mapper(Author, authors_table)
|
||||
mapper(TAuthor, temp_authors_table)
|
||||
mapper(Book, song_books_table)
|
||||
@ -57,7 +58,7 @@ def init_models(url):
|
||||
return session
|
||||
|
||||
temp_authors_table = Table(u'authors_temp', metadata,
|
||||
Column(u'authorid', types.Integer, primary_key=True),
|
||||
Column(u'authorid', types.Integer, primary_key=True),
|
||||
Column(u'authorname', String(40))
|
||||
)
|
||||
|
||||
@ -154,14 +155,18 @@ class MigrateSongs():
|
||||
song.search_title = u''
|
||||
song.search_lyrics = u''
|
||||
print songs_temp.songtitle
|
||||
aa = self.session.execute(u'select * from songauthors_temp where songid =' + unicode(songs_temp.songid) )
|
||||
aa = self.session.execute(
|
||||
u'select * from songauthors_temp where songid =' + \
|
||||
unicode(songs_temp.songid) )
|
||||
for row in aa:
|
||||
a = row['authorid']
|
||||
authors_temp = self.session.query(TAuthor).get(a)
|
||||
bb = self.session.execute(u'select * from authors where display_name = \"%s\"' % unicode(authors_temp.authorname) ).fetchone()
|
||||
bb = self.session.execute(
|
||||
u'select * from authors where display_name = \"%s\"' % \
|
||||
unicode(authors_temp.authorname) ).fetchone()
|
||||
if bb is None:
|
||||
author = Author()
|
||||
author.display_name = authors_temp.authorname
|
||||
author.display_name = authors_temp.authorname
|
||||
author.first_name = u''
|
||||
author.last_name = u''
|
||||
else:
|
||||
@ -180,11 +185,11 @@ class MigrateSongs():
|
||||
conn = sqlite3.connect(self.data_path + os.sep + database)
|
||||
conn.execute("""update songs set search_title =
|
||||
replace(replace(replace(replace(replace(replace(replace(replace(
|
||||
replace(title, '&', 'and'), ',', ''), ';', ''), ':', ''),
|
||||
replace(title, '&', 'and'), ',', ''), ';', ''), ':', ''),
|
||||
'(u', ''), ')', ''), '{', ''), '}',''),'?','');""")
|
||||
conn.execute("""update songs set search_lyrics =
|
||||
replace(replace(replace(replace(replace(replace(replace(replace(
|
||||
replace(lyrics, '&', 'and'), ',', ''), ';', ''), ':', ''),
|
||||
replace(lyrics, '&', 'and'), ',', ''), ';', ''), ':', ''),
|
||||
'(u', ''), ')', ''), '{', ''), '}',''),'?','')
|
||||
;""")
|
||||
conn.commit()
|
||||
|
@ -27,7 +27,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from datetime import date
|
||||
|
||||
from openlp.core.lib import Plugin, Receiver, translate, str_to_bool
|
||||
from openlp.core.lib import Plugin, Receiver, translate, str_to_bool
|
||||
from openlp.plugins.audit.lib import AuditTab
|
||||
|
||||
class AuditPlugin(Plugin):
|
||||
@ -98,7 +98,8 @@ class AuditPlugin(Plugin):
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'audit_changed'), self.onUpdateAudit)
|
||||
self.auditFileName = self.config.get_config(u'audit file', u'')
|
||||
self.auditActive = str_to_bool(self.config.get_config(u'audit active', False))
|
||||
self.auditActive = str_to_bool(
|
||||
self.config.get_config(u'audit active', False))
|
||||
if self.auditFileName == u'':
|
||||
self.auditActive = False
|
||||
self.ToolsAuditItem.setEnabled(False)
|
||||
@ -117,7 +118,8 @@ class AuditPlugin(Plugin):
|
||||
"""
|
||||
if self.auditActive:
|
||||
for author in auditData[1]:
|
||||
self.auditFile.write(u'\"%s\",\"%s\",\"%s\",\"%s\"\n' % (date.today(), auditData[0], author, auditData[2]))
|
||||
self.auditFile.write(u'\"%s\",\"%s\",\"%s\",\"%s\"\n' % \
|
||||
(date.today(), auditData[0], author, auditData[2]))
|
||||
self.auditFile.flush()
|
||||
|
||||
def onUpdateAudit(self):
|
||||
@ -126,7 +128,8 @@ class AuditPlugin(Plugin):
|
||||
Sort out the file and the auditing state
|
||||
"""
|
||||
self.auditFileNameNew = self.config.get_config(u'audit file', u'')
|
||||
self.auditActive = str_to_bool(self.config.get_config(u'audit active', False))
|
||||
self.auditActive = str_to_bool(
|
||||
self.config.get_config(u'audit active', False))
|
||||
if self.auditFileNameNew == u'':
|
||||
self.auditActive = False
|
||||
self.ToolsAuditItem.setChecked(self.auditActive)
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate, Receiver
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate, Receiver
|
||||
|
||||
class AuditTab(SettingsTab):
|
||||
"""
|
||||
@ -45,7 +45,8 @@ class AuditTab(SettingsTab):
|
||||
self.AuditFileName.setObjectName("AuditFileName")
|
||||
self.horizontalLayout.addWidget(self.AuditFileName)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.AuditFileButton = QtGui.QPushButton(self)
|
||||
self.AuditFileButton.setObjectName("AuditFileButton")
|
||||
self.AuditFileButton.setIcon(icon1)
|
||||
@ -63,19 +64,23 @@ class AuditTab(SettingsTab):
|
||||
def retranslateUi(self):
|
||||
self.AuditModeGroupBox.setTitle(translate(u'AuditTab', u'Audit File'))
|
||||
self.AuditActive.setText(translate(u'AuditTab', 'Audit available:'))
|
||||
self.WarningLabel.setText(translate(u'AuditTab', u'A restart is needed for this change to become effective'))
|
||||
self.WarningLabel.setText(translate(u'AuditTab',
|
||||
u'A restart is needed for this change to become effective'))
|
||||
|
||||
def load(self):
|
||||
self.AuditFileName.setText(self.config.get_config(u'Audit file', u''))
|
||||
self.AuditActive.setChecked(int(self.config.get_config(u'startup', 0)))
|
||||
|
||||
def onAuditFileButtonClicked(self):
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self, u'Audit File',self.AuditFileName.text())
|
||||
filename = QtGui.QFileDialog.getOpenFileName(
|
||||
self, u'Audit File',self.AuditFileName.text())
|
||||
if filename != u'':
|
||||
filename = unicode(filename)
|
||||
self.AuditFileName.setText(filename)
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(u'Audit file', unicode(self.AuditFileName.text()))
|
||||
self.config.set_config(u'startup', unicode(self.AuditActive.checkState()))
|
||||
self.config.set_config(
|
||||
u'Audit file', unicode(self.AuditFileName.text()))
|
||||
self.config.set_config(
|
||||
u'startup', unicode(self.AuditActive.checkState()))
|
||||
Receiver().send_message(u'audit_changed')
|
||||
|
@ -25,7 +25,6 @@
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.QtCore import *
|
||||
|
||||
from openlp.core.lib import Plugin, translate
|
||||
|
||||
@ -62,7 +61,8 @@ class BiblePlugin(Plugin):
|
||||
import_menu.addAction(self.ImportBibleItem)
|
||||
self.ImportBibleItem.setText(translate(u'BiblePlugin', u'&Bible'))
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.ImportBibleItem, QtCore.SIGNAL(u'triggered()'), self.onBibleNewClick)
|
||||
QtCore.QObject.connect(self.ImportBibleItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onBibleNewClick)
|
||||
|
||||
def add_export_menu_item(self, export_menu):
|
||||
self.ExportBibleItem = QtGui.QAction(export_menu)
|
||||
|
@ -31,7 +31,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from bibleimportdialog import Ui_BibleImportDialog
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.lib import Receiver, translate
|
||||
|
||||
|
||||
class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
||||
@ -41,7 +41,7 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
||||
"""
|
||||
Class documentation goes here.
|
||||
"""
|
||||
def __init__(self, config, biblemanager , bibleplugin, parent = None):
|
||||
def __init__(self, config, biblemanager, bibleplugin, parent=None):
|
||||
'''
|
||||
Constructor
|
||||
'''
|
||||
@ -196,23 +196,28 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
||||
log.debug(u'Import Bible')
|
||||
message = None
|
||||
if self.bible_type == u'OSIS':
|
||||
loaded = self.biblemanager.register_osis_file_bible(unicode(self.BibleNameEdit.displayText()),
|
||||
loaded = self.biblemanager.register_osis_file_bible(
|
||||
unicode(self.BibleNameEdit.displayText()),
|
||||
self.OSISLocationEdit.displayText())
|
||||
elif self.bible_type == u'CSV':
|
||||
loaded = self.biblemanager.register_csv_file_bible(unicode(self.BibleNameEdit.displayText()),
|
||||
self.BooksLocationEdit.displayText(), self.VerseLocationEdit.displayText())
|
||||
loaded = self.biblemanager.register_csv_file_bible(
|
||||
unicode(self.BibleNameEdit.displayText()),
|
||||
self.BooksLocationEdit.displayText(),
|
||||
self.VerseLocationEdit.displayText())
|
||||
else:
|
||||
# set a value as it will not be needed
|
||||
self.setMax(1)
|
||||
bible = self.bible_versions[unicode(self.BibleComboBox.currentText())]
|
||||
loaded = self.biblemanager.register_http_bible(unicode(self.BibleComboBox.currentText()), \
|
||||
unicode(self.LocationComboBox.currentText()), \
|
||||
unicode(bible), \
|
||||
unicode(self.AddressEdit.displayText()), \
|
||||
unicode(self.UsernameEdit .displayText()), \
|
||||
unicode(self.PasswordEdit.displayText()))
|
||||
bible = self.bible_versions[
|
||||
unicode(self.BibleComboBox.currentText())]
|
||||
loaded = self.biblemanager.register_http_bible(
|
||||
unicode(self.BibleComboBox.currentText()),
|
||||
unicode(self.LocationComboBox.currentText()),
|
||||
unicode(bible), unicode(self.AddressEdit.displayText()),
|
||||
unicode(self.UsernameEdit .displayText()),
|
||||
unicode(self.PasswordEdit.displayText()))
|
||||
if loaded:
|
||||
self.biblemanager.save_meta_data(unicode(self.BibleNameEdit.displayText()),
|
||||
self.biblemanager.save_meta_data(
|
||||
unicode(self.BibleNameEdit.displayText()),
|
||||
unicode(self.VersionNameEdit.displayText()),
|
||||
unicode(self.CopyrightEdit.displayText()),
|
||||
unicode(self.PermisionEdit.displayText()))
|
||||
@ -226,7 +231,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
||||
return loaded, message
|
||||
|
||||
def checkOsis(self):
|
||||
if len(self.BooksLocationEdit.displayText()) > 0 or len(self.VerseLocationEdit.displayText()) > 0:
|
||||
if len(self.BooksLocationEdit.displayText()) > 0 or \
|
||||
len(self.VerseLocationEdit.displayText()) > 0:
|
||||
self.setCsv()
|
||||
else:
|
||||
# Was CSV and is not any more stops lostFocus running mad
|
||||
@ -235,7 +241,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
||||
self.resetScreenFieldStates()
|
||||
|
||||
def checkHttp(self):
|
||||
if self.BibleComboBox.currentIndex() != 0 : # First slot is blank so no bible
|
||||
if self.BibleComboBox.currentIndex() != 0 :
|
||||
# First slot is blank so no bible
|
||||
self.setHttp()
|
||||
else:
|
||||
# Was HTTP and is not any more stops lostFocus running mad
|
||||
|
@ -42,7 +42,8 @@ class BibleCSVImpl(BibleCommon):
|
||||
"""
|
||||
self.bibledb = bibledb
|
||||
self.loadbible = True
|
||||
QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL(u'openlpstopimport'),self.stop_import)
|
||||
QtCore.QObject.connect(Receiver().get_receiver(),
|
||||
QtCore.SIGNAL(u'openlpstopimport'), self.stop_import)
|
||||
|
||||
def stop_import(self):
|
||||
self.loadbible= False
|
||||
@ -80,7 +81,7 @@ class BibleCSVImpl(BibleCommon):
|
||||
# split into 3 units and leave the rest as a single field
|
||||
p = line.split(u',', 3)
|
||||
p0 = p[0].replace(u'"', u'')
|
||||
p3 = p[3].replace(u'"',u'')
|
||||
p3 = p[3].replace(u'"',u'')
|
||||
if book_ptr is not p0:
|
||||
book = self.bibledb.get_bible_book(p0)
|
||||
book_ptr = book.name
|
||||
|
@ -59,7 +59,7 @@ class BibleDBImpl(BibleCommon):
|
||||
self._load_testament(u'New Testament')
|
||||
self._load_testament(u'Apocrypha')
|
||||
|
||||
def add_verse(self, bookid, chap, vse, text):
|
||||
def add_verse(self, bookid, chap, vse, text):
|
||||
#log.debug(u'add_verse %s,%s,%s", bookid, chap, vse)
|
||||
verse = Verse()
|
||||
verse.book_id = bookid
|
||||
@ -113,7 +113,7 @@ class BibleDBImpl(BibleCommon):
|
||||
return False
|
||||
|
||||
def _load_testament(self, testament):
|
||||
log.debug(u'load_testaments %s', testament)
|
||||
log.debug(u'load_testaments %s', testament)
|
||||
test = ONTestament()
|
||||
test.name = testament
|
||||
self.session.add(test)
|
||||
|
@ -39,21 +39,32 @@ class BGExtract(BibleCommon):
|
||||
log.debug(u'init %s', proxyurl)
|
||||
self.proxyurl = proxyurl
|
||||
|
||||
def get_bible_chapter(self, version, bookid, bookname, chapter) :
|
||||
def get_bible_chapter(self, version, bookid, bookname, chapter) :
|
||||
"""
|
||||
Access and decode bibles via the BibleGateway website
|
||||
Version - the version of the bible like 31 for New International version
|
||||
bookid - Book id for the book of the bible - eg 1 for Genesis
|
||||
bookname - not used
|
||||
chapter - chapter number
|
||||
|
||||
``Version``
|
||||
The version of the bible like 31 for New International version
|
||||
|
||||
``bookid``
|
||||
Book id for the book of the bible - eg 1 for Genesis
|
||||
|
||||
``bookname``
|
||||
Not used
|
||||
|
||||
``chapter``
|
||||
Chapter number
|
||||
"""
|
||||
log.debug( u'get_bible_chapter %s,%s,%s,%s', version, bookid, bookname, chapter)
|
||||
urlstring = u'http://www.biblegateway.com/passage/?book_id='+unicode(bookid)+u'&chapter'+unicode(chapter)+u'&version='+unicode(version)
|
||||
log.debug(u'get_bible_chapter %s,%s,%s,%s',
|
||||
version, bookid, bookname, chapter)
|
||||
urlstring = u'http://www.biblegateway.com/passage/?book_id=' + \
|
||||
unicode(bookid) + u'&chapter' + unicode(chapter) + u'&version=' + \
|
||||
unicode(version)
|
||||
xml_string = self._get_web_text(urlstring, self.proxyurl)
|
||||
#print xml_string
|
||||
VerseSearch = u'class='+u'"'+u'sup'+u'"'+u'>'
|
||||
VerseSearch = u'class=' + u'"' + u'sup' + u'"' + u'>'
|
||||
verse = 1
|
||||
i= xml_string.find(u'result-text-style-normal')
|
||||
i = xml_string.find(u'result-text-style-normal')
|
||||
xml_string = xml_string[i:len(xml_string)]
|
||||
versePos = xml_string.find(VerseSearch)
|
||||
#print versePos
|
||||
@ -62,11 +73,11 @@ class BGExtract(BibleCommon):
|
||||
verseText = '' # clear out string
|
||||
versePos = xml_string.find(u'</span', versePos)
|
||||
i = xml_string.find(VerseSearch, versePos+1)
|
||||
#print i , versePos
|
||||
#print i , versePos
|
||||
if i == -1:
|
||||
i = xml_string.find(u'</div', versePos+1)
|
||||
j = xml_string.find(u'<strong', versePos+1)
|
||||
#print i , j
|
||||
#print i , j
|
||||
if j > 0 and j < i:
|
||||
i = j
|
||||
verseText = xml_string[versePos + 7 : i ]
|
||||
@ -75,9 +86,11 @@ class BGExtract(BibleCommon):
|
||||
bible[verse] = self._clean_text(verseText) # store the verse
|
||||
versePos = -1
|
||||
else:
|
||||
i = xml_string[:i].rfind(u'<span')+1
|
||||
verseText = xml_string[versePos + 7 : i - 1 ] # Loose the </span>
|
||||
xml_string = xml_string[i - 1 :len(xml_string)] # chop off verse 1
|
||||
i = xml_string[:i].rfind(u'<span') + 1
|
||||
# Loose the </span>
|
||||
verseText = xml_string[versePos + 7 : i - 1 ]
|
||||
# Chop off verse 1
|
||||
xml_string = xml_string[i - 1 :len(xml_string)]
|
||||
versePos = xml_string.find(VerseSearch) #look for the next verse
|
||||
bible[verse] = self._clean_text(verseText) # store the verse
|
||||
verse += 1
|
||||
@ -92,16 +105,26 @@ class CWExtract(BibleCommon):
|
||||
log.debug(u'init %s', proxyurl)
|
||||
self.proxyurl = proxyurl
|
||||
|
||||
def get_bible_chapter(self, version, bookid, bookname, chapter) :
|
||||
log.debug( u'getBibleChapter %s,%s,%s,%s', version, bookid, bookname, chapter)
|
||||
def get_bible_chapter(self, version, bookid, bookname, chapter) :
|
||||
log.debug(u'getBibleChapter %s,%s,%s,%s',
|
||||
version, bookid, bookname, chapter)
|
||||
"""
|
||||
Access and decode bibles via the Crosswalk website
|
||||
Version - the version of the bible like niv for New International version
|
||||
bookid - not used
|
||||
bookname - text name of in english eg 'gen' for Genesis
|
||||
chapter - chapter number
|
||||
|
||||
``version``
|
||||
The version of the bible like niv for New International Version
|
||||
|
||||
``bookid``
|
||||
Not used
|
||||
|
||||
``bookname``
|
||||
Text name of in english e.g. 'gen' for Genesis
|
||||
|
||||
``chapter``
|
||||
Chapter number
|
||||
"""
|
||||
log.debug(u'get_bible_chapter %s,%s,%s,%s', version, bookid, bookname, chapter)
|
||||
log.debug(u'get_bible_chapter %s,%s,%s,%s',
|
||||
version, bookid, bookname, chapter)
|
||||
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)
|
||||
@ -135,7 +158,7 @@ class CWExtract(BibleCommon):
|
||||
#remove the <B> at the front
|
||||
xml_string = xml_string[i + 3 :len(xml_string)]
|
||||
versePos = xml_string.find(u'<BLOCKQUOTE>')
|
||||
#log.debug(u'verse pos %d', versePos)
|
||||
#log.debug(u'verse pos %d', versePos)
|
||||
bible = {}
|
||||
while versePos > 0:
|
||||
verseText = u''
|
||||
@ -153,7 +176,7 @@ class CWExtract(BibleCommon):
|
||||
verseText = xml_string[versePos: i]
|
||||
versePos = 0
|
||||
else:
|
||||
#log.debug( i, versePos)
|
||||
#log.debug( i, versePos)
|
||||
verseText = xml_string[versePos: i]
|
||||
versePos = i
|
||||
#print verseText
|
||||
@ -170,7 +193,9 @@ class BibleHTTPImpl():
|
||||
def __init__(self):
|
||||
"""
|
||||
Finds all the bibles defined for the system
|
||||
Creates an Interface Object for each bible containing connection information
|
||||
Creates an Interface Object for each bible containing connection
|
||||
information
|
||||
|
||||
Throws Exception if no Bibles are found.
|
||||
|
||||
Init confirms the bible exists and stores the database path.
|
||||
@ -202,18 +227,19 @@ class BibleHTTPImpl():
|
||||
log.debug(u'set_bible_source %s', biblesource)
|
||||
self.biblesource = biblesource
|
||||
|
||||
def get_bible_chapter(self, version, bookid, bookname, chapter):
|
||||
def get_bible_chapter(self, version, bookid, bookname, chapter):
|
||||
"""
|
||||
Receive the request and call the relevant handler methods
|
||||
"""
|
||||
log.debug(u'get_bible_chapter %s,%s,%s,%s', version, bookid, bookname, chapter)
|
||||
log.debug(u'get_bible_chapter %s,%s,%s,%s',
|
||||
version, bookid, bookname, chapter)
|
||||
log.debug(u'biblesource = %s', self.biblesource)
|
||||
try:
|
||||
if self.biblesource.lower() == u'crosswalk':
|
||||
ev = CWExtract(self.proxyurl)
|
||||
else:
|
||||
ev = BGExtract(self.proxyurl)
|
||||
return ev.get_bible_chapter(self.bibleid, bookid, bookname, chapter)
|
||||
return ev.get_bible_chapter(self.bibleid, bookid, bookname, chapter)
|
||||
except Exception, e:
|
||||
log.error(u'Error thrown = %s', e.args[0])
|
||||
print e
|
||||
|
@ -86,7 +86,7 @@ class BibleOSISImpl():
|
||||
The Import dialog, so that we can increase the counter on
|
||||
the progress bar.
|
||||
"""
|
||||
detect_file = open(osisfile_record, u'r')
|
||||
detect_file = open(osisfile_record, u'r')
|
||||
details = chardet.detect(detect_file.read(2048))
|
||||
detect_file.close()
|
||||
osis = codecs.open(osisfile_record, u'r', details['encoding'])
|
||||
@ -102,7 +102,7 @@ class BibleOSISImpl():
|
||||
pos = file_record.find(verseText)
|
||||
if pos > -1: # we have a verse
|
||||
epos= file_record.find(u'>', pos)
|
||||
ref = file_record[pos+15:epos-1] # Book Reference
|
||||
ref = file_record[pos+15:epos-1] # Book Reference
|
||||
#lets find the bible text only
|
||||
# find start of text
|
||||
pos = epos + 1
|
||||
@ -113,10 +113,10 @@ class BibleOSISImpl():
|
||||
text = self.remove_block(u'<title', u'</title>', text)
|
||||
text = self.remove_block(u'<note', u'</note>', text)
|
||||
text = self.remove_block(u'<divineName', u'</divineName>', text)
|
||||
text = self.remove_tag(u'<lb', text)
|
||||
text = self.remove_tag(u'<q', text)
|
||||
text = self.remove_tag(u'<l', text)
|
||||
text = self.remove_tag(u'<lg', text)
|
||||
text = self.remove_tag(u'<lb', text)
|
||||
text = self.remove_tag(u'<q', text)
|
||||
text = self.remove_tag(u'<l', text)
|
||||
text = self.remove_tag(u'<lg', text)
|
||||
# Strange tags where the end is not the same as the start
|
||||
# The must be in this order as at least one bible has them
|
||||
# crossing and the removal does not work.
|
||||
@ -127,12 +127,12 @@ class BibleOSISImpl():
|
||||
#print "Y", search_text, e
|
||||
pos = -1
|
||||
else:
|
||||
text = text[:pos] + text[epos + 4: ]
|
||||
text = text[:pos] + text[epos + 4: ]
|
||||
pos = text.find(u'<FI>')
|
||||
pos = text.find(u'<RF>')
|
||||
while pos > -1:
|
||||
epos = text.find(u'<Rf>', pos)
|
||||
text = text[:pos] + text[epos + 4: ]
|
||||
text = text[:pos] + text[epos + 4: ]
|
||||
#print "X", pos, epos, text
|
||||
pos = text.find(u'<RF>')
|
||||
# split up the reference
|
||||
@ -184,7 +184,7 @@ class BibleOSISImpl():
|
||||
if epos == -1:
|
||||
pos = -1
|
||||
else:
|
||||
text = text[:pos] + text[epos + len(end_tag): ]
|
||||
text = text[:pos] + text[epos + len(end_tag): ]
|
||||
pos = text.find(start_tag)
|
||||
return text
|
||||
|
||||
@ -203,6 +203,6 @@ class BibleOSISImpl():
|
||||
pos = text.find(start_tag)
|
||||
while pos > -1:
|
||||
epos = text.find(u'/>', pos)
|
||||
text = text[:pos] + text[epos + 2: ]
|
||||
text = text[:pos] + text[epos + 2: ]
|
||||
pos = text.find(start_tag)
|
||||
return text
|
||||
|
@ -26,7 +26,7 @@ import logging
|
||||
|
||||
from PyQt4 import Qt, QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, str_to_bool, Receiver
|
||||
from openlp.core.lib import translate, str_to_bool, Receiver
|
||||
from openlp.core.lib import SettingsTab
|
||||
|
||||
class BiblesTab(SettingsTab):
|
||||
@ -42,7 +42,8 @@ class BiblesTab(SettingsTab):
|
||||
self.show_new_chapters = False
|
||||
self.display_style = 0
|
||||
self.bible_search = True
|
||||
SettingsTab.__init__(self, translate(u'BiblesTab', u'Bibles'), u'Bibles')
|
||||
SettingsTab.__init__(
|
||||
self, translate(u'BiblesTab', u'Bibles'), u'Bibles')
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'BiblesTab')
|
||||
@ -142,34 +143,53 @@ class BiblesTab(SettingsTab):
|
||||
self.BibleLayout.addWidget(self.BibleRightWidget)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.NewChaptersCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onNewChaptersCheckBoxChanged)
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onNewChaptersCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.BibleSearchCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onBibleSearchCheckBoxChanged)
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onBibleSearchCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.DisplayStyleComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.onDisplayStyleComboBoxChanged)
|
||||
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)
|
||||
QtCore.SIGNAL(u'activated(int)'),
|
||||
self.onLayoutStyleComboBoxChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'update_themes'), self.updateThemeList)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.VerseDisplayGroupBox.setTitle(translate(u'SettingsForm', u'Verse Display'))
|
||||
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 }'))
|
||||
self.DisplayStyleComboBox.setItemText(3, translate(u'SettingsForm', u'[ and ]'))
|
||||
self.ChangeNoteLabel.setText(translate(u'SettingsForm', u'Note:\nChanges don\'t affect verses already in the service'))
|
||||
self.BibleSearchGroupBox.setTitle(translate(u'SettingsForm', u'Search'))
|
||||
self.BibleSearchCheckBox.setText(translate(u'SettingsForm', u'Search-as-you-type'))
|
||||
self.VerseDisplayGroupBox.setTitle(
|
||||
translate(u'SettingsForm', u'Verse Display'))
|
||||
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 }'))
|
||||
self.DisplayStyleComboBox.setItemText(
|
||||
3, translate(u'SettingsForm', u'[ and ]'))
|
||||
self.ChangeNoteLabel.setText(translate(u'SettingsForm',
|
||||
u'Note:\nChanges don\'t affect verses already in the service'))
|
||||
self.BibleSearchGroupBox.setTitle(
|
||||
translate(u'SettingsForm', u'Search'))
|
||||
self.BibleSearchCheckBox.setText(
|
||||
translate(u'SettingsForm', u'Search-as-you-type'))
|
||||
|
||||
def onBibleThemeComboBoxChanged(self):
|
||||
self.bible_theme = self.BibleThemeComboBox.currentText()
|
||||
@ -195,20 +215,27 @@ class BiblesTab(SettingsTab):
|
||||
self.bible_search = True
|
||||
|
||||
def load(self):
|
||||
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.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'))
|
||||
self.bible_search = str_to_bool(
|
||||
self.config.get_config(u'search as type', u'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'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'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,7 +247,8 @@ class BiblesTab(SettingsTab):
|
||||
self.BibleThemeComboBox.addItem(u'')
|
||||
for theme in theme_list:
|
||||
self.BibleThemeComboBox.addItem(theme)
|
||||
id = self.BibleThemeComboBox.findText(unicode(self.bible_theme), QtCore.Qt.MatchExactly)
|
||||
id = self.BibleThemeComboBox.findText(
|
||||
unicode(self.bible_theme), QtCore.Qt.MatchExactly)
|
||||
if id == -1:
|
||||
# Not Found
|
||||
id = 0
|
||||
|
@ -81,7 +81,7 @@ class BibleManager(object):
|
||||
def reload_bibles(self):
|
||||
log.debug(u'Reload bibles')
|
||||
files = self.config.get_files(self.bibleSuffix)
|
||||
log.debug(u'Bible Files %s', files )
|
||||
log.debug(u'Bible Files %s', files )
|
||||
self.bible_db_cache = {}
|
||||
self.bible_http_cache = {}
|
||||
# books of the bible with testaments
|
||||
@ -166,7 +166,7 @@ class BibleManager(object):
|
||||
Defaults to *None*. The password to accompany the username.
|
||||
"""
|
||||
log.debug(u'register_HTTP_bible %s, %s, %s, %s, %s, %s',
|
||||
biblename, biblesource, bibleid, proxyurl, proxyid, proxypass)
|
||||
biblename, biblesource, bibleid, proxyurl, proxyid, proxypass)
|
||||
if self._is_new_bible(biblename):
|
||||
# Create new Bible
|
||||
nbible = BibleDBImpl(self.biblePath, biblename, self.config)
|
||||
@ -271,7 +271,7 @@ c
|
||||
log.debug(u'get_bible_books %s', bible)
|
||||
return self.bible_db_cache[bible].get_bible_books()
|
||||
|
||||
def get_book_chapter_count(self, bible, book):
|
||||
def get_book_chapter_count(self, bible, book):
|
||||
"""
|
||||
Returns the number of Chapters for a given book
|
||||
"""
|
||||
@ -283,7 +283,7 @@ c
|
||||
Returns all the number of verses for a given
|
||||
book and chapterMaxBibleBookVerses
|
||||
"""
|
||||
log.debug(u'get_book_verse_count %s,%s,%s', bible, book, chapter)
|
||||
log.debug(u'get_book_verse_count %s,%s,%s', bible, book, chapter)
|
||||
return self.bible_db_cache[bible].get_max_bible_book_verses(
|
||||
book, chapter)
|
||||
|
||||
@ -300,7 +300,7 @@ c
|
||||
Saves the bibles meta data
|
||||
"""
|
||||
log.debug(u'save_meta data %s,%s, %s,%s',
|
||||
bible, version, copyright, permissions)
|
||||
bible, version, copyright, permissions)
|
||||
self.bible_db_cache[bible].save_meta(u'Version', version)
|
||||
self.bible_db_cache[bible].save_meta(u'Copyright', copyright)
|
||||
self.bible_db_cache[bible].save_meta(u'Permissions', permissions)
|
||||
@ -309,7 +309,7 @@ c
|
||||
"""
|
||||
Returns the meta data for a given key
|
||||
"""
|
||||
log.debug(u'get_meta %s,%s', bible, key)
|
||||
log.debug(u'get_meta %s,%s', bible, key)
|
||||
return self.bible_db_cache[bible].get_meta(key)
|
||||
|
||||
def get_verse_text(self, bible, bookname, schapter, echapter, sverse,
|
||||
@ -414,7 +414,7 @@ c
|
||||
"""
|
||||
Check cache to see if new bible
|
||||
"""
|
||||
for b , o in self.bible_db_cache.iteritems():
|
||||
for b , o in self.bible_db_cache.iteritems():
|
||||
log.debug(u'Bible from cache in is_new_bible %s', b )
|
||||
if b == name :
|
||||
return False
|
||||
|
@ -28,7 +28,7 @@ import time
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, ServiceItem, MediaManagerItem, \
|
||||
Receiver, contextMenuAction, contextMenuSeparator, BaseListWithDnD
|
||||
Receiver, contextMenuAction, contextMenuSeparator, BaseListWithDnD
|
||||
from openlp.plugins.bibles.forms import BibleImportForm
|
||||
from openlp.plugins.bibles.lib.manager import BibleMode
|
||||
|
||||
@ -329,10 +329,10 @@ class BibleMediaItem(MediaManagerItem):
|
||||
log.debug(u'Advanced Search Button pressed')
|
||||
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
||||
book = unicode(self.AdvancedBookComboBox.currentText())
|
||||
chapter_from = int(self.AdvancedFromChapter.currentText())
|
||||
chapter_to = int(self.AdvancedToChapter.currentText())
|
||||
verse_from = int(self.AdvancedFromVerse.currentText())
|
||||
verse_to = int(self.AdvancedToVerse.currentText())
|
||||
chapter_from = int(self.AdvancedFromChapter.currentText())
|
||||
chapter_to = int(self.AdvancedToChapter.currentText())
|
||||
verse_from = int(self.AdvancedFromVerse.currentText())
|
||||
verse_to = int(self.AdvancedToVerse.currentText())
|
||||
self.search_results = self.parent.biblemanager.get_verse_text(
|
||||
bible, book, chapter_from, chapter_to, verse_from, verse_to)
|
||||
if self.ClearAdvancedSearchComboBox.currentIndex() == 0:
|
||||
@ -374,7 +374,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
raw_footer = []
|
||||
bible_text = u''
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
bitem = self.ListView.item(item.row())
|
||||
text = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
|
||||
verse = text[:text.find(u'(')]
|
||||
bible = text[text.find(u'(') + 1:-1]
|
||||
@ -457,13 +457,13 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.adjustComboBox(1, self.verses, self.AdvancedToVerse)
|
||||
|
||||
def adjustComboBox(self, frm, to , combo):
|
||||
log.debug(u'adjustComboBox %s , %s , %s', combo, frm, to)
|
||||
log.debug(u'adjustComboBox %s , %s , %s', combo, frm, to)
|
||||
combo.clear()
|
||||
for i in range(int(frm), int(to) + 1):
|
||||
combo.addItem(unicode(i))
|
||||
|
||||
def displayResults(self, bible):
|
||||
for count, verse in enumerate(self.search_results):
|
||||
for count, verse in enumerate(self.search_results):
|
||||
bible_text = u' %s %d:%d (%s)' % (verse.book.name,
|
||||
verse.chapter, verse.verse, bible)
|
||||
bible_verse = QtGui.QListWidgetItem(bible_text)
|
||||
@ -474,7 +474,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if cr is not None:
|
||||
cr.setSelected(True)
|
||||
|
||||
def searchByReference(self, bible, search):
|
||||
def searchByReference(self, bible, search):
|
||||
log.debug(u'searchByReference %s ,%s', bible, search)
|
||||
book = u''
|
||||
start_chapter = u''
|
||||
@ -529,7 +529,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
sp1 = sp[1].split(u':')
|
||||
if len(sp1) == 1:
|
||||
end_chapter = start_chapter
|
||||
end_verse = sp1[0]
|
||||
end_verse = sp1[0]
|
||||
else:
|
||||
end_chapter = sp1[0]
|
||||
end_verse = sp1[1]
|
||||
|
@ -115,7 +115,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
self.ThemeComboBox.setCurrentIndex(0)
|
||||
|
||||
def accept(self):
|
||||
valid , message = self._validate()
|
||||
valid , message = self._validate()
|
||||
if not valid:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'customEditDialog', u'Error'), message,
|
||||
@ -126,7 +126,8 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
sxml.add_lyrics_to_song()
|
||||
count = 1
|
||||
for i in range (0, self.VerseListView.count()):
|
||||
sxml.add_verse_to_lyrics(u'custom', unicode(count), unicode(self.VerseListView.item(i).text()))
|
||||
sxml.add_verse_to_lyrics(u'custom', unicode(count),
|
||||
unicode(self.VerseListView.item(i).text()))
|
||||
count += 1
|
||||
self.customSlide.title = unicode(self.TitleEdit.displayText())
|
||||
self.customSlide.text = unicode(sxml.extract_xml())
|
||||
@ -201,9 +202,11 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
for row in unicode(self.VerseTextEdit.toPlainText()).split(u'---'):
|
||||
self.VerseListView.addItem(row)
|
||||
else:
|
||||
self.VerseListView.currentItem().setText(self.VerseTextEdit.toPlainText())
|
||||
self.VerseListView.currentItem().setText(
|
||||
self.VerseTextEdit.toPlainText())
|
||||
#number of lines has change
|
||||
if len(self.beforeText.split(u'\n')) != len(self.VerseTextEdit.toPlainText().split(u'\n')):
|
||||
if len(self.beforeText.split(u'\n')) != \
|
||||
len(self.VerseTextEdit.toPlainText().split(u'\n')):
|
||||
tempList = {}
|
||||
for row in range(0, self.VerseListView.count()):
|
||||
tempList[row] = self.VerseListView.item(row).text()
|
||||
@ -227,9 +230,11 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
message = u''
|
||||
if len(self.TitleEdit.displayText()) == 0:
|
||||
valid = False
|
||||
message = translate(u'customEditDialog', u'You need to enter a title \n')
|
||||
message = translate(
|
||||
u'customEditDialog', u'You need to enter a title \n')
|
||||
# must have 1 slide
|
||||
if self.VerseListView.count() == 0:
|
||||
valid = False
|
||||
message += translate(u'customEditDialog', u'You need to enter a slide \n')
|
||||
return valid, message
|
||||
message += translate(
|
||||
u'customEditDialog', u'You need to enter a slide \n')
|
||||
return valid, message
|
||||
|
@ -26,7 +26,7 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, ServiceItem, \
|
||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, ServiceItem, \
|
||||
translate, contextMenuAction, contextMenuSeparator, BaseListWithDnD
|
||||
|
||||
class CustomListView(BaseListWithDnD):
|
||||
@ -65,7 +65,8 @@ class CustomMediaItem(MediaManagerItem):
|
||||
self.ListView.clear()
|
||||
for CustomSlide in list:
|
||||
custom_name = QtGui.QListWidgetItem(CustomSlide.title)
|
||||
custom_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(CustomSlide.id))
|
||||
custom_name.setData(
|
||||
QtCore.Qt.UserRole, QtCore.QVariant(CustomSlide.id))
|
||||
self.ListView.addItem(custom_name)
|
||||
|
||||
def onNewClick(self):
|
||||
|
@ -27,7 +27,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Plugin
|
||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||
|
||||
class ImagePlugin(Plugin):
|
||||
global log
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate, Receiver
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate, Receiver
|
||||
|
||||
class ImageTab(SettingsTab):
|
||||
"""
|
||||
@ -53,7 +53,8 @@ class ImageTab(SettingsTab):
|
||||
self.TimeoutSpacer = QtGui.QSpacerItem(147, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.TimeoutLayout.addItem(self.TimeoutSpacer)
|
||||
self.ImageLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ImageModeGroupBox)
|
||||
self.ImageLayout.setWidget(
|
||||
0, QtGui.QFormLayout.LabelRole, self.ImageModeGroupBox)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.TimeoutSpinBox,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
|
||||
@ -71,7 +72,7 @@ class ImageTab(SettingsTab):
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(u'loop delay', self.loop_delay)
|
||||
Receiver().send_message(u'update_spin_delay', self.loop_delay )
|
||||
Receiver().send_message(u'update_spin_delay', self.loop_delay )
|
||||
|
||||
def postSetUp(self):
|
||||
Receiver().send_message(u'update_spin_delay', self.loop_delay )
|
||||
Receiver().send_message(u'update_spin_delay', self.loop_delay )
|
||||
|
@ -26,7 +26,8 @@ import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD, buildIcon
|
||||
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, \
|
||||
BaseListWithDnD, buildIcon
|
||||
|
||||
# We have to explicitly create separate classes for each plugin
|
||||
# in order for DnD to the Service manager to work correctly.
|
||||
@ -61,9 +62,11 @@ class ImageMediaItem(MediaManagerItem):
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
|
||||
def initialise(self):
|
||||
self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.ListView.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.ListView.setIconSize(QtCore.QSize(88,50))
|
||||
self.servicePath = os.path.join(self.parent.config.get_data_path(), u'.thumbnails')
|
||||
self.servicePath = os.path.join(
|
||||
self.parent.config.get_data_path(), u'.thumbnails')
|
||||
if os.path.exists(self.servicePath) == False:
|
||||
os.mkdir(self.servicePath)
|
||||
self.loadList(self.parent.config.load_list(self.ConfigSection))
|
||||
@ -103,9 +106,9 @@ class ImageMediaItem(MediaManagerItem):
|
||||
return False
|
||||
service_item.title = u'Image(s)'
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
bitem = self.ListView.item(item.row())
|
||||
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
|
||||
frame = QtGui.QImage(unicode(filename))
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_image(path, name, frame)
|
||||
service_item.add_from_image(path, name, frame)
|
||||
return True
|
||||
|
@ -81,7 +81,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
filename = self.ListData.getFilename(index)
|
||||
frame = QtGui.QImage(unicode(filename))
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_image(path, name, frame)
|
||||
service_item.add_from_image(path, name, frame)
|
||||
return True
|
||||
|
||||
def onPreviewClick(self):
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate
|
||||
|
||||
class MediaTab(SettingsTab):
|
||||
"""
|
||||
@ -50,14 +50,16 @@ class MediaTab(SettingsTab):
|
||||
self.UseVMRLabel.setObjectName(u'UseVMRLabel')
|
||||
self.MediaModeLayout.addWidget(self.UseVMRLabel)
|
||||
|
||||
self.MediaLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.MediaModeGroupBox)
|
||||
self.MediaLayout.setWidget(
|
||||
0, QtGui.QFormLayout.LabelRole, self.MediaModeGroupBox)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.UseVMRCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onVMRCheckBoxChanged)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.MediaModeGroupBox.setTitle(translate(u'MediaTab', u'Media Mode'))
|
||||
self.UseVMRCheckBox.setText(translate(u'MediaTab', u'Use Video Mode Rendering'))
|
||||
self.UseVMRCheckBox.setText(
|
||||
translate(u'MediaTab', u'Use Video Mode Rendering'))
|
||||
self.UseVMRLabel.setText(translate(u'MediaTab', u'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">\n'
|
||||
u'<html><head><meta name="qrichtext" content="1" /><style type="text/css">\n'
|
||||
u'p, li { white-space: pre-wrap; }\n'
|
||||
@ -72,7 +74,8 @@ class MediaTab(SettingsTab):
|
||||
self.use_vmr_mode = True
|
||||
|
||||
def load(self):
|
||||
self.use_vmr_mode = str_to_bool(self.config.get_config(u'use mode layout', u'False'))
|
||||
self.use_vmr_mode = str_to_bool(
|
||||
self.config.get_config(u'use mode layout', u'False'))
|
||||
if self.use_vmr_mode :
|
||||
self.UseVMRCheckBox.setChecked(True)
|
||||
|
||||
|
@ -27,7 +27,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
# http://nxsy.org/comparing-documents-with-openoffice-and-python
|
||||
|
||||
import logging
|
||||
import os , subprocess
|
||||
import os , subprocess
|
||||
import time
|
||||
import sys
|
||||
|
||||
|
@ -26,7 +26,8 @@ import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD
|
||||
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, \
|
||||
BaseListWithDnD
|
||||
from openlp.plugins.presentations.lib import MessageListener
|
||||
|
||||
# We have to explicitly create separate classes for each plugin
|
||||
@ -64,10 +65,12 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
|
||||
def addEndHeaderBar(self):
|
||||
self.PresentationWidget = QtGui.QWidget(self)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.PresentationWidget.sizePolicy().hasHeightForWidth())
|
||||
self.PresentationWidget.setSizePolicy(sizePolicy)
|
||||
self.PresentationWidget.setObjectName(u'PresentationWidget')
|
||||
self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
|
||||
@ -78,7 +81,8 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
|
||||
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
|
||||
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
|
||||
self.DisplayTypeLabel.setText(translate(u'PresentationMediaItem', u'Present using:'))
|
||||
self.DisplayTypeLabel.setText(
|
||||
translate(u'PresentationMediaItem', u'Present using:'))
|
||||
# Add the Presentation widget to the page layout
|
||||
self.PageLayout.addWidget(self.PresentationWidget)
|
||||
|
||||
@ -102,7 +106,8 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
row = self.ListView.row(item)
|
||||
self.ListView.takeItem(row)
|
||||
self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
|
||||
self.parent.config.set_list(
|
||||
self.ConfigSection, self.ListData.getFileList())
|
||||
|
||||
def generateSlideData(self, service_item):
|
||||
items = self.ListView.selectedIndexes()
|
||||
@ -111,8 +116,8 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
service_item.title = unicode(self.DisplayTypeComboBox.currentText())
|
||||
service_item.shortname = unicode(self.DisplayTypeComboBox.currentText())
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
bitem = self.ListView.item(item.row())
|
||||
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_command(path, name)
|
||||
service_item.add_from_command(path, name)
|
||||
return True
|
||||
|
@ -26,8 +26,8 @@ from openlp.plugins.presentations.lib import ImpressController
|
||||
|
||||
class MessageListener(object):
|
||||
"""
|
||||
This is the Presentation listener who acts on events from the slide controller
|
||||
and passes the messages on the the correct presentation handlers
|
||||
This is the Presentation listener who acts on events from the slide
|
||||
controller and passes the messages on the the correct presentation handlers
|
||||
"""
|
||||
global log
|
||||
log=logging.getLogger(u'MessageListener')
|
||||
@ -55,7 +55,7 @@ class MessageListener(object):
|
||||
Start of new presentation
|
||||
Save the handler as any new presentations start here
|
||||
"""
|
||||
self.handler, file = self.decodeMessage(message)
|
||||
self.handler, file = self.decodeMessage(message)
|
||||
self.controllers[self.handler].loadPresentation(file)
|
||||
|
||||
def next(self, message):
|
||||
|
@ -24,14 +24,15 @@
|
||||
|
||||
from PyQt4 import Qt, QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, str_to_bool
|
||||
from openlp.core.lib import SettingsTab, translate, str_to_bool
|
||||
|
||||
class PresentationTab(SettingsTab):
|
||||
"""
|
||||
PresentationsTab is the Presentations settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self):
|
||||
SettingsTab.__init__(self, translate(u'PresentationTab', u'Presentation'), u'Presentations')
|
||||
SettingsTab.__init__(self,
|
||||
translate(u'PresentationTab', u'Presentation'), u'Presentations')
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'PresentationTab')
|
||||
@ -41,7 +42,8 @@ class PresentationTab(SettingsTab):
|
||||
self.PresentationLayout.setObjectName(u'PresentationLayout')
|
||||
self.PresentationLeftWidget = QtGui.QWidget(self)
|
||||
self.PresentationLeftWidget.setObjectName(u'PresentationLeftWidget')
|
||||
self.PresentationLeftLayout = QtGui.QVBoxLayout(self.PresentationLeftWidget)
|
||||
self.PresentationLeftLayout = QtGui.QVBoxLayout(
|
||||
self.PresentationLeftWidget)
|
||||
self.PresentationLeftLayout.setObjectName(u'PresentationLeftLayout')
|
||||
self.PresentationLeftLayout.setSpacing(8)
|
||||
self.PresentationLeftLayout.setMargin(0)
|
||||
@ -60,17 +62,20 @@ class PresentationTab(SettingsTab):
|
||||
self.PowerpointCheckBox.setTristate(False)
|
||||
self.PowerpointCheckBox.setObjectName(u'PowerpointCheckBox')
|
||||
self.VerseDisplayLayout.addWidget(self.PowerpointCheckBox, 0, 0, 1, 1)
|
||||
self.PowerpointViewerCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
|
||||
self.PowerpointViewerCheckBox = QtGui.QCheckBox(
|
||||
self.VerseDisplayGroupBox)
|
||||
self.PowerpointViewerCheckBox.setTristate(False)
|
||||
self.PowerpointViewerCheckBox.setObjectName(u'PowerpointViewerCheckBox')
|
||||
self.VerseDisplayLayout.addWidget(self.PowerpointViewerCheckBox, 1, 0, 1, 1)
|
||||
self.VerseDisplayLayout.addWidget(
|
||||
self.PowerpointViewerCheckBox, 1, 0, 1, 1)
|
||||
self.ImpressCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
|
||||
self.ImpressCheckBox.setTristate(False)
|
||||
self.ImpressCheckBox.setObjectName(u'ImpressCheckBox')
|
||||
self.VerseDisplayLayout.addWidget(self.ImpressCheckBox, 2, 0, 1, 1)
|
||||
self.PresentationThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
|
||||
self.PresentationThemeWidget.setObjectName(u'PresentationThemeWidget')
|
||||
self.PresentationThemeLayout = QtGui.QHBoxLayout(self.PresentationThemeWidget)
|
||||
self.PresentationThemeLayout = QtGui.QHBoxLayout(
|
||||
self.PresentationThemeWidget)
|
||||
self.PresentationThemeLayout.setSpacing(8)
|
||||
self.PresentationThemeLayout.setMargin(0)
|
||||
self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout')
|
||||
@ -81,7 +86,8 @@ class PresentationTab(SettingsTab):
|
||||
self.PresentationLayout.addWidget(self.PresentationLeftWidget)
|
||||
self.PresentationRightWidget = QtGui.QWidget(self)
|
||||
self.PresentationRightWidget.setObjectName(u'PresentationRightWidget')
|
||||
self.PresentationRightLayout = QtGui.QVBoxLayout(self.PresentationRightWidget)
|
||||
self.PresentationRightLayout = QtGui.QVBoxLayout(
|
||||
self.PresentationRightWidget)
|
||||
self.PresentationRightLayout.setObjectName(u'PresentationRightLayout')
|
||||
self.PresentationRightLayout.setSpacing(8)
|
||||
self.PresentationRightLayout.setMargin(0)
|
||||
@ -91,16 +97,25 @@ class PresentationTab(SettingsTab):
|
||||
self.PresentationLayout.addWidget(self.PresentationRightWidget)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.PowerpointCheckBox.setText(translate(u'PresentationTab', 'Powerpoint available:'))
|
||||
self.PowerpointViewerCheckBox.setText(translate(u'PresentationTab', 'PowerpointViewer available:'))
|
||||
self.ImpressCheckBox.setText(translate(u'PresentationTab', 'Impress available:'))
|
||||
self.PowerpointCheckBox.setText(
|
||||
translate(u'PresentationTab', 'Powerpoint available:'))
|
||||
self.PowerpointViewerCheckBox.setText(
|
||||
translate(u'PresentationTab', 'PowerpointViewer available:'))
|
||||
self.ImpressCheckBox.setText(
|
||||
translate(u'PresentationTab', 'Impress available:'))
|
||||
|
||||
def load(self):
|
||||
self.PowerpointCheckBox.setChecked(int(self.config.get_config(u'Powerpoint', 0)))
|
||||
self.PowerpointViewerCheckBox.setChecked(int(self.config.get_config(u'Powerpoint Viewer', 0)))
|
||||
self.ImpressCheckBox.setChecked(int(self.config.get_config(u'Impress', 0)))
|
||||
self.PowerpointCheckBox.setChecked(
|
||||
int(self.config.get_config(u'Powerpoint', 0)))
|
||||
self.PowerpointViewerCheckBox.setChecked(
|
||||
int(self.config.get_config(u'Powerpoint Viewer', 0)))
|
||||
self.ImpressCheckBox.setChecked(
|
||||
int(self.config.get_config(u'Impress', 0)))
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(u'Powerpoint', unicode(self.PowerpointCheckBox.checkState()))
|
||||
self.config.set_config(u'Powerpoint Viewer', unicode(self.PowerpointViewerCheckBox.checkState()))
|
||||
self.config.set_config(u'Impress', unicode(self.ImpressCheckBox.checkState()))
|
||||
self.config.set_config(
|
||||
u'Powerpoint', unicode(self.PowerpointCheckBox.checkState()))
|
||||
self.config.set_config(u'Powerpoint Viewer',
|
||||
unicode(self.PowerpointViewerCheckBox.checkState()))
|
||||
self.config.set_config(
|
||||
u'Impress', unicode(self.ImpressCheckBox.checkState()))
|
||||
|
@ -28,7 +28,7 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Plugin, MediaManagerItem
|
||||
from openlp.core.lib import Plugin, MediaManagerItem
|
||||
from openlp.plugins.presentations.lib import PresentationMediaItem, \
|
||||
PresentationTab, ImpressController
|
||||
try:
|
||||
|
@ -20,14 +20,15 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate
|
||||
|
||||
class RemoteTab(SettingsTab):
|
||||
"""
|
||||
RemoteTab is the Remotes settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self):
|
||||
SettingsTab.__init__(self, translate(u'RemoteTab', u'Remotes'), u'Remotes')
|
||||
SettingsTab.__init__(
|
||||
self, translate(u'RemoteTab', u'Remotes'), u'Remotes')
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'RemoteTab')
|
||||
@ -49,18 +50,25 @@ class RemoteTab(SettingsTab):
|
||||
self.WarningLabel = QtGui.QLabel(self.RemoteModeGroupBox)
|
||||
self.WarningLabel.setObjectName(u'WarningLabel')
|
||||
self.RemoteModeLayout.addWidget(self.WarningLabel)
|
||||
self.RemoteLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.RemoteModeGroupBox)
|
||||
self.RemoteLayout.setWidget(
|
||||
0, QtGui.QFormLayout.LabelRole, self.RemoteModeGroupBox)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.RemoteModeGroupBox.setTitle(translate(u'RemoteTab', u'Remotes Receiver Port'))
|
||||
self.RemoteModeGroupBox.setTitle(
|
||||
translate(u'RemoteTab', u'Remotes Receiver Port'))
|
||||
self.RemoteActive.setText(translate(u'RemoteTab', 'Remote available:'))
|
||||
self.WarningLabel.setText(translate(u'RemoteTab', u'A restart is needed for this change to become effective'))
|
||||
self.WarningLabel.setText(translate(u'RemoteTab',
|
||||
u'A restart is needed for this change to become effective'))
|
||||
|
||||
def load(self):
|
||||
self.RemotePortSpinBox.setValue(int(self.config.get_config(u'remote port', 4316)))
|
||||
self.RemoteActive.setChecked(int(self.config.get_config(u'startup', 0)))
|
||||
self.RemotePortSpinBox.setValue(
|
||||
int(self.config.get_config(u'remote port', 4316)))
|
||||
self.RemoteActive.setChecked(int(
|
||||
self.config.get_config(u'startup', 0)))
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(u'remote port', unicode(self.RemotePortSpinBox.value()))
|
||||
self.config.set_config(u'startup', unicode(self.RemoteActive.checkState()))
|
||||
self.config.set_config(
|
||||
u'remote port', unicode(self.RemotePortSpinBox.value()))
|
||||
self.config.set_config(
|
||||
u'startup', unicode(self.RemoteActive.checkState()))
|
||||
|
||||
|
@ -33,7 +33,7 @@ def sendData(options, message):
|
||||
print u'Errow thrown ', sys.exc_info()[1]
|
||||
|
||||
def format_message(options):
|
||||
return u'%s:%s' % (options.event, options.message)
|
||||
return u'%s:%s' % (options.event, options.message)
|
||||
|
||||
def main():
|
||||
usage = "usage: %prog [options] arg1 arg2"
|
||||
|
@ -62,12 +62,12 @@ class RemotesPlugin(Plugin):
|
||||
def readData(self):
|
||||
log.info(u'Remoted data has arrived')
|
||||
while self.server.hasPendingDatagrams():
|
||||
datagram, host, port = self.server.readDatagram(
|
||||
datagram, host, port = self.server.readDatagram(
|
||||
self.server.pendingDatagramSize())
|
||||
self.handle_datagram(datagram)
|
||||
|
||||
def handle_datagram(self, datagram):
|
||||
log.info(u'Sending event %s ', datagram)
|
||||
log.info(u'Sending event %s ', datagram)
|
||||
pos = datagram.find(u':')
|
||||
event = unicode(datagram[:pos].lower())
|
||||
|
||||
|
@ -27,7 +27,7 @@ import sys
|
||||
|
||||
from sqlalchemy import asc, desc
|
||||
from openlp.plugins.songs.lib.models import init_models, metadata, session, \
|
||||
engine, songs_table, Song, Author, Topic, Book
|
||||
engine, songs_table, Song, Author, Topic, Book
|
||||
|
||||
import logging
|
||||
|
||||
|
@ -27,7 +27,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, translate, ServiceItem, \
|
||||
SongXMLParser, contextMenuAction, contextMenuSeparator, BaseListWithDnD, \
|
||||
SongXMLParser, contextMenuAction, contextMenuSeparator, BaseListWithDnD, \
|
||||
Receiver
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
|
||||
|
||||
@ -49,7 +49,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.PluginTextShort = u'Song'
|
||||
self.ConfigSection = u'song'
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||
self.song_maintenance_form = SongMaintenanceForm(
|
||||
self.parent.songmanager, self)
|
||||
|
||||
@ -306,7 +306,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
raw_footer.append(author_list)
|
||||
raw_footer.append(song.copyright )
|
||||
raw_footer.append(unicode(
|
||||
translate(u'SongMediaItem', u'CCL Licence: ') + ccl ))
|
||||
translate(u'SongMediaItem', u'CCL Licence: ') + ccl))
|
||||
service_item.raw_footer = raw_footer
|
||||
service_item.audit = [service_item.title, author_audit, ccl]
|
||||
return True
|
||||
|
@ -71,7 +71,7 @@ _blankOpenSongXml = \
|
||||
class _OpenSong(XmlRootClass):
|
||||
"""Class for import of OpenSogn"""
|
||||
|
||||
def __init__(self, xmlContent = None):
|
||||
def __init__(self, xmlContent = None):
|
||||
"""Initialize from given xml content"""
|
||||
super(_OpenSong, self).__init__()
|
||||
self.from_buffer(xmlContent)
|
||||
@ -81,7 +81,7 @@ class _OpenSong(XmlRootClass):
|
||||
global _blankOpenSongXml
|
||||
self._setFromXml(_blankOpenSongXml, 'song')
|
||||
|
||||
def from_buffer(self, xmlContent):
|
||||
def from_buffer(self, xmlContent):
|
||||
"""Initialize from buffer(string) with xml content"""
|
||||
self._reset()
|
||||
if xmlContent != None :
|
||||
@ -259,7 +259,7 @@ class Song(object) :
|
||||
"""Return the songid for the database"""
|
||||
return self.songid
|
||||
|
||||
def from_opensong_buffer(self, xmlcontent):
|
||||
def from_opensong_buffer(self, xmlcontent):
|
||||
"""Initialize from buffer(string) of xml lines in opensong format"""
|
||||
self._reset()
|
||||
opensong = _OpenSong(xmlcontent)
|
||||
@ -275,20 +275,20 @@ class Song(object) :
|
||||
self.set_category_array(opensong.get_category_array())
|
||||
self.set_lyrics(opensong.get_lyrics())
|
||||
|
||||
def from_opensong_file(self, xmlfilename):
|
||||
def from_opensong_file(self, xmlfilename):
|
||||
"""Initialize from file containing xml
|
||||
|
||||
xmlfilename -- path to xml file
|
||||
"""
|
||||
lst = []
|
||||
f = open(xmlfilename, 'r')
|
||||
f = open(xmlfilename, 'r')
|
||||
for line in f :
|
||||
lst.append(line)
|
||||
f.close()
|
||||
xml = "".join(lst)
|
||||
self.from_opensong_buffer(xml)
|
||||
|
||||
def _remove_punctuation(self, title):
|
||||
def _remove_punctuation(self, title):
|
||||
"""Remove the puntuation chars from title
|
||||
|
||||
chars are: .,:;!?&%#/\@`$'|"^~*-
|
||||
@ -296,7 +296,7 @@ class Song(object) :
|
||||
punctuation = ".,:;!?&%#'\"/\\@`$|^~*-"
|
||||
s = title
|
||||
for c in punctuation :
|
||||
s = s.replace(c, '')
|
||||
s = s.replace(c, '')
|
||||
return s
|
||||
|
||||
def set_title(self, title):
|
||||
@ -322,7 +322,8 @@ class Song(object) :
|
||||
return self.search_title
|
||||
|
||||
def from_ccli_text_buffer(self, textList):
|
||||
"""Create song from a list of texts (strings) - CCLI text format expected
|
||||
"""
|
||||
Create song from a list of texts (strings) - CCLI text format expected
|
||||
|
||||
textList (list of strings) -- the song
|
||||
"""
|
||||
@ -377,13 +378,13 @@ class Song(object) :
|
||||
self.set_song_cclino(sCcli)
|
||||
self.set_lyrics(lyrics)
|
||||
|
||||
def from_ccli_text_file(self, textFileName):
|
||||
def from_ccli_text_file(self, textFileName):
|
||||
"""Create song from a list of texts read from given file
|
||||
|
||||
textFileName -- path to text file
|
||||
"""
|
||||
lines = []
|
||||
f = open(textFileName, 'r')
|
||||
f = open(textFileName, 'r')
|
||||
for orgline in f:
|
||||
lines.append(orgline.rstrip())
|
||||
f.close()
|
||||
@ -424,7 +425,7 @@ class Song(object) :
|
||||
"""Return copyright info string"""
|
||||
return self._assure_string(self.copyright)
|
||||
|
||||
def set_copyright(self, copyright):
|
||||
def set_copyright(self, copyright):
|
||||
"""Set the copyright string"""
|
||||
self.copyright = copyright
|
||||
|
||||
@ -432,7 +433,7 @@ class Song(object) :
|
||||
"""Return the songCclino"""
|
||||
return self._assure_string(self.song_cclino)
|
||||
|
||||
def set_song_cclino(self, song_cclino):
|
||||
def set_song_cclino(self, song_cclino):
|
||||
"""Set the song_cclino"""
|
||||
self.song_cclino = song_cclino
|
||||
|
||||
@ -440,7 +441,7 @@ class Song(object) :
|
||||
"""Return the theme name for the song"""
|
||||
return self._assure_string(self.theme)
|
||||
|
||||
def set_theme(self, theme):
|
||||
def set_theme(self, theme):
|
||||
"""Set the theme name (string)"""
|
||||
self.theme = theme
|
||||
|
||||
@ -448,7 +449,7 @@ class Song(object) :
|
||||
"""Return the song_book (string)"""
|
||||
return self._assure_string(self.song_book)
|
||||
|
||||
def set_song_book(self, song_book):
|
||||
def set_song_book(self, song_book):
|
||||
"""Set the song_book (string)"""
|
||||
self.song_book = song_book
|
||||
|
||||
@ -456,7 +457,7 @@ class Song(object) :
|
||||
"""Return the song_number (string)"""
|
||||
return self._assure_string(self.song_number)
|
||||
|
||||
def set_song_number(self, song_number):
|
||||
def set_song_number(self, song_number):
|
||||
"""Set the song_number (string)"""
|
||||
self.song_number = song_number
|
||||
|
||||
@ -464,7 +465,7 @@ class Song(object) :
|
||||
"""Return the comments (string)"""
|
||||
return self._assure_string(self.comments)
|
||||
|
||||
def set_comments(self, comments):
|
||||
def set_comments(self, comments):
|
||||
"""Set the comments (string)"""
|
||||
self.comments = comments
|
||||
|
||||
@ -472,11 +473,11 @@ class Song(object) :
|
||||
"""Get the verseOrder (string) - preferably space delimited"""
|
||||
return self._assure_string(self.verse_order)
|
||||
|
||||
def set_verse_order(self, verse_order):
|
||||
def set_verse_order(self, verse_order):
|
||||
"""Set the verse order (string) - space delimited"""
|
||||
self.verse_order = verse_order
|
||||
|
||||
def get_author_list(self, asOneString = True):
|
||||
def get_author_list(self, asOneString = True):
|
||||
"""Return the list of authors as a string
|
||||
|
||||
asOneString
|
||||
@ -491,7 +492,7 @@ class Song(object) :
|
||||
res = self._split_to_list(self.author_list)
|
||||
return res
|
||||
|
||||
def set_author_list(self, author_list):
|
||||
def set_author_list(self, author_list):
|
||||
"""Set the author_list
|
||||
|
||||
author_list -- a string or list of strings
|
||||
@ -501,7 +502,7 @@ class Song(object) :
|
||||
else :
|
||||
self.author_list = self._list_to_string(author_list)
|
||||
|
||||
def get_category_array(self, asOneString = True):
|
||||
def get_category_array(self, asOneString = True):
|
||||
"""Return the list of categories as a string
|
||||
|
||||
asOneString
|
||||
@ -516,7 +517,7 @@ class Song(object) :
|
||||
res = self._split_to_list(self.category_array)
|
||||
return res
|
||||
|
||||
def set_category_array(self, category_array):
|
||||
def set_category_array(self, category_array):
|
||||
"""Set the category_array
|
||||
|
||||
category_array -- a string or list of strings
|
||||
@ -530,7 +531,7 @@ class Song(object) :
|
||||
"""Return the show_title flag (bool)"""
|
||||
return self.show_title
|
||||
|
||||
def set_show_title(self, show_title):
|
||||
def set_show_title(self, show_title):
|
||||
"""Set the show_title flag (bool)"""
|
||||
self.show_title = show_title
|
||||
|
||||
@ -538,7 +539,7 @@ class Song(object) :
|
||||
"""Return the show_author_list flag"""
|
||||
return self.show_author_list
|
||||
|
||||
def set_show_author_list(self, show_author_list):
|
||||
def set_show_author_list(self, show_author_list):
|
||||
"""Set the show_author_list flag (bool)"""
|
||||
self.show_author_list = show_author_list
|
||||
|
||||
@ -554,7 +555,7 @@ class Song(object) :
|
||||
"""Return the showSongCclino (string)"""
|
||||
return self.show_song_cclino
|
||||
|
||||
def set_show_song_cclino(self, show_song_cclino):
|
||||
def set_show_song_cclino(self, show_song_cclino):
|
||||
"""Set the show_song_cclino flag (bool)"""
|
||||
self.show_song_cclino = show_song_cclino
|
||||
|
||||
@ -565,7 +566,7 @@ class Song(object) :
|
||||
"""
|
||||
return self.lyrics
|
||||
|
||||
def set_lyrics(self, lyrics):
|
||||
def set_lyrics(self, lyrics):
|
||||
"""Set the lyrics as a list of strings"""
|
||||
self.lyrics = lyrics
|
||||
self._parse_lyrics()
|
||||
@ -594,7 +595,7 @@ class Song(object) :
|
||||
numOfSlides = len(self.slideList)
|
||||
return numOfSlides
|
||||
|
||||
def get_preview_slide(self, slideNumber):
|
||||
def get_preview_slide(self, slideNumber):
|
||||
"""Return the preview text for specified slide number
|
||||
|
||||
slideNumber -- 0: all slides, 1..n : specific slide
|
||||
@ -618,7 +619,7 @@ class Song(object) :
|
||||
# remove formattingincluding themes
|
||||
return res
|
||||
|
||||
def get_render_slide(self, slideNumber):
|
||||
def get_render_slide(self, slideNumber):
|
||||
"""Return the slide to be rendered including the additional
|
||||
properties
|
||||
|
||||
|
@ -29,7 +29,7 @@ from openlp.plugins.songs.lib.meta import metadata
|
||||
|
||||
# Definition of the "authors" table
|
||||
authors_table = Table(u'authors', metadata,
|
||||
Column(u'id', types.Integer, primary_key=True),
|
||||
Column(u'id', types.Integer, primary_key=True),
|
||||
Column(u'first_name', types.Unicode(128)),
|
||||
Column(u'last_name', types.Unicode(128)),
|
||||
Column(u'display_name', types.Unicode(255), nullable=False)
|
||||
@ -45,7 +45,8 @@ song_books_table = Table(u'song_books', metadata,
|
||||
# Definition of the "songs" table
|
||||
songs_table = Table(u'songs', metadata,
|
||||
Column(u'id', types.Integer, primary_key=True),
|
||||
Column(u'song_book_id', types.Integer, ForeignKey(u'song_books.id'), default=0),
|
||||
Column(u'song_book_id', types.Integer,
|
||||
ForeignKey(u'song_books.id'), default=0),
|
||||
Column(u'title', types.Unicode(255), nullable=False),
|
||||
Column(u'lyrics', types.UnicodeText, nullable=False),
|
||||
Column(u'verse_order', types.Unicode(128)),
|
||||
@ -60,27 +61,38 @@ songs_table = Table(u'songs', metadata,
|
||||
|
||||
# Definition of the "topics" table
|
||||
topics_table = Table(u'topics', metadata,
|
||||
Column(u'id', types.Integer, primary_key=True),
|
||||
Column(u'id', types.Integer, primary_key=True),
|
||||
Column(u'name', types.Unicode(128), nullable=False)
|
||||
)
|
||||
|
||||
# Definition of the "authors_songs" table
|
||||
authors_songs_table = Table(u'authors_songs', metadata,
|
||||
Column(u'author_id', types.Integer, ForeignKey(u'authors.id'), primary_key=True),
|
||||
Column(u'song_id', types.Integer, ForeignKey(u'songs.id'), primary_key=True)
|
||||
Column(u'author_id', types.Integer,
|
||||
ForeignKey(u'authors.id'), primary_key=True),
|
||||
Column(u'song_id', types.Integer,
|
||||
ForeignKey(u'songs.id'), primary_key=True)
|
||||
)
|
||||
|
||||
# Definition of the "songs_topics" table
|
||||
songs_topics_table = Table(u'songs_topics', metadata,
|
||||
Column(u'song_id', types.Integer, ForeignKey(u'songs.id'), primary_key=True),
|
||||
Column(u'topic_id', types.Integer, ForeignKey(u'topics.id'), primary_key=True)
|
||||
Column(u'song_id', types.Integer,
|
||||
ForeignKey(u'songs.id'), primary_key=True),
|
||||
Column(u'topic_id', types.Integer,
|
||||
ForeignKey(u'topics.id'), primary_key=True)
|
||||
)
|
||||
Index(u'authors_id',authors_table.c.id)
|
||||
Index(u'authors_display_name_id',authors_table.c.display_name, authors_table.c.id)
|
||||
Index(u'song_books_id',song_books_table.c.id)
|
||||
Index(u'songs_id',songs_table.c.id)
|
||||
Index(u'topics_id',topics_table.c.id)
|
||||
Index(u'authors_songs_author',authors_songs_table.c.author_id, authors_songs_table.c.song_id)
|
||||
Index(u'authors_songs_song',authors_songs_table.c.song_id, authors_songs_table.c.author_id)
|
||||
Index(u'topics_song_topic', songs_topics_table.c.topic_id, songs_topics_table.c.song_id)
|
||||
Index(u'topics_song_song',songs_topics_table.c.song_id, songs_topics_table.c.topic_id)
|
||||
|
||||
# Define table indexes
|
||||
Index(u'authors_id', authors_table.c.id)
|
||||
Index(u'authors_display_name_id', authors_table.c.display_name,
|
||||
authors_table.c.id)
|
||||
Index(u'song_books_id', song_books_table.c.id)
|
||||
Index(u'songs_id', songs_table.c.id)
|
||||
Index(u'topics_id', topics_table.c.id)
|
||||
Index(u'authors_songs_author', authors_songs_table.c.author_id,
|
||||
authors_songs_table.c.song_id)
|
||||
Index(u'authors_songs_song', authors_songs_table.c.song_id,
|
||||
authors_songs_table.c.author_id)
|
||||
Index(u'topics_song_topic', songs_topics_table.c.topic_id,
|
||||
songs_topics_table.c.song_id)
|
||||
Index(u'topics_song_song', songs_topics_table.c.song_id,
|
||||
songs_topics_table.c.topic_id)
|
||||
|
@ -94,7 +94,8 @@ class SongsPlugin(Plugin):
|
||||
# Translations...
|
||||
self.ImportSongMenu.setTitle(translate(u'main_window', u'&Song'))
|
||||
self.ImportOpenSongItem.setText(translate(u'main_window', u'OpenSong'))
|
||||
self.ImportOpenlp1Item.setText(translate(u'main_window', u'openlp.org 1.0'))
|
||||
self.ImportOpenlp1Item.setText(
|
||||
translate(u'main_window', u'openlp.org 1.0'))
|
||||
self.ImportOpenlp1Item.setToolTip(
|
||||
translate(u'main_window', u'Export songs in openlp.org 1.0 format'))
|
||||
self.ImportOpenlp1Item.setStatusTip(
|
||||
@ -137,7 +138,8 @@ class SongsPlugin(Plugin):
|
||||
# Translations...
|
||||
self.ExportSongMenu.setTitle(translate(u'main_window', u'&Song'))
|
||||
self.ExportOpenSongItem.setText(translate(u'main_window', u'OpenSong'))
|
||||
self.ExportOpenlp1Item.setText(translate(u'main_window', u'openlp.org 1.0'))
|
||||
self.ExportOpenlp1Item.setText(
|
||||
translate(u'main_window', u'openlp.org 1.0'))
|
||||
self.ExportOpenlp2Item.setText(translate(u'main_window', u'OpenLP 2.0'))
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.ExportOpenlp1Item,
|
||||
|
@ -50,8 +50,8 @@ class Test_Basic(object):
|
||||
s = Song()
|
||||
t = "A normal title"
|
||||
s.set_title(t)
|
||||
assert(s.get_title() == t)
|
||||
assert(s.get_search_title() == t)
|
||||
assert(s.get_title() == t)
|
||||
assert(s.get_search_title() == t)
|
||||
|
||||
def test_Title3(self):
|
||||
"""Set a titel with punctuation 1"""
|
||||
@ -59,8 +59,8 @@ class Test_Basic(object):
|
||||
t1 = "Hey! Come on, ya programmers*"
|
||||
t2 = "Hey Come on ya programmers"
|
||||
s.set_title(t1)
|
||||
assert(s.get_title() == t1)
|
||||
assert(s.get_search_title() == t2)
|
||||
assert(s.get_title() == t1)
|
||||
assert(s.get_search_title() == t2)
|
||||
|
||||
def test_Title4(self):
|
||||
"""Set a titel with punctuation 2"""
|
||||
@ -68,11 +68,14 @@ class Test_Basic(object):
|
||||
t1 = "??#Hey! Come on, ya programmers*"
|
||||
t2 = "Hey Come on ya programmers"
|
||||
s.set_title(t1)
|
||||
assert(s.get_title() == t1)
|
||||
assert(s.get_search_title() == t2)
|
||||
assert(s.get_title() == t1)
|
||||
assert(s.get_search_title() == t2)
|
||||
|
||||
def test_Title5(self):
|
||||
"""Set a title, where searchable title becomes empty - raises an exception"""
|
||||
"""
|
||||
Set a title
|
||||
Where searchable title becomes empty raises an exception
|
||||
"""
|
||||
s = Song()
|
||||
py.test.raises(SongTitleError, s.set_title, ',*')
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Migration(object):
|
||||
Initialise the process.
|
||||
"""
|
||||
self.display = Display()
|
||||
self.stime = time.strftime(u'%Y-%m-%d-%H%M%S', time.localtime())
|
||||
self.stime = time.strftime(u'%Y-%m-%d-%H%M%S', time.localtime())
|
||||
self.display.output(u'OpenLp v1.9.0 Migration Utility Started')
|
||||
|
||||
def process(self):
|
||||
|
Loading…
Reference in New Issue
Block a user