diff --git a/openlp.pyw b/openlp.pyw index 31869e797..3fd7c051a 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -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 { diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 6e37afc7f..c2f571c3b 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -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'] diff --git a/openlp/core/ui/serviceitemdialog.py b/openlp/core/ui/serviceitemdialog.py new file mode 100644 index 000000000..150375da9 --- /dev/null +++ b/openlp/core/ui/serviceitemdialog.py @@ -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)) + diff --git a/openlp/core/ui/serviceitemform.py b/openlp/core/ui/serviceitemform.py new file mode 100644 index 000000000..43011ead8 --- /dev/null +++ b/openlp/core/ui/serviceitemform.py @@ -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) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index a36b44fed..e55ce7936 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -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 diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 46280ed2b..ff8507f5d 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -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') diff --git a/resources/forms/serviceitemdialog.ui b/resources/forms/serviceitemdialog.ui new file mode 100644 index 000000000..6615b08aa --- /dev/null +++ b/resources/forms/serviceitemdialog.ui @@ -0,0 +1,41 @@ + + + ServiceNoteEdit + + + + 0 + 0 + 400 + 243 + + + + Service Item Notes + + + + + 20 + 10 + 361 + 223 + + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Save + + + + + + + + +