Add ServiceItemNoteForm and handling

This commit is contained in:
Tim Bentley 2010-03-03 17:48:37 +00:00
parent b949ab0054
commit 6bff7936eb
7 changed files with 146 additions and 12 deletions

View File

@ -32,13 +32,13 @@ from logging import FileHandler
from optparse import OptionParser
from PyQt4 import QtCore, QtGui
log = logging.getLogger()
from openlp.core.lib import Receiver, str_to_bool
from openlp.core.resources import qInitResources
from openlp.core.ui import MainWindow, SplashScreen, ScreenList
from openlp.core.utils import get_config_directory, ConfigHelper
log = logging.getLogger()
application_stylesheet = u"""
QMainWindow::separator
{

View File

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

View File

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'serviceitemdialog.ui'
#
# Created: Tue Mar 2 20:17:21 2010
# by: PyQt4 UI code generator 4.7
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_ServiceNoteEdit(object):
def setupUi(self, ServiceNoteEdit):
ServiceNoteEdit.setObjectName("ServiceNoteEdit")
ServiceNoteEdit.resize(400, 243)
self.widget = QtGui.QWidget(ServiceNoteEdit)
self.widget.setGeometry(QtCore.QRect(20, 10, 361, 223))
self.widget.setObjectName("widget")
self.verticalLayout = QtGui.QVBoxLayout(self.widget)
self.verticalLayout.setObjectName("verticalLayout")
self.textEdit = QtGui.QTextEdit(self.widget)
self.textEdit.setObjectName("textEdit")
self.verticalLayout.addWidget(self.textEdit)
self.buttonBox = QtGui.QDialogButtonBox(self.widget)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(ServiceNoteEdit)
QtCore.QMetaObject.connectSlotsByName(ServiceNoteEdit)
def retranslateUi(self, ServiceNoteEdit):
ServiceNoteEdit.setWindowTitle(QtGui.QApplication.translate("ServiceNoteEdit", "Service Item Notes", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -0,0 +1,44 @@
# -*- 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, 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 serviceitemdialog import Ui_ServiceNoteEdit
class ServiceItemNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit):
"""
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)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'),
self.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'),
self.reject)

View File

@ -31,9 +31,11 @@ import zipfile
log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
contextMenuAction, contextMenuSeparator, contextMenu, Receiver, \
contextMenu, str_to_bool
from openlp.core.ui import ServiceItemNoteForm
class ServiceManagerList(QtGui.QTreeWidget):
@ -56,6 +58,11 @@ class ServiceManagerList(QtGui.QTreeWidget):
else:
pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
serviceItem = self.parent.serviceItems[pos - 1]
self.parent.menuServiceItem = serviceItem
if serviceItem[u'service_item'].is_text():
self.parent.themeMenu.menuAction().setVisible(True)
else:
self.parent.themeMenu.menuAction().setVisible(False)
if serviceItem[u'service_item'].edit_enabled:
self.parent.editAction.setVisible(True)
else:
@ -128,6 +135,7 @@ 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()
#start with the layout
self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0)
@ -180,8 +188,8 @@ class ServiceManager(QtGui.QWidget):
self.ServiceManagerList, ':/services/service_edit.png',
self.trUtf8('&Edit Item'), self.remoteEdit)
self.noteAction = contextMenuAction(
self.ServiceManagerList, ':/system/system_live.png',
self.trUtf8('&Notes'), self.remoteEdit)
self.ServiceManagerList, ':/services/service_notes.png',
self.trUtf8('&Notes'), self.onServiceItemNoteForm)
self.ServiceManagerList.addAction(self.editAction)
self.ServiceManagerList.addAction(self.noteAction)
self.ServiceManagerList.addAction(contextMenuSeparator(
@ -199,10 +207,10 @@ class ServiceManager(QtGui.QWidget):
self.trUtf8('&Remove from Service'), self.onDeleteFromService))
self.ServiceManagerList.addAction(contextMenuSeparator(
self.ServiceManagerList))
self.ThemeMenu = contextMenu(
self.themeMenu = contextMenu(
self.ServiceManagerList, '',
self.trUtf8('&Change Item Theme'))
self.ServiceManagerList.addAction(self.ThemeMenu.menuAction())
self.ServiceManagerList.addAction(self.themeMenu.menuAction())
self.Layout.addWidget(self.ServiceManagerList)
# Add the bottom toolbar
self.OrderToolbar = OpenLPToolbar(self)
@ -226,8 +234,6 @@ class ServiceManager(QtGui.QWidget):
# Connect up our signals and slots
QtCore.QObject.connect(self.ThemeComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected)
QtCore.QObject.connect(self.ServiceManagerList,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.makeLive)
QtCore.QObject.connect(self.ServiceManagerList,
QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed)
QtCore.QObject.connect(self.ServiceManagerList,
@ -249,6 +255,14 @@ class ServiceManager(QtGui.QWidget):
def onPresentationTypes(self, presentation_types):
self.presentation_types = presentation_types
def onServiceItemNoteForm(self):
item, count = self.findServiceItem()
self.serviceItemNoteForm.textEdit.setPlainText(
self.menuServiceItem[u'service_item'].notes)
if self.serviceItemNoteForm.exec_():
self.menuServiceItem[u'service_item'].notes = \
self.serviceItemNoteForm.textEdit.toPlainText()
def nextItem(self):
"""
Called by the SlideController to select the
@ -734,7 +748,7 @@ class ServiceManager(QtGui.QWidget):
A list of current themes to be displayed
"""
self.ThemeComboBox.clear()
self.ThemeMenu.clear()
self.themeMenu.clear()
self.ThemeComboBox.addItem(u'')
for theme in theme_list:
self.ThemeComboBox.addItem(theme)
@ -742,7 +756,7 @@ class ServiceManager(QtGui.QWidget):
self.ServiceManagerList,
None,
theme , self.onThemeChangeAction)
self.ThemeMenu.addAction(action)
self.themeMenu.addAction(action)
id = self.ThemeComboBox.findText(self.service_theme,
QtCore.Qt.MatchExactly)
# Not Found

View File

@ -182,7 +182,7 @@ class SlideController(QtGui.QWidget):
self.trUtf8('Move to live'), self.onGoLive)
self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton(
u'Edit Song', u':/songs/song_edit.png',
u'Edit Song', u':/services/service_edit.png',
self.trUtf8('Edit and re-preview Song'), self.onEditSong)
if isLive:
self.Toolbar.addToolbarSeparator(u'Loop Separator')

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ServiceNoteEdit</class>
<widget class="QWidget" name="ServiceNoteEdit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>243</height>
</rect>
</property>
<property name="windowTitle">
<string>Service Item Notes</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>361</width>
<height>223</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="textEdit"/>
</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>