head and merge fixes

This commit is contained in:
Tim Bentley 2009-09-22 20:23:12 +01:00
commit 341916d610
49 changed files with 582 additions and 366 deletions

View File

@ -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,46 @@ 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 +242,14 @@ 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 +257,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 +269,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',
@ -308,13 +332,16 @@ class MediaManagerItem(QtGui.QWidget):
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')
@ -345,7 +372,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

View File

@ -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),

View File

@ -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:
@ -131,7 +132,8 @@ class RenderManager(object):
if self.theme != self.renderer.theme_name:
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)
@ -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)

View File

@ -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))

View File

@ -141,7 +141,9 @@ 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)

View File

@ -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)

View File

@ -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()
@ -247,7 +250,8 @@ class SlideController(QtGui.QWidget):
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']])
[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']])
[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)

View File

@ -37,28 +37,34 @@ class SplashScreen(object):
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):

View File

@ -199,7 +199,8 @@ class ThemeManager(QtGui.QWidget):
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):

View File

@ -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)
@ -133,22 +138,28 @@ class ThemesTab(SettingsTab):
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)

View File

@ -31,7 +31,8 @@ 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
from openlp.plugins.songs.lib.tables import *
@ -40,8 +41,8 @@ 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)
@ -154,11 +155,15 @@ 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

View File

@ -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)
@ -121,7 +122,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):
@ -130,7 +132,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)

View File

@ -46,18 +46,20 @@ class AuditTab(SettingsTab):
self.WarningLabel = QtGui.QLabel(self)
self.WarningLabel.setObjectName("WarningLabel")
self.verticalLayout.addWidget(self.WarningLabel)
QtCore.QObject.connect(self.AuditFileButton,
QtCore.SIGNAL(u'pressed()'), self.onAuditFileButtonClicked)
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 save(self):
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')

View File

@ -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)

View File

@ -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()), \
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

View File

@ -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

View File

@ -42,13 +42,24 @@ class BGExtract(BibleCommon):
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'>'
@ -76,8 +87,9 @@ class BGExtract(BibleCommon):
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
verseText = xml_string[versePos + 7 : i - 1] # Loose </span>
# 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
@ -93,15 +105,25 @@ class CWExtract(BibleCommon):
self.proxyurl = proxyurl
def get_bible_chapter(self, version, bookid, bookname, chapter) :
log.debug( u'getBibleChapter %s,%s,%s,%s', 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)
@ -170,7 +192,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.
@ -206,7 +230,8 @@ class BibleHTTPImpl():
"""
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':

View File

@ -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

View File

@ -126,7 +126,9 @@ 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 +203,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 +231,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')
message += translate(
u'customEditDialog', u'You need to enter a slide \n')
return valid, message

View File

@ -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):

View File

@ -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.ImageSettingsGroupBox)
self.ImageLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.ImageModeGroupBox)
# Signals and slots
QtCore.QObject.connect(self.TimeoutSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)

View File

@ -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))

View File

@ -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)

View File

@ -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()

View File

@ -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')

View File

@ -31,7 +31,8 @@ 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,26 @@ 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()))

View File

@ -27,7 +27,8 @@ 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()))

View File

@ -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
"""

View File

@ -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)),
@ -66,21 +67,32 @@ topics_table = Table(u'topics', metadata,
# 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)
)
# 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'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)
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)

View File

@ -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,

View File

@ -72,7 +72,10 @@ class Test_Basic(object):
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, ',*')