This commit is contained in:
Jonathan Corwin 2010-04-01 08:43:36 +01:00
commit 949dfd927d
28 changed files with 748 additions and 422 deletions

View File

@ -114,6 +114,7 @@ class MediaManagerItem(QtGui.QWidget):
self.Toolbar = None
self.remoteTriggered = None
self.ServiceItemIconName = None
self.addToServiceItem = False
self.PageLayout = QtGui.QVBoxLayout(self)
self.PageLayout.setSpacing(0)
self.PageLayout.setContentsMargins(4, 0, 4, 0)
@ -279,6 +280,13 @@ class MediaManagerItem(QtGui.QWidget):
u'%s %s' % (self.trUtf8('&Edit'), self.PluginNameVisible),
self.onEditClick))
self.ListView.addAction(contextMenuSeparator(self.ListView))
if self.hasDeleteIcon:
self.ListView.addAction(
contextMenuAction(
self.ListView, u':/general/general_delete.png',
u'%s %s' % (self.trUtf8('&Delete'), self.PluginNameVisible),
self.onDeleteClick))
self.ListView.addAction(contextMenuSeparator(self.ListView))
self.ListView.addAction(
contextMenuAction(
self.ListView, u':/general/general_preview.png',
@ -292,6 +300,12 @@ class MediaManagerItem(QtGui.QWidget):
contextMenuAction(
self.ListView, u':/general/general_add.png',
self.trUtf8('&Add to Service'), self.onAddClick))
if self.addToServiceItem:
self.ListView.addAction(
contextMenuAction(
self.ListView, u':/general/general_add.png',
self.trUtf8('&Add to selected Service Item'),
self.onAddEditClick))
QtCore.QObject.connect(
self.ListView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onPreviewClick)
@ -366,7 +380,7 @@ class MediaManagerItem(QtGui.QWidget):
log.debug(self.PluginNameShort + u' Preview requested')
service_item = self.buildServiceItem()
if service_item:
service_item.fromPlugin = True
service_item.from_plugin = True
self.parent.preview_controller.addServiceItem(service_item)
def onLiveClick(self):
@ -378,7 +392,7 @@ class MediaManagerItem(QtGui.QWidget):
log.debug(self.PluginNameShort + u' Live requested')
service_item = self.buildServiceItem()
if service_item:
service_item.fromPlugin = True
service_item.from_plugin = True
self.parent.live_controller.addServiceItem(service_item)
def onAddClick(self):
@ -390,9 +404,31 @@ class MediaManagerItem(QtGui.QWidget):
log.debug(self.PluginNameShort + u' Add requested')
service_item = self.buildServiceItem()
if service_item:
service_item.fromPlugin = False
service_item.from_plugin = False
self.parent.service_manager.addServiceItem(service_item)
def onAddEditClick(self):
if not self.ListView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self,
self.trUtf8('No items selected'),
self.trUtf8('You must select one or more items'))
else:
log.debug(self.PluginNameShort + u' Add requested')
service_item = self.parent.service_manager.getServiceItem()
if not service_item:
QtGui.QMessageBox.information(self,
self.trUtf8('No Service Item Selected'),
self.trUtf8('You must select a existing service item to add to.'))
elif self.title == service_item.name:
self.generateSlideData(service_item)
self.parent.service_manager.addServiceItem(service_item)
else:
#Turn off the remote edit update message indicator
self.parent.service_manager.remoteEditTriggered = False
QtGui.QMessageBox.information(self,
self.trUtf8('Invalid Service Item'),
self.trUtf8(unicode('You must select a %s service item.' % self.title)))
def buildServiceItem(self):
"""
Common method for generating a service item

View File

@ -466,8 +466,7 @@ class Renderer(object):
tlcorner=(x + display_shadow_size, y + display_shadow_size),
draw=True, color = self._theme.display_shadow_color)
self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=True,
outline_size=display_outline_size,
outline_color=self._theme.display_outline_color)
outline_size=display_outline_size)
y += h
if linenum == 0:
self._first_line_right_extent = rightextent
@ -505,7 +504,7 @@ class Renderer(object):
self.mainFont.setPixelSize(self._theme.font_main_proportion)
def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False,
color=None, outline_size=0, outline_color=None):
color=None, outline_size=0):
"""
Find bounding box of text - as render_single_line. If draw is set,
actually draw the text to the current DC as well return width and
@ -544,7 +543,7 @@ class Renderer(object):
else:
pen = QtGui.QColor(color)
x, y = tlcorner
if self._theme.display_outline:
if self._theme.display_outline and outline_size != 0 and not footer:
path = QtGui.QPainterPath()
path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line)
self.painter.setBrush(self.painter.pen().brush())
@ -555,7 +554,7 @@ class Renderer(object):
self.painter.drawText(x, y + metrics.ascent(), line)
if self._theme.display_slideTransition:
# Print 2nd image with 70% weight
if self._theme.display_outline:
if self._theme.display_outline and outline_size != 0 and not footer:
path = QtGui.QPainterPath()
path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line)
self.painter2.setBrush(self.painter2.pen().brush())

View File

@ -66,14 +66,15 @@ class ServiceItem(object):
self.iconic_representation = None
self.raw_footer = None
self.theme = None
self.service_item_path = None
self.service_item_type = None
self.edit_enabled = False
self.maintain_allowed = False
self._raw_frames = []
self._display_frames = []
self._uuid = unicode(uuid.uuid1())
self.autoPreviewAllowed = False
self.auto_preview_allowed = False
self.notes = u''
self.from_plugin = False
def addIcon(self, icon):
"""
@ -156,9 +157,8 @@ class ServiceItem(object):
The actual image file name.
"""
self.service_item_type = ServiceItemType.Image
self.service_item_path = path
self._raw_frames.append(
{u'title': title, u'image': image})
{u'title': title, u'image': image, u'path': path})
def add_from_text(self, title, raw_slide, verseTag=None):
"""
@ -189,9 +189,8 @@ class ServiceItem(object):
The command of/for the slide.
"""
self.service_item_type = ServiceItemType.Command
self.service_item_path = path
self._raw_frames.append(
{u'title': file_name, u'image': image})
{u'title': file_name, u'image': image, u'path': path})
def get_service_repr(self):
"""
@ -208,7 +207,10 @@ class ServiceItem(object):
u'type':self.service_item_type,
u'audit':self.audit,
u'notes':self.notes,
u'preview':self.autoPreviewAllowed
u'preview':self.auto_preview_allowed,
u'edit':self.edit_enabled,
u'maintain':self.maintain_allowed,
u'from_plugin':self.from_plugin
}
service_data = []
if self.service_item_type == ServiceItemType.Text:
@ -242,8 +244,11 @@ class ServiceItem(object):
self.addIcon(header[u'icon'])
self.raw_footer = header[u'footer']
self.audit = header[u'audit']
self.autoPreviewAllowed = header[u'preview']
self.auto_preview_allowed = header[u'preview']
self.notes = header[u'notes']
self.edit_enabled = header[u'edit']
self.maintain_allowed = header[u'maintain']
self.from_plugin = header[u'from_plugin']
if self.service_item_type == ServiceItemType.Text:
for slide in serviceitem[u'serviceitem'][u'data']:
self._raw_frames.append(slide)
@ -280,7 +285,7 @@ class ServiceItem(object):
return self._uuid != other._uuid
def is_song(self):
return self.name == u'Songs'
return self.name.lower() == u'songs'
def is_media(self):
return self.name.lower() == u'media'
@ -320,6 +325,12 @@ class ServiceItem(object):
"""
return self._raw_frames[row][u'title']
def get_frame_path(self, row=0):
"""
Returns the title of the raw frame
"""
return self._raw_frames[row][u'path']
def request_audit(self):
if self.audit:
Receiver.send_message(u'songusage_live', self.audit)

View File

@ -23,7 +23,9 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from serviceitemform import ServiceItemNoteForm
from slidecontroller import HideMode
from servicenoteform import ServiceNoteForm
from serviceitemeditform import ServiceItemEditForm
from screen import ScreenList
from maindisplay import MainDisplay
from amendthemeform import AmendThemeForm
@ -41,4 +43,4 @@ from mainwindow import MainWindow
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainWindow',
'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
'AmendThemeForm', 'MediaDockManager', 'ServiceItemNoteForm']
'AmendThemeForm', 'MediaDockManager', 'ServiceItemEditForm']

View File

@ -393,6 +393,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.background_type = u'solid'
if self.theme.background_color is None :
self.theme.background_color = u'#000000'
self.ImageLineEdit.setText(u'')
elif background == 1: # Gradient
self.theme.background_type = u'gradient'
if gradient == 0: # Horizontal
@ -405,6 +406,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.background_startColor = u'#000000'
if self.theme.background_endColor is None :
self.theme.background_endColor = u'#ff0000'
self.ImageLineEdit.setText(u'')
else:
self.theme.background_type = u'image'
self.stateChanging(self.theme)
@ -422,7 +424,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.Color1PushButton.setStyleSheet(
u'background-color: %s' % \
unicode(self.theme.background_startColor))
self.previewTheme()
def onColor2PushButtonClicked(self):
@ -561,22 +562,18 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
u'background-color: %s' % unicode(theme.font_main_color))
self.FontFooterColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.font_footer_color))
if not self.theme.font_main_override:
self.FontMainDefaultCheckBox.setChecked(True)
else:
self.FontMainDefaultCheckBox.setChecked(False)
if not self.theme.font_footer_override:
self.FontFooterDefaultCheckBox.setChecked(True)
else:
self.FontFooterDefaultCheckBox.setChecked(False)
self.OutlineColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.display_outline_color))
self.ShadowColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.display_shadow_color))
if self.theme.display_outline:
self.OutlineCheckBox.setChecked(True)
self.OutlineColorPushButton.setEnabled(True)
@ -584,7 +581,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.OutlineCheckBox.setChecked(False)
self.OutlineColorPushButton.setEnabled(False)
self.OutlineSpinBox.setValue(int(self.theme.display_outline_size))
if self.theme.display_shadow:
self.ShadowCheckBox.setChecked(True)
self.ShadowColorPushButton.setEnabled(True)
@ -592,12 +588,10 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.ShadowCheckBox.setChecked(False)
self.ShadowColorPushButton.setEnabled(False)
self.ShadowSpinBox.setValue(int(self.theme.display_shadow_size))
if self.theme.display_slideTransition:
self.SlideTransitionCheckedBox.setCheckState(QtCore.Qt.Checked)
else:
self.SlideTransitionCheckedBox.setCheckState(QtCore.Qt.Unchecked)
self.HorizontalComboBox.setCurrentIndex(
self.theme.display_horizontalAlign)
self.VerticalComboBox.setCurrentIndex(self.theme.display_verticalAlign)
@ -657,7 +651,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.ImageFilenameWidget.setVisible(True)
self.GradientLabel.setVisible(False)
self.GradientComboBox.setVisible(False)
if not theme.font_main_override:
self.FontMainXSpinBox.setEnabled(False)
self.FontMainYSpinBox.setEnabled(False)

View File

@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, resize_image
from openlp.core.ui import HideMode
log = logging.getLogger(__name__)
@ -253,11 +254,17 @@ class MainDisplay(DisplayWidget):
self.waitingFrame = frame
self.waitingFrameTrans = transition
def blankDisplay(self, blanked=True):
def blankDisplay(self, blankType=HideMode.Blank, blanked=True):
log.debug(u'Blank main Display %d' % blanked)
if blanked:
self.displayBlank = True
self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
if blankType == HideMode.Blank:
self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
elif blankType == HideMode.Theme:
theme = self.parent.RenderManager.renderer.bg_frame
if not theme:
theme = self.blankFrame
self.display_text.setPixmap(QtGui.QPixmap.fromImage(theme))
self.waitingFrame = None
self.waitingFrameTrans = False
else:
@ -313,4 +320,4 @@ class MainDisplay(DisplayWidget):
self.video.setVisible(False)
self.display_text.show()
self.display_image.show()
self.blankDisplay(False)
self.blankDisplay(False, False)

View File

@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
class Ui_ServiceItemEditDialog(object):
def setupUi(self, ServiceItemEditDialog):
ServiceItemEditDialog.setObjectName(u'ServiceItemEditDialog')
ServiceItemEditDialog.resize(386, 272)
self.layoutWidget = QtGui.QWidget(ServiceItemEditDialog)
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 351, 241))
self.layoutWidget.setObjectName(u'layoutWidget')
self.outerLayout = QtGui.QVBoxLayout(self.layoutWidget)
self.outerLayout.setObjectName(u'outerLayout')
self.topLayout = QtGui.QHBoxLayout()
self.topLayout.setObjectName(u'topLayout')
self.listWidget = QtGui.QListWidget(self.layoutWidget)
self.listWidget.setAlternatingRowColors(True)
self.listWidget.setObjectName(u'listWidget')
self.topLayout.addWidget(self.listWidget)
self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout')
self.upButton = QtGui.QPushButton(self.layoutWidget)
self.upButton.setObjectName(u'upButton')
self.buttonLayout.addWidget(self.upButton)
spacerItem = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.buttonLayout.addItem(spacerItem)
self.deleteButton = QtGui.QPushButton(self.layoutWidget)
self.deleteButton.setObjectName(u'deleteButton')
self.buttonLayout.addWidget(self.deleteButton)
self.downButton = QtGui.QPushButton(self.layoutWidget)
self.downButton.setObjectName(u'downButton')
self.buttonLayout.addWidget(self.downButton)
self.topLayout.addLayout(self.buttonLayout)
self.outerLayout.addLayout(self.topLayout)
self.buttonBox = QtGui.QDialogButtonBox(self.layoutWidget)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox')
self.outerLayout.addWidget(self.buttonBox)
self.retranslateUi(ServiceItemEditDialog)
QtCore.QMetaObject.connectSlotsByName(ServiceItemEditDialog)
def retranslateUi(self, ServiceItemEditDialog):
ServiceItemEditDialog.setWindowTitle(self.trUtf8('Service Item Maintenance'))
self.upButton.setText(self.trUtf8('Up'))
self.deleteButton.setText(self.trUtf8('Delete'))
self.downButton.setText(self.trUtf8('Down'))

View File

@ -0,0 +1,116 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from serviceitemeditdialog import Ui_ServiceItemEditDialog
class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
"""
This is the form that is used to edit the verses of the song.
"""
def __init__(self, parent=None):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.itemList = []
# enable drop
QtCore.QObject.connect(self.upButton,
QtCore.SIGNAL(u'clicked()'),
self.onItemUp)
QtCore.QObject.connect(self.downButton,
QtCore.SIGNAL(u'clicked()'),
self.onItemDown)
QtCore.QObject.connect(self.deleteButton,
QtCore.SIGNAL(u'clicked()'),
self.onItemDelete)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'),
self.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'),
self.reject)
def setServiceItem(self, item):
self.item = item
self.itemList = []
if self.item.is_image():
self.data = True
for frame in self.item._raw_frames:
self.itemList.append(frame)
self.loadData()
def getServiceItem(self):
if self.data:
self.item._raw_frames = []
if self.item.is_image():
for item in self.itemList:
self.item.add_from_image(item[u'path'],
item[u'title'], item[u'image'])
self.item.render()
return self.item
def loadData(self):
self.listWidget.clear()
for frame in self.itemList:
item_name = QtGui.QListWidgetItem(frame[u'title'])
self.listWidget.addItem(item_name)
def onItemDelete(self):
"""
Delete the selected row
"""
items = self.listWidget.selectedItems()
for item in items:
row = self.listWidget.row(item)
self.itemList.remove(self.itemList[row])
self.loadData()
def onItemUp(self):
"""
Move the selected row up in the list
"""
items = self.listWidget.selectedItems()
for item in items:
row = self.listWidget.row(item)
if row > 0:
temp = self.itemList[row]
self.itemList.remove(self.itemList[row])
self.itemList.insert(row - 1, temp)
self.loadData()
def onItemDown(self):
"""
Move the selected row down in the list
"""
items = self.listWidget.selectedItems()
for item in items:
row = self.listWidget.row(item)
if row < len(self.itemList) and row is not -1:
temp = self.itemList[row]
self.itemList.remove(self.itemList[row])
self.itemList.insert(row + 1, temp)
self.loadData()

View File

@ -34,7 +34,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
contextMenuAction, Receiver, str_to_bool, build_icon
from openlp.core.ui import ServiceItemNoteForm
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
class ServiceManagerList(QtGui.QTreeWidget):
@ -106,7 +106,8 @@ class ServiceManager(QtGui.QWidget):
#Indicates if remoteTriggering is active. If it is the next addServiceItem call
#will replace the currently selected one.
self.remoteEditTriggered = False
self.serviceItemNoteForm = ServiceItemNoteForm()
self.serviceNoteForm = ServiceNoteForm()
self.serviceItemEditForm = ServiceItemEditForm()
#start with the layout
self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0)
@ -203,6 +204,8 @@ class ServiceManager(QtGui.QWidget):
self.menu = QtGui.QMenu()
self.editAction = self.menu.addAction(self.trUtf8('&Edit Item'))
self.editAction.setIcon(build_icon(u':/general/general_edit.png'))
self.maintainAction = self.menu.addAction(self.trUtf8('&Maintain Item'))
self.editAction.setIcon(build_icon(u':/general/general_edit.png'))
self.notesAction = self.menu.addAction(self.trUtf8('&Notes'))
self.notesAction.setIcon(build_icon(u':/services/service_notes.png'))
self.deleteAction = self.menu.addAction(self.trUtf8('&Delete From Service'))
@ -228,9 +231,12 @@ class ServiceManager(QtGui.QWidget):
pos = item.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
serviceItem = self.serviceItems[pos - 1]
self.editAction.setVisible(False)
self.maintainAction.setVisible(False)
self.notesAction.setVisible(False)
if serviceItem[u'service_item'].edit_enabled:
self.editAction.setVisible(True)
if serviceItem[u'service_item'].maintain_allowed:
self.maintainAction.setVisible(True)
if item.parent() is None:
self.notesAction.setVisible(True)
self.themeMenu.menuAction().setVisible(False)
@ -239,6 +245,8 @@ class ServiceManager(QtGui.QWidget):
action = self.menu.exec_(self.ServiceManagerList.mapToGlobal(point))
if action == self.editAction:
self.remoteEdit()
if action == self.maintainAction:
self.onServiceItemEditForm()
if action == self.deleteAction:
self.onDeleteFromService()
if action == self.notesAction:
@ -253,11 +261,20 @@ class ServiceManager(QtGui.QWidget):
def onServiceItemNoteForm(self):
item, count = self.findServiceItem()
self.serviceItemNoteForm.textEdit.setPlainText(
self.serviceNoteForm.textEdit.setPlainText(
self.serviceItems[item][u'service_item'].notes)
if self.serviceItemNoteForm.exec_():
if self.serviceNoteForm.exec_():
self.serviceItems[item][u'service_item'].notes = \
self.serviceItemNoteForm.textEdit.toPlainText()
self.serviceNoteForm.textEdit.toPlainText()
self.repaintServiceList(item, 0)
def onServiceItemEditForm(self):
item, count = self.findServiceItem()
self.serviceItemEditForm.setServiceItem(
self.serviceItems[item][u'service_item'])
if self.serviceItemEditForm.exec_():
self.serviceItems[item][u'service_item'] = \
self.serviceItemEditForm.getServiceItem()
self.repaintServiceList(item, 0)
def nextItem(self):
@ -354,7 +371,7 @@ class ServiceManager(QtGui.QWidget):
def onServiceUp(self):
"""
Move the current ServiceItem up in the list
Note move up means move to top of area ie 0.
Note move up means move to top of area ie 0.
"""
item, count = self.findServiceItem()
if item > 0:
@ -500,7 +517,7 @@ class ServiceManager(QtGui.QWidget):
if item[u'service_item'].uses_file():
for frame in item[u'service_item'].get_frames():
path_from = unicode(os.path.join(
item[u'service_item'].service_item_path,
frame[u'path'],
frame[u'title']))
zip.write(path_from)
file = open(servicefile, u'wb')
@ -642,11 +659,17 @@ class ServiceManager(QtGui.QWidget):
self.repaintServiceList(sitem + 1, 0)
self.parent.LiveController.replaceServiceManagerItem(item)
else:
#nothing selected or dnd
#nothing selected for dnd
if self.droppos == 0:
self.serviceItems.append({u'service_item': item,
u'order': len(self.serviceItems) + 1,
u'expanded':expand})
if isinstance(item, list):
for inditem in item:
self.serviceItems.append({u'service_item': inditem,
u'order': len(self.serviceItems) + 1,
u'expanded':expand})
else:
self.serviceItems.append({u'service_item': item,
u'order': len(self.serviceItems) + 1,
u'expanded':expand})
self.repaintServiceList(len(self.serviceItems) + 1, 0)
else:
self.serviceItems.insert(self.droppos, {u'service_item': item,
@ -667,6 +690,17 @@ class ServiceManager(QtGui.QWidget):
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
def getServiceItem(self):
"""
Send the current item to the Preview slide controller
"""
item, count = self.findServiceItem()
if item == -1:
return False
else:
#Switch on remote edit update functionality.
self.remoteEditTriggered = True
return self.serviceItems[item][u'service_item']
def makeLive(self):
"""
@ -679,7 +713,7 @@ class ServiceManager(QtGui.QWidget):
get_config(u'auto preview', u'False')):
item += 1
if self.serviceItems and item < len(self.serviceItems) and \
self.serviceItems[item][u'service_item'].autoPreviewAllowed:
self.serviceItems[item][u'service_item'].auto_preview_allowed:
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], 0)

View File

@ -24,9 +24,9 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from serviceitemdialog import Ui_ServiceNoteEdit
from servicenotedialog import Ui_ServiceNoteEdit
class ServiceItemNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit):
class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit):
"""
This is the form that is used to edit the verses of the song.
"""

View File

@ -30,6 +30,15 @@ import os
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
class HideMode(object):
"""
This is basically an enumeration class which specifies the mode of a Bible.
Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to
be downloaded from the Internet on an as-needed basis.
"""
Blank = 1
Theme = 2
from openlp.core.lib import OpenLPToolbar, Receiver, str_to_bool, \
PluginConfig, resize_image
@ -94,6 +103,10 @@ class SlideController(QtGui.QWidget):
self.song_edit_list = [
u'Edit Song',
]
if isLive:
self.labelWidth = 20
else:
self.labelWidth = 0
self.timer_id = 0
self.songEdit = False
self.selectedRow = 0
@ -133,12 +146,14 @@ class SlideController(QtGui.QWidget):
self.ControllerLayout.setMargin(0)
# Controller list view
self.PreviewListWidget = SlideList(self)
self.PreviewListWidget.setColumnCount(1)
self.PreviewListWidget.setColumnCount(2)
self.PreviewListWidget.horizontalHeader().setVisible(False)
self.PreviewListWidget.verticalHeader().setVisible(False)
self.PreviewListWidget.setColumnWidth(1, self.Controller.width())
self.PreviewListWidget.setColumnWidth(1, self.labelWidth)
self.PreviewListWidget.setColumnWidth(1, self.Controller.width() - self.labelWidth)
self.PreviewListWidget.isLive = self.isLive
self.PreviewListWidget.setObjectName(u'PreviewListWidget')
self.PreviewListWidget.setSelectionBehavior(1)
self.PreviewListWidget.setEditTriggers(
QtGui.QAbstractItemView.NoEditTriggers)
self.PreviewListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
@ -172,6 +187,12 @@ class SlideController(QtGui.QWidget):
self.blankButton = self.Toolbar.addToolbarButton(
u'Blank Screen', u':/slides/slide_blank.png',
self.trUtf8('Blank Screen'), self.onBlankDisplay, True)
self.themeButton = self.Toolbar.addToolbarButton(
u'Display Theme', u':/slides/slide_theme.png',
self.trUtf8('Theme Screen'), self.onThemeDisplay, True)
self.hideButton = self.Toolbar.addToolbarButton(
u'Hide screen', u':/slides/slide_desktop.png',
self.trUtf8('Hide Screen'), self.onHideDisplay, True)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'live_slide_blank'), self.blankScreen)
if not self.isLive:
@ -309,7 +330,8 @@ class SlideController(QtGui.QWidget):
"""
width = self.parent.ControlSplitter.sizes()[self.split]
height = width * self.parent.RenderManager.screen_ratio
self.PreviewListWidget.setColumnWidth(0, width)
self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
self.PreviewListWidget.setColumnWidth(1, width - self.labelWidth)
#Sort out image hights (Songs , bibles excluded)
if self.serviceItem and not self.serviceItem.is_text():
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
@ -354,7 +376,8 @@ class SlideController(QtGui.QWidget):
if item.is_text():
self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.is_song() and \
str_to_bool(self.songsconfig.get_config(u'show songbar', True)):
str_to_bool(self.songsconfig.get_config(u'show songbar', True)) \
and len(self.slideList) > 0:
self.Toolbar.makeWidgetsVisible([u'Song Menu'])
elif item.is_image():
#Not sensible to allow loops with 1 frame
@ -372,7 +395,7 @@ class SlideController(QtGui.QWidget):
self.Toolbar.setVisible(True)
self.Mediabar.setVisible(False)
self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
if item.edit_enabled and item.fromPlugin:
if item.edit_enabled and item.from_plugin:
self.Toolbar.makeWidgetsVisible(self.song_edit_list)
elif item.is_media():
self.Toolbar.setVisible(False)
@ -443,7 +466,7 @@ class SlideController(QtGui.QWidget):
else:
blanked = False
Receiver.send_message(u'%s_start' % serviceItem.name.lower(), \
[serviceItem.title, serviceItem.service_item_path,
[serviceItem.title, serviceItem.get_frame_path(),
serviceItem.get_frame_title(), slideno, self.isLive, blanked])
self.slideList = {}
width = self.parent.ControlSplitter.sizes()[self.split]
@ -453,12 +476,15 @@ class SlideController(QtGui.QWidget):
self.serviceItem = serviceItem
self.PreviewListWidget.clear()
self.PreviewListWidget.setRowCount(0)
self.PreviewListWidget.setColumnWidth(0, width)
self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
self.PreviewListWidget.setColumnWidth(1, width - self.labelWidth)
if self.isLive:
self.SongMenu.menu().clear()
row = 0
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
self.PreviewListWidget.setRowCount(
self.PreviewListWidget.rowCount() + 1)
rowitem = QtGui.QTableWidgetItem()
item = QtGui.QTableWidgetItem()
slide_height = 0
#It is a based Text Render
@ -474,12 +500,12 @@ class SlideController(QtGui.QWidget):
else:
tag = bits[0]
row = bits[0][0:1]
try:
test = self.slideList[tag]
except:
if tag not in self.slideList:
self.slideList[tag] = framenumber
self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag),
self.onSongBarHandler)
else:
row += 1
item.setText(frame[u'text'])
else:
label = QtGui.QLabel()
@ -489,15 +515,19 @@ class SlideController(QtGui.QWidget):
self.parent.RenderManager.height)
label.setScaledContents(True)
label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
self.PreviewListWidget.setCellWidget(framenumber, 0, label)
self.PreviewListWidget.setCellWidget(framenumber, 1, label)
slide_height = width * self.parent.RenderManager.screen_ratio
self.PreviewListWidget.setItem(framenumber, 0, item)
row += 1
rowitem.setText(unicode(row))
self.PreviewListWidget.setItem(framenumber, 0, rowitem)
self.PreviewListWidget.setItem(framenumber, 1, item)
if slide_height != 0:
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
if self.serviceItem.is_text():
self.PreviewListWidget.resizeRowsToContents()
self.PreviewListWidget.setColumnWidth(
0, self.PreviewListWidget.viewport().size().width())
self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
self.PreviewListWidget.setColumnWidth(1,
self.PreviewListWidget.viewport().size().width() - self.labelWidth )
if slideno > self.PreviewListWidget.rowCount():
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
else:
@ -531,11 +561,32 @@ class SlideController(QtGui.QWidget):
log.debug(u'onBlankDisplay %d' % force)
if force:
self.blankButton.setChecked(True)
self.blankScreen(self.blankButton.isChecked())
self.blankScreen(HideMode.Blank, self.blankButton.isChecked())
self.parent.generalConfig.set_config(u'screen blank',
self.blankButton.isChecked())
def blankScreen(self, blanked=False):
def onThemeDisplay(self, force=False):
"""
Handle the Theme screen button
"""
log.debug(u'onThemeDisplay %d' % force)
if force:
self.themeButton.setChecked(True)
self.blankScreen(HideMode.Theme, self.themeButton.isChecked())
def onHideDisplay(self, force=False):
"""
Handle the Hide screen button
"""
log.debug(u'onHideDisplay %d' % force)
if force:
self.themeButton.setChecked(True)
if self.hideButton.isChecked():
self.parent.mainDisplay.hideDisplay()
else:
self.parent.mainDisplay.showDisplay()
def blankScreen(self, blankType, blanked=False):
"""
Blank the display screen.
"""
@ -546,9 +597,9 @@ class SlideController(QtGui.QWidget):
else:
Receiver.send_message(u'%s_unblank'% self.serviceItem.name.lower())
else:
self.parent.mainDisplay.blankDisplay(blanked)
self.parent.mainDisplay.blankDisplay(blankType, blanked)
else:
self.parent.mainDisplay.blankDisplay(blanked)
self.parent.mainDisplay.blankDisplay(blankType, blanked)
def onSlideSelected(self):
"""
@ -592,7 +643,7 @@ class SlideController(QtGui.QWidget):
QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
else:
label = self.PreviewListWidget.cellWidget(
self.PreviewListWidget.currentRow(), 0)
self.PreviewListWidget.currentRow(), 1)
self.SlidePreview.setPixmap(label.pixmap())
def grabMainDisplay(self):
@ -661,7 +712,8 @@ class SlideController(QtGui.QWidget):
self.serviceItem.name.lower(), self.isLive)
self.updatePreview()
else:
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
self.PreviewListWidget.selectRow(
self.PreviewListWidget.rowCount() - 1)
self.onSlideSelected()
def onStartLoop(self):
@ -702,7 +754,7 @@ class SlideController(QtGui.QWidget):
def onMediaStart(self, item):
if self.isLive:
Receiver.send_message(u'%s_start' % item.name.lower(), \
[item.title, item.service_item_path,
[item.title, item.get_frame_path(),
item.get_frame_title(), self.isLive, self.blankButton.isChecked()])
else:
self.mediaObject.stop()

View File

@ -29,6 +29,8 @@ import logging
import urllib2
from datetime import datetime
from PyQt4 import QtCore
import openlp
log = logging.getLogger(__name__)
@ -124,16 +126,25 @@ def check_latest_version(config, current_version):
log.exception(u'Reason for failure: %s', e.reason)
return version_string
def string_to_unicode(string):
"""
Converts a QString to a Python unicode object.
"""
if isinstance(string, QtCore.QString):
string = unicode(string.toUtf8(), u'utf8')
return string
def variant_to_unicode(variant):
"""
Converts a QVariant to a unicode string.
Converts a QVariant to a Python unicode object.
``variant``
The QVariant instance to convert to unicode.
"""
string = variant.toString()
if isinstance(variant, QtCore.QVariant):
string = variant.toString()
if not isinstance(string, unicode):
string = unicode(string, u'utf8')
string = string_to_unicode(string)
return string
from registry import Registry

View File

@ -29,7 +29,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus
from openlp.plugins.alerts.lib import AlertsManager, DBManager
from openlp.plugins.alerts.forms import AlertsTab, AlertForm, AlertEditForm
from openlp.plugins.alerts.forms import AlertsTab, AlertForm
log = logging.getLogger(__name__)
@ -43,7 +43,6 @@ class alertsPlugin(Plugin):
self.alertsmanager = AlertsManager(self)
self.manager = DBManager(self.config)
self.alertForm = AlertForm(self.manager, self)
self.alertEditForm = AlertEditForm(self.manager, self)
self.status = PluginStatus.Active
def get_settings_tab(self):
@ -90,10 +89,6 @@ class alertsPlugin(Plugin):
self.alertForm.loadList()
self.alertForm.exec_()
def onAlertsEdit(self):
self.alertEditForm.loadList()
self.alertEditForm.exec_()
def about(self):
about_text = self.trUtf8('<b>Alerts Plugin</b><br>This plugin '
'controls the displaying of alerts on the presentations screen')

View File

@ -25,4 +25,3 @@
from alertstab import AlertsTab
from alertform import AlertForm
from alerteditform import AlertEditForm

View File

@ -1,83 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
class Ui_AlertEditDialog(object):
def setupUi(self, AlertEditDialog):
AlertEditDialog.setObjectName(u'AlertEditDialog')
AlertEditDialog.resize(400, 300)
self.buttonBox = QtGui.QDialogButtonBox(AlertEditDialog)
self.buttonBox.setGeometry(QtCore.QRect(220, 270, 173, 27))
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel)
self.buttonBox.setObjectName(u'buttonBox')
self.layoutWidget = QtGui.QWidget(AlertEditDialog)
self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 361, 251))
self.layoutWidget.setObjectName(u'layoutWidget')
self.verticalLayout_2 = QtGui.QVBoxLayout(self.layoutWidget)
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
self.AlertLineEdit = QtGui.QLineEdit(self.layoutWidget)
self.AlertLineEdit.setObjectName(u'AlertLineEdit')
self.horizontalLayout_2.addWidget(self.AlertLineEdit)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.AlertListWidget = QtGui.QListWidget(self.layoutWidget)
self.AlertListWidget.setAlternatingRowColors(True)
self.AlertListWidget.setObjectName(u'AlertListWidget')
self.horizontalLayout.addWidget(self.AlertListWidget)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(u'verticalLayout')
self.SaveButton = QtGui.QPushButton(self.layoutWidget)
self.SaveButton.setObjectName(u'SaveButton')
self.verticalLayout.addWidget(self.SaveButton)
self.ClearButton = QtGui.QPushButton(self.layoutWidget)
self.ClearButton.setObjectName(u'ClearButton')
self.verticalLayout.addWidget(self.ClearButton)
self.AddButton = QtGui.QPushButton(self.layoutWidget)
self.AddButton.setObjectName(u'AddButton')
self.verticalLayout.addWidget(self.AddButton)
self.EditButton = QtGui.QPushButton(self.layoutWidget)
self.EditButton.setObjectName(u'EditButton')
self.verticalLayout.addWidget(self.EditButton)
self.DeleteButton = QtGui.QPushButton(self.layoutWidget)
self.DeleteButton.setObjectName(u'DeleteButton')
self.verticalLayout.addWidget(self.DeleteButton)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.retranslateUi(AlertEditDialog)
QtCore.QMetaObject.connectSlotsByName(AlertEditDialog)
def retranslateUi(self, AlertEditDialog):
AlertEditDialog.setWindowTitle(self.trUtf8('Maintain Alerts'))
self.SaveButton.setText(self.trUtf8('Save'))
self.ClearButton.setText(self.trUtf8('Clear'))
self.AddButton.setText(self.trUtf8('Add'))
self.EditButton.setText(self.trUtf8('Edit'))
self.DeleteButton.setText(self.trUtf8('Delete'))

View File

@ -1,166 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui, QtCore
from openlp.plugins.alerts.lib.models import AlertItem
from alerteditdialog import Ui_AlertEditDialog
class AlertEditForm(QtGui.QDialog, Ui_AlertEditDialog):
"""
Class documentation goes here.
"""
def __init__(self, manager, parent):
"""
Constructor
"""
self.manager = manager
self.parent = parent
QtGui.QDialog.__init__(self, None)
self.setupUi(self)
QtCore.QObject.connect(self.DeleteButton,
QtCore.SIGNAL(u'clicked()'),
self.onDeleteClick)
QtCore.QObject.connect(self.ClearButton,
QtCore.SIGNAL(u'clicked()'),
self.onClearClick)
QtCore.QObject.connect(self.EditButton,
QtCore.SIGNAL(u'clicked()'),
self.onEditClick)
QtCore.QObject.connect(self.AddButton,
QtCore.SIGNAL(u'clicked()'),
self.onAddClick)
QtCore.QObject.connect(self.SaveButton,
QtCore.SIGNAL(u'clicked()'),
self.onSaveClick)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), self.close)
QtCore.QObject.connect(self.AlertLineEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'),
self.onTextChanged)
QtCore.QObject.connect(self.AlertListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onItemSelected)
QtCore.QObject.connect(self.AlertListWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'),
self.onItemSelected)
def loadList(self):
self.AlertListWidget.clear()
alerts = self.manager.get_all_alerts()
for alert in alerts:
item_name = QtGui.QListWidgetItem(alert.text)
item_name.setData(
QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
self.AlertListWidget.addItem(item_name)
self.AddButton.setEnabled(True)
self.ClearButton.setEnabled(False)
self.SaveButton.setEnabled(False)
self.EditButton.setEnabled(False)
self.DeleteButton.setEnabled(False)
def onItemSelected(self):
if self.AlertLineEdit.text():
QtGui.QMessageBox.information(self,
self.trUtf8('Item selected to Edit'),
self.trUtf8('Please save or clear selected item'))
else:
self.EditButton.setEnabled(True)
self.DeleteButton.setEnabled(True)
def onDeleteClick(self):
item = self.AlertListWidget.currentItem()
if item:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.manager.delete_alert(item_id)
row = self.AlertListWidget.row(item)
self.AlertListWidget.takeItem(row)
self.AddButton.setEnabled(True)
self.SaveButton.setEnabled(False)
self.DeleteButton.setEnabled(False)
self.EditButton.setEnabled(False)
def onEditClick(self):
item = self.AlertListWidget.currentItem()
if item:
self.item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.AlertLineEdit.setText(unicode(item.text()))
self.AddButton.setEnabled(True)
self.ClearButton.setEnabled(True)
self.SaveButton.setEnabled(True)
self.DeleteButton.setEnabled(True)
self.EditButton.setEnabled(False)
def onClearClick(self):
self.AlertLineEdit.setText(u'')
self.AddButton.setEnabled(False)
self.ClearButton.setEnabled(True)
self.SaveButton.setEnabled(False)
self.DeleteButton.setEnabled(False)
self.EditButton.setEnabled(False)
def onAddClick(self):
if len(self.AlertLineEdit.text()) == 0:
QtGui.QMessageBox.information(self,
self.trUtf8('Item selected to Add'),
self.trUtf8('Missing data'))
else:
alert = AlertItem()
alert.text = unicode(self.AlertLineEdit.text())
self.manager.save_alert(alert)
self.onClearClick()
self.loadList()
def onSaveClick(self):
alert = self.manager.get_alert(self.item_id)
alert.text = unicode(self.AlertLineEdit.text())
self.manager.save_alert(alert)
self.onClearClick()
self.loadList()
def onTextChanged(self):
self.AddButton.setEnabled(True)
def onDoubleClick(self):
"""
List item has been double clicked to display it
"""
items = self.AlertListWidget.selectedIndexes()
for item in items:
bitem = self.AlertListWidget.item(item.row())
self.triggerAlert(bitem.text())
def onSingleClick(self):
"""
List item has been single clicked to add it to
the edit field so it can be changed.
"""
items = self.AlertListWidget.selectedIndexes()
for item in items:
bitem = self.AlertListWidget.item(item.row())
self.AlertEntryEditItem.setText(bitem.text())
def triggerAlert(self, text):
self.parent.alertsmanager.displayAlert(text)

View File

@ -26,6 +26,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, str_to_bool
from openlp.plugins.alerts.lib.models import AlertItem
class AlertsTab(SettingsTab):
"""
@ -33,6 +34,7 @@ class AlertsTab(SettingsTab):
"""
def __init__(self, parent, section=None):
self.parent = parent
self.manager = parent.manager
SettingsTab.__init__(self, parent.name, section)
def setupUi(self):
@ -149,22 +151,6 @@ class AlertsTab(SettingsTab):
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.HistoryLayout.addItem(self.HistorySpacer)
self.FontLayout.addWidget(self.HistoryWidget)
self.HistoryEditWidget = QtGui.QWidget(self.FontGroupBox)
self.HistoryEditWidget.setObjectName(u'HistoryEditWidget')
self.HistoryEditLayout = QtGui.QHBoxLayout(self.HistoryEditWidget)
self.HistoryEditLayout.setSpacing(8)
self.HistoryEditLayout.setMargin(0)
self.HistoryEditLayout.setObjectName(u'HistoryEditLayout')
self.HistoryEditLabel = QtGui.QLabel(self.HistoryEditWidget)
self.HistoryEditLabel.setObjectName(u'HistoryEditLabel')
self.HistoryEditLayout.addWidget(self.HistoryEditLabel)
self.HistoryEditPushButton = QtGui.QPushButton(self.HistoryEditWidget)
self.HistoryEditPushButton.setObjectName(u'HistoryEditPushButton')
self.HistoryEditLayout.addWidget(self.HistoryEditPushButton)
self.HistoryEditSpacer = QtGui.QSpacerItem(147, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.HistoryEditLayout.addItem(self.HistoryEditSpacer)
self.FontLayout.addWidget(self.HistoryEditWidget)
self.SlideLeftLayout.addWidget(self.FontGroupBox)
self.SlideLeftSpacer = QtGui.QSpacerItem(20, 94,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
@ -201,6 +187,43 @@ class AlertsTab(SettingsTab):
self.SlideRightSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.SlideRightLayout.addItem(self.SlideRightSpacer)
self.layoutWidget = QtGui.QWidget(self)
self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 361, 251))
self.layoutWidget.setObjectName(u'layoutWidget')
self.verticalLayout_2 = QtGui.QVBoxLayout(self.layoutWidget)
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
self.AlertLineEdit = QtGui.QLineEdit(self.layoutWidget)
self.AlertLineEdit.setObjectName(u'AlertLineEdit')
self.horizontalLayout_2.addWidget(self.AlertLineEdit)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.AlertListWidget = QtGui.QListWidget(self.layoutWidget)
self.AlertListWidget.setAlternatingRowColors(True)
self.AlertListWidget.setObjectName(u'AlertListWidget')
self.horizontalLayout.addWidget(self.AlertListWidget)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(u'verticalLayout')
self.SaveButton = QtGui.QPushButton(self.layoutWidget)
self.SaveButton.setObjectName(u'SaveButton')
self.verticalLayout.addWidget(self.SaveButton)
self.ClearButton = QtGui.QPushButton(self.layoutWidget)
self.ClearButton.setObjectName(u'ClearButton')
self.verticalLayout.addWidget(self.ClearButton)
self.AddButton = QtGui.QPushButton(self.layoutWidget)
self.AddButton.setObjectName(u'AddButton')
self.verticalLayout.addWidget(self.AddButton)
self.EditButton = QtGui.QPushButton(self.layoutWidget)
self.EditButton.setObjectName(u'EditButton')
self.verticalLayout.addWidget(self.EditButton)
self.DeleteButton = QtGui.QPushButton(self.layoutWidget)
self.DeleteButton.setObjectName(u'DeleteButton')
self.verticalLayout.addWidget(self.DeleteButton)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.SlideRightLayout.addWidget(self.layoutWidget)
self.AlertsLayout.addWidget(self.AlertRightColumn)
# Signals and slots
QtCore.QObject.connect(self.HistoryCheckBox,
@ -210,8 +233,6 @@ class AlertsTab(SettingsTab):
QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked)
QtCore.QObject.connect(self.FontColorButton,
QtCore.SIGNAL(u'pressed()'), self.onFontColorButtonClicked)
QtCore.QObject.connect(self.HistoryEditPushButton,
QtCore.SIGNAL(u'pressed()'), self.onHistoryEditButtonClicked)
QtCore.QObject.connect(self.FontComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
QtCore.QObject.connect(self.LocationComboBox,
@ -220,6 +241,27 @@ class AlertsTab(SettingsTab):
QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
QtCore.QObject.connect(self.FontSizeSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onFontSizeSpinBoxChanged)
QtCore.QObject.connect(self.DeleteButton,
QtCore.SIGNAL(u'clicked()'),
self.onDeleteClick)
QtCore.QObject.connect(self.ClearButton,
QtCore.SIGNAL(u'clicked()'),
self.onClearClick)
QtCore.QObject.connect(self.EditButton,
QtCore.SIGNAL(u'clicked()'),
self.onEditClick)
QtCore.QObject.connect(self.AddButton,
QtCore.SIGNAL(u'clicked()'),
self.onAddClick)
QtCore.QObject.connect(self.SaveButton,
QtCore.SIGNAL(u'clicked()'),
self.onSaveClick)
QtCore.QObject.connect(self.AlertListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onItemSelected)
QtCore.QObject.connect(self.AlertListWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'),
self.onItemSelected)
def retranslateUi(self):
self.FontGroupBox.setTitle(self.trUtf8('Font'))
@ -232,11 +274,15 @@ class AlertsTab(SettingsTab):
self.TimeoutSpinBox.setSuffix(self.trUtf8('s'))
self.LocationLabel.setText(self.trUtf8('Location:'))
self.HistoryLabel.setText(self.trUtf8('Keep History:'))
self.HistoryEditLabel.setText(self.trUtf8('Edit History:'))
self.PreviewGroupBox.setTitle(self.trUtf8('Preview'))
self.FontPreview.setText(self.trUtf8('openlp.org'))
self.LocationComboBox.setItemText(0, self.trUtf8('Top'))
self.LocationComboBox.setItemText(1, self.trUtf8('Bottom'))
self.SaveButton.setText(self.trUtf8('Save'))
self.ClearButton.setText(self.trUtf8('Clear'))
self.AddButton.setText(self.trUtf8('Add'))
self.EditButton.setText(self.trUtf8('Edit'))
self.DeleteButton.setText(self.trUtf8('Delete'))
def onBackgroundColorButtonClicked(self):
self.bg_color = QtGui.QColorDialog.getColor(
@ -271,9 +317,6 @@ class AlertsTab(SettingsTab):
self.font_size = self.FontSizeSpinBox.value()
self.updateDisplay()
def onHistoryEditButtonClicked(self):
self.parent.onAlertsEdit()
def load(self):
self.timeout = int(self.config.get_config(u'timeout', 5))
self.font_color = unicode(
@ -298,6 +341,75 @@ class AlertsTab(SettingsTab):
font.setFamily(self.font_face)
self.FontComboBox.setCurrentFont(font)
self.updateDisplay()
self.loadList()
def loadList(self):
self.AlertListWidget.clear()
alerts = self.manager.get_all_alerts()
for alert in alerts:
item_name = QtGui.QListWidgetItem(alert.text)
item_name.setData(
QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
self.AlertListWidget.addItem(item_name)
self.AddButton.setEnabled(True)
self.ClearButton.setEnabled(False)
self.SaveButton.setEnabled(False)
self.EditButton.setEnabled(False)
self.DeleteButton.setEnabled(False)
def onItemSelected(self):
self.EditButton.setEnabled(True)
self.DeleteButton.setEnabled(True)
def onDeleteClick(self):
item = self.AlertListWidget.currentItem()
if item:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.manager.delete_alert(item_id)
row = self.AlertListWidget.row(item)
self.AlertListWidget.takeItem(row)
self.AddButton.setEnabled(True)
self.SaveButton.setEnabled(False)
self.DeleteButton.setEnabled(False)
self.EditButton.setEnabled(False)
def onEditClick(self):
item = self.AlertListWidget.currentItem()
if item:
self.item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.AlertLineEdit.setText(unicode(item.text()))
self.AddButton.setEnabled(True)
self.ClearButton.setEnabled(True)
self.SaveButton.setEnabled(True)
self.DeleteButton.setEnabled(True)
self.EditButton.setEnabled(False)
def onClearClick(self):
self.AlertLineEdit.setText(u'')
self.AddButton.setEnabled(False)
self.ClearButton.setEnabled(True)
self.SaveButton.setEnabled(False)
self.DeleteButton.setEnabled(False)
self.EditButton.setEnabled(False)
def onAddClick(self):
if len(self.AlertLineEdit.text()) == 0:
QtGui.QMessageBox.information(self,
self.trUtf8('Item selected to Add'),
self.trUtf8('Missing data'))
else:
alert = AlertItem()
alert.text = unicode(self.AlertLineEdit.text())
self.manager.save_alert(alert)
self.onClearClick()
self.loadList()
def onSaveClick(self):
alert = self.manager.get_alert(self.item_id)
alert.text = unicode(self.AlertLineEdit.text())
self.manager.save_alert(alert)
self.onClearClick()
self.loadList()
def save(self):
self.font_face = self.FontComboBox.currentFont().family()

View File

@ -33,7 +33,7 @@ only_verses = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*([0-9]+)'
r'(?:[ ]*-[ ]*([0-9]+|end))?(?:[ ]*,[ ]*([0-9]+)(?:[ ]*-[ ]*([0-9]+|end))?)?',
re.UNICODE)
chapter_range = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*'
r'([0-9]+)[ ]*-[ ]*([0-9]+)[ ]*[:|v|V][ ]*([0-9]+)',
r'([0-9]+|end)[ ]*-[ ]*([0-9]+)[ ]*[:|v|V][ ]*([0-9]+|end)',
re.UNICODE)
log = logging.getLogger(__name__)

View File

@ -203,7 +203,9 @@ class BGExtract(BibleCommon):
# Let's get the page, and then open it in BeautifulSoup, so as to
# attempt to make "easy" work of bad HTML.
page = urllib2.urlopen(urlstring)
Receiver.send_message(u'process_events')
soup = BeautifulSoup(page)
Receiver.send_message(u'process_events')
verses = soup.find(u'div', u'result-text-style-normal')
verse_number = 0
verse_list = {0: u''}
@ -211,6 +213,7 @@ class BGExtract(BibleCommon):
# This is a PERFECT example of opening the Cthulu tag!
# O Bible Gateway, why doth ye such horrific HTML produce?
for verse in verses:
Receiver.send_message(u'process_events')
if isinstance(verse, Tag) and verse.name == u'div' and filter(lambda a: a[0] == u'class', verse.attrs)[0][1] == u'footnotes':
break
if isinstance(verse, Tag) and verse.name == u'sup' and filter(lambda a: a[0] == u'class', verse.attrs)[0][1] != u'versenum':
@ -219,6 +222,7 @@ class BGExtract(BibleCommon):
continue
if isinstance(verse, Tag) and (verse.name == u'p' or verse.name == u'font') and verse.contents:
for item in verse.contents:
Receiver.send_message(u'process_events')
if isinstance(item, Tag) and (item.name == u'h4' or item.name == u'h5'):
continue
if isinstance(item, Tag) and item.name == u'sup' and filter(lambda a: a[0] == u'class', item.attrs)[0][1] != u'versenum':
@ -231,6 +235,7 @@ class BGExtract(BibleCommon):
continue
if isinstance(item, Tag) and item.name == u'font':
for subitem in item.contents:
Receiver.send_message(u'process_events')
if isinstance(subitem, Tag) and subitem.name == u'sup' and filter(lambda a: a[0] == u'class', subitem.attrs)[0][1] != u'versenum':
continue
if isinstance(subitem, Tag) and subitem.name == u'p' and not subitem.contents:
@ -289,27 +294,42 @@ class CWExtract(BibleCommon):
(version, urlbookname.lower(), chapter)
log.debug(u'URL: %s', chapter_url)
page = urllib2.urlopen(chapter_url)
Receiver.send_message(u'process_events')
if not page:
return None
soup = BeautifulSoup(page)
Receiver.send_message(u'process_events')
htmlverses = soup.findAll(u'span', u'versetext')
verses = {}
reduce_spaces = re.compile(r'[ ]{2,}')
fix_punctuation = re.compile(r'[ ]+([.,;])')
for verse in htmlverses:
Receiver.send_message(u'process_events')
versenumber = int(verse.contents[0].contents[0])
versetext = u''
for part in verse.contents:
Receiver.send_message(u'process_events')
if isinstance(part, NavigableString):
versetext = versetext + part
elif part and part.attrMap and \
(part.attrMap[u'class'] == u'WordsOfChrist' or \
part.attrMap[u'class'] == u'strongs'):
for subpart in part.contents:
Receiver.send_message(u'process_events')
if isinstance(subpart, NavigableString):
versetext = versetext + subpart
elif subpart and subpart.attrMap and \
subpart.attrMap[u'class'] == u'strongs':
for subsub in subpart.contents:
Receiver.send_message(u'process_events')
if isinstance(subsub, NavigableString):
versetext = versetext + subsub
Receiver.send_message(u'process_events')
# Fix up leading and trailing spaces, multiple spaces, and spaces
# between text and , and .
versetext = versetext.strip(u'\n\r\t ')
versetext = reduce_spaces.sub(u' ', versetext)
versetext = fix_punctuation.sub(r'\1', versetext)
verses[versenumber] = versetext
return SearchResults(bookname, chapter, verses)
@ -410,10 +430,12 @@ class HTTPBible(BibleDB):
## we get a correct book. For example it is possible
## to request ac and get Acts back.
bookname = search_results.get_book()
Receiver.send_message(u'process_events')
# check to see if book/chapter exists
db_book = self.get_book(bookname)
self.create_chapter(db_book.id, search_results.get_chapter(),
search_results.get_verselist())
Receiver.send_message(u'process_events')
Receiver.send_message(u'bible_hideprogress')
Receiver.send_message(u'process_events')
return BibleDB.get_verses(self, reference_list)

View File

@ -59,6 +59,7 @@ class BibleMediaItem(MediaManagerItem):
self.ListViewWithDnD_class = BibleListView
self.servicePath = None
self.lastReference = []
self.addToServiceItem = True
MediaManagerItem.__init__(self, parent, icon, title)
# place to store the search results
self.search_results = {}
@ -80,6 +81,7 @@ class BibleMediaItem(MediaManagerItem):
self.hasNewIcon = False
self.hasEditIcon = False
self.hasDeleteIcon = False
self.addToServiceItem = True
def addEndHeaderBar(self):
self.SearchTabWidget = QtGui.QTabWidget(self)
@ -266,8 +268,9 @@ class BibleMediaItem(MediaManagerItem):
MediaManagerItem.addListViewToToolBar(self)
# Progress Bar
self.SearchProgress = QtGui.QProgressBar(self)
self.SearchProgress.setFormat('%p%')
self.SearchProgress.setMaximum(3)
self.SearchProgress.setFormat('')
self.SearchProgress.setMinimum(0)
self.SearchProgress.setMaximum(0)
self.SearchProgress.setGeometry(self.ListView.geometry().left(),
self.ListView.geometry().top(), 81, 23)
self.SearchProgress.setVisible(False)
@ -351,9 +354,10 @@ class BibleMediaItem(MediaManagerItem):
def onSearchProgressShow(self):
self.SearchProgress.setVisible(True)
self.SearchProgress.setMinimum(0)
self.SearchProgress.setMaximum(2)
self.SearchProgress.setValue(1)
Receiver.send_message(u'process_events')
#self.SearchProgress.setMinimum(0)
#self.SearchProgress.setMaximum(2)
#self.SearchProgress.setValue(1)
def onSearchProgressHide(self):
self.SearchProgress.setVisible(False)
@ -445,7 +449,7 @@ class BibleMediaItem(MediaManagerItem):
raw_slides = []
raw_footer = []
bible_text = u''
service_item.autoPreviewAllowed = True
service_item.auto_preview_allowed = True
#If we want to use a 2nd translation / version
bible2 = u''
if self.SearchTabWidget.currentIndex() == 0:
@ -504,7 +508,11 @@ class BibleMediaItem(MediaManagerItem):
if self.parent.settings_tab.layout_style == 0:
raw_slides.append(bible_text)
bible_text = u''
service_item.title = u'%s %s' % (book, verse_text)
if not service_item.title:
service_item.title = u'%s %s' % (book, verse_text)
elif service_item.title.find(self.trUtf8(u'etc')) == -1:
service_item.title = u'%s, %s' \
% (service_item.title, self.trUtf8(u'etc'))
if len(self.parent.settings_tab.bible_theme) == 0:
service_item.theme = None
else:
@ -600,4 +608,4 @@ class BibleMediaItem(MediaManagerItem):
def searchByReference(self, bible, search):
log.debug(u'searchByReference %s, %s', bible, search)
self.search_results = self.parent.manager.get_verses(bible, search)
self.search_results = self.parent.manager.get_verses(bible, search)

View File

@ -144,7 +144,7 @@ class CustomMediaItem(MediaManagerItem):
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else:
item_id = self.remoteCustom
service_item.autoPreviewAllowed = True
service_item.auto_preview_allowed = True
customSlide = self.parent.custommanager.get_custom(item_id)
title = customSlide.title
credit = customSlide.credits
@ -166,4 +166,4 @@ class CustomMediaItem(MediaManagerItem):
else:
raw_footer.append(u'')
service_item.raw_footer = raw_footer
return True
return True

View File

@ -27,7 +27,8 @@ import logging
import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
contextMenuAction
log = logging.getLogger(__name__)
@ -53,7 +54,6 @@ class ImageMediaItem(MediaManagerItem):
self.ListViewWithDnD_class = ImageListView
self.servicePath = None
MediaManagerItem.__init__(self, parent, icon, title)
self.overrideActive = False
def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8('Image')
@ -68,6 +68,7 @@ class ImageMediaItem(MediaManagerItem):
self.hasFileIcon = True
self.hasNewIcon = False
self.hasEditIcon = False
self.addToServiceItem = True
def initialise(self):
log.debug(u'initialise')
@ -81,6 +82,15 @@ class ImageMediaItem(MediaManagerItem):
os.mkdir(self.servicePath)
self.loadList(self.parent.config.load_list(self.ConfigSection))
def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self)
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.ListView.addAction(
contextMenuAction(
self.ListView, u':/slides/slide_blank.png',
self.trUtf8('Replace Live Background'),
self.onReplaceClick))
def addEndHeaderBar(self):
self.ImageWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(
@ -91,38 +101,24 @@ class ImageMediaItem(MediaManagerItem):
self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget')
self.OverrideLayout = QtGui.QVBoxLayout(self.ImageWidget)
self.OverrideLayout.setMargin(5)
self.OverrideLayout.setSpacing(4)
self.OverrideLayout.setObjectName(u'OverrideLayout')
self.OverrideCheckBox = QtGui.QCheckBox(self.ImageWidget)
self.OverrideCheckBox.setObjectName(u'OverrideCheckBox')
self.OverrideCheckBox.setCheckable(True)
self.OverrideCheckBox.setChecked(False)
self.OverrideCheckBox.setText(self.trUtf8('Override background'))
self.OverrideCheckBox.setStatusTip(
self.trUtf8('Allow the background of live slide to be overridden'))
self.OverrideLayout.addWidget(self.OverrideCheckBox)
self.OverrideLabel = QtGui.QLabel(self.ImageWidget)
self.OverrideLabel.setObjectName(u'OverrideLabel')
self.OverrideLayout.addWidget(self.OverrideLabel)
self.blankButton = self.Toolbar.addToolbarButton(
u'Replace Background', u':/slides/slide_blank.png',
self.trUtf8('Replace Live Background'), self.onReplaceClick, False)
# Add the song widget to the page layout
self.PageLayout.addWidget(self.ImageWidget)
QtCore.QObject.connect(self.OverrideCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.toggleOverrideState)
def onDeleteClick(self):
item = self.ListView.currentItem()
if item:
try:
os.remove(os.path.join(self.servicePath, unicode(item.text())))
except:
#if not present do not worry
pass
row = self.ListView.row(item)
self.ListView.takeItem(row)
self.parent.config.set_list(self.ConfigSection, self.getFileList())
items = self.ListView.selectedIndexes()
if items:
for item in items:
text = self.ListView.item(item.row())
try:
os.remove(os.path.join(self.servicePath, unicode(text.text())))
except:
#if not present do not worry
pass
self.ListView.takeItem(item.row())
self.parent.config.set_list(self.ConfigSection, self.getFileList())
def loadList(self, list):
for file in list:
@ -144,7 +140,8 @@ class ImageMediaItem(MediaManagerItem):
items = self.ListView.selectedIndexes()
if items:
service_item.title = self.trUtf8('Image(s)')
service_item.autoPreviewAllowed = True
service_item.auto_preview_allowed = True
service_item.maintain_allowed = True
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
@ -155,24 +152,17 @@ class ImageMediaItem(MediaManagerItem):
else:
return False
def toggleOverrideState(self):
self.overrideActive = not self.overrideActive
if not self.overrideActive:
self.OverrideLabel.setText(u'')
self.parent.render_manager.override_background = None
def onReplaceClick(self):
if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self,
self.trUtf8('No item selected'),
self.trUtf8('You must select one item'))
items = self.ListView.selectedIndexes()
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
frame = QtGui.QImage(unicode(filename))
self.parent.maindisplay.addImageWithText(frame)
def onPreviewClick(self):
if self.overrideActive:
if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self,
self.trUtf8('No items selected...'),
self.trUtf8('You must select one or more items'))
items = self.ListView.selectedIndexes()
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
self.OverrideLabel.setText(bitem.text())
frame = QtGui.QImage(unicode(filename))
self.parent.maindisplay.addImageWithText(frame)
else:
MediaManagerItem.onPreviewClick(self)
MediaManagerItem.onPreviewClick(self)

View File

@ -411,9 +411,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongTabWidget.setCurrentIndex(2)
self.AuthorsListView.setFocus()
#split the verse list by space and mark lower case for testing
taglist = unicode(self.trUtf8(' bcitped'))
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
if len(verse) > 1:
if verse[0:1] == u'v' and verse[1:].isdigit():
if verse[0:1] == u'%s' % self.trUtf8('v') and verse[1:].isdigit():
pass
else:
self.SongTabWidget.setCurrentIndex(0)
@ -421,7 +422,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
return False, \
self.trUtf8('Invalid verse entry - vX')
else:
if u' bcitped'.find(verse) > -1:
if taglist.find(verse) > -1:
pass
else:
self.SongTabWidget.setCurrentIndex(0)

View File

@ -53,32 +53,59 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
QtCore.QObject.connect(self.VerseListComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerseComboChanged)
def startNewLine(self):
if self.VerseTextEdit.textCursor().columnNumber() != 0:
self.VerseTextEdit.insertPlainText(u'\n')
def onAddIntro(self):
self.VerseTextEdit.insertPlainText(u'---[Intro:1]---')
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
% self.trUtf8('Intro'))
self.VerseTextEdit.setFocus()
def onAddEnding(self):
self.VerseTextEdit.insertPlainText(u'---[Ending:1]---')
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
% self.trUtf8('Ending'))
self.VerseTextEdit.setFocus()
def onAddOther(self):
self.VerseTextEdit.insertPlainText(u'---[Other:1]---')
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
% self.trUtf8('Other'))
self.VerseTextEdit.setFocus()
def onAddPreChorus(self):
self.VerseTextEdit.insertPlainText(u'---[PreChorus:1]---')
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
% self.trUtf8('Pre-Chorus'))
self.VerseTextEdit.setFocus()
def onAddBridge(self):
self.VerseTextEdit.insertPlainText(u'---[Bridge:1]---')
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
% self.trUtf8('Bridge'))
self.VerseTextEdit.setFocus()
def onAddChorus(self):
self.VerseTextEdit.insertPlainText(u'---[Chorus:1]---')
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
% self.trUtf8('Chorus'))
self.VerseTextEdit.setFocus()
def onAddVerse(self):
self.VerseTextEdit.insertPlainText(u'---[Verse:1]---')
self.startNewLine()
count = self.VerseTextEdit.toPlainText().\
count(u'---[%s' % self.trUtf8('Verse'))
self.VerseTextEdit.insertPlainText(u'---[%s:%s]---\n'
% (self.trUtf8('Verse'), count + 1))
self.VerseTextEdit.setFocus()
def setVerse(self, text, verseCount=0, single=False, tag=u'Verse:1'):
posVerse = 0
posSub = 0
if len(text) == 0 and not single:
text = u'---[Verse:1]---\n'
text = u'---[%s:1]---\n' % self.trUtf8('Verse')
if single:
id = tag.split(u':')
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly)
@ -124,11 +151,11 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
def getVerseAll(self):
text = self.VerseTextEdit.toPlainText()
if not text.startsWith(u'---['):
text = u'---[Verse:1]---\n%s' % text
text = u'---[%s:1]---\n%s' % (self.trUtf8('Verse'), text)
return text
def onVerseComboChanged(self, id):
if unicode(self.VerseListComboBox.currentText()) == u'Verse':
if unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Verse'):
self.SubVerseListComboBox.setEnabled(True)
else:
self.SubVerseListComboBox.setEnabled(False)

View File

@ -290,7 +290,7 @@ class SongMediaItem(MediaManagerItem):
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else:
item_id = self.remoteSong
service_item.autoPreviewAllowed = True
service_item.auto_preview_allowed = True
song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name
service_item.edit_enabled = True
@ -345,4 +345,4 @@ class SongMediaItem(MediaManagerItem):
service_item.audit = [
song.title, author_audit, song.copyright, song.ccli_number
]
return True
return True

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ServiceItemEditDialog</class>
<widget class="QWidget" name="ServiceItemEditDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>386</width>
<height>272</height>
</rect>
</property>
<property name="windowTitle">
<string>Service Item Maintenance</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>351</width>
<height>241</height>
</rect>
</property>
<layout class="QVBoxLayout" name="outerLayout">
<item>
<layout class="QHBoxLayout" name="topLayout">
<item>
<widget class="QListWidget" name="listWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="buttonLayout">
<item>
<widget class="QPushButton" name="upButton">
<property name="text">
<string>Up</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="deleteButton">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="downButton">
<property name="text">
<string>Down</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>