Display song on Edit form having selected form list

bzr-revno: 255
This commit is contained in:
Tim Bentley 2008-12-24 07:28:25 +00:00
parent 1692da442b
commit 592d329baf
5 changed files with 245 additions and 202 deletions

View File

@ -0,0 +1,184 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'editsongform.ui'
#
# Created: Wed Dec 24 06:24:02 2008
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
#import openlp-2_rc
from PyQt4 import QtCore, QtGui
class Ui_EditSongDialog(object):
def setupUi(self, EditSongForm):
EditSongForm.setObjectName("EditSongForm")
EditSongForm.resize(665, 481)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
EditSongForm.setWindowIcon(icon)
self.EditSongFormLayout = QtGui.QVBoxLayout(EditSongForm)
self.EditSongFormLayout.setSpacing(8)
self.EditSongFormLayout.setMargin(8)
self.EditSongFormLayout.setObjectName("EditSongFormLayout")
self.TopWidget = QtGui.QWidget(EditSongForm)
self.TopWidget.setObjectName("TopWidget")
self.TopWidgetLayout = QtGui.QHBoxLayout(self.TopWidget)
self.TopWidgetLayout.setSpacing(8)
self.TopWidgetLayout.setMargin(0)
self.TopWidgetLayout.setObjectName("TopWidgetLayout")
self.TextWidget = QtGui.QWidget(self.TopWidget)
self.TextWidget.setObjectName("TextWidget")
self.TextWidgetLayout = QtGui.QVBoxLayout(self.TextWidget)
self.TextWidgetLayout.setSpacing(8)
self.TextWidgetLayout.setMargin(0)
self.TextWidgetLayout.setObjectName("TextWidgetLayout")
self.TitleLabel = QtGui.QLabel(self.TextWidget)
self.TitleLabel.setObjectName("TitleLabel")
self.TextWidgetLayout.addWidget(self.TitleLabel)
self.TitleEditItem = QtGui.QLineEdit(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.TitleEditItem.sizePolicy().hasHeightForWidth())
self.TitleEditItem.setSizePolicy(sizePolicy)
self.TitleEditItem.setObjectName("TitleEditItem")
self.TextWidgetLayout.addWidget(self.TitleEditItem)
self.LyricsLabel = QtGui.QLabel(self.TextWidget)
self.LyricsLabel.setObjectName("LyricsLabel")
self.TextWidgetLayout.addWidget(self.LyricsLabel)
self.LyricsTextEdit = QtGui.QTextEdit(self.TextWidget)
self.LyricsTextEdit.setLineWrapMode(QtGui.QTextEdit.NoWrap)
self.LyricsTextEdit.setAcceptRichText(False)
self.LyricsTextEdit.setObjectName("LyricsTextEdit")
self.TextWidgetLayout.addWidget(self.LyricsTextEdit)
self.TopWidgetLayout.addWidget(self.TextWidget)
self.AuthorWidget = QtGui.QWidget(self.TopWidget)
self.AuthorWidget.setObjectName("AuthorWidget")
self.AuthorWidgetLayout = QtGui.QVBoxLayout(self.AuthorWidget)
self.AuthorWidgetLayout.setSpacing(8)
self.AuthorWidgetLayout.setMargin(0)
self.AuthorWidgetLayout.setObjectName("AuthorWidgetLayout")
self.AuthorsLabel = QtGui.QLabel(self.AuthorWidget)
self.AuthorsLabel.setObjectName("AuthorsLabel")
self.AuthorWidgetLayout.addWidget(self.AuthorsLabel)
self.AuthorSelectWidget = QtGui.QWidget(self.AuthorWidget)
self.AuthorSelectWidget.setObjectName("AuthorSelectWidget")
self.AuthorSelectWidgetLayout = QtGui.QHBoxLayout(self.AuthorSelectWidget)
self.AuthorSelectWidgetLayout.setSpacing(8)
self.AuthorSelectWidgetLayout.setMargin(0)
self.AuthorSelectWidgetLayout.setObjectName("AuthorSelectWidgetLayout")
self.AuthorsSelectionComboItem = QtGui.QComboBox(self.AuthorSelectWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth())
self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy)
self.AuthorsSelectionComboItem.setEditable(False)
self.AuthorsSelectionComboItem.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically)
self.AuthorsSelectionComboItem.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AuthorsSelectionComboItem.setMinimumContentsLength(8)
self.AuthorsSelectionComboItem.setObjectName("AuthorsSelectionComboItem")
self.AuthorSelectWidgetLayout.addWidget(self.AuthorsSelectionComboItem)
self.AuthorAddtoSongItem = QtGui.QPushButton(self.AuthorSelectWidget)
self.AuthorAddtoSongItem.setMaximumSize(QtCore.QSize(110, 16777215))
self.AuthorAddtoSongItem.setObjectName("AuthorAddtoSongItem")
self.AuthorSelectWidgetLayout.addWidget(self.AuthorAddtoSongItem)
self.AuthorWidgetLayout.addWidget(self.AuthorSelectWidget)
self.AuthorManagementWidget = QtGui.QWidget(self.AuthorWidget)
self.AuthorManagementWidget.setObjectName("AuthorManagementWidget")
self.AuthorManagementWidgetLayout = QtGui.QHBoxLayout(self.AuthorManagementWidget)
self.AuthorManagementWidgetLayout.setSpacing(8)
self.AuthorManagementWidgetLayout.setMargin(0)
self.AuthorManagementWidgetLayout.setObjectName("AuthorManagementWidgetLayout")
self.NewAuthorButton = QtGui.QPushButton(self.AuthorManagementWidget)
self.NewAuthorButton.setObjectName("NewAuthorButton")
self.AuthorManagementWidgetLayout.addWidget(self.NewAuthorButton)
self.AuthorDeleteItem = QtGui.QPushButton(self.AuthorManagementWidget)
self.AuthorDeleteItem.setObjectName("AuthorDeleteItem")
self.AuthorManagementWidgetLayout.addWidget(self.AuthorDeleteItem)
self.AuthorWidgetLayout.addWidget(self.AuthorManagementWidget)
self.SelectedAuthorsLabel = QtGui.QLabel(self.AuthorWidget)
self.SelectedAuthorsLabel.setObjectName("SelectedAuthorsLabel")
self.AuthorWidgetLayout.addWidget(self.SelectedAuthorsLabel)
self.AuthorsListItem = QtGui.QListView(self.AuthorWidget)
self.AuthorsListItem.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.AuthorsListItem.setSelectionRectVisible(True)
self.AuthorsListItem.setObjectName("AuthorsListItem")
self.AuthorWidgetLayout.addWidget(self.AuthorsListItem)
self.RemoveAuthorWidget = QtGui.QWidget(self.AuthorWidget)
self.RemoveAuthorWidget.setObjectName("RemoveAuthorWidget")
self.RemoveAuthorWidgetLayout = QtGui.QHBoxLayout(self.RemoveAuthorWidget)
self.RemoveAuthorWidgetLayout.setSpacing(8)
self.RemoveAuthorWidgetLayout.setMargin(0)
self.RemoveAuthorWidgetLayout.setObjectName("RemoveAuthorWidgetLayout")
spacerItem = QtGui.QSpacerItem(122, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.RemoveAuthorWidgetLayout.addItem(spacerItem)
self.AuthorRemoveItem = QtGui.QPushButton(self.RemoveAuthorWidget)
self.AuthorRemoveItem.setObjectName("AuthorRemoveItem")
self.RemoveAuthorWidgetLayout.addWidget(self.AuthorRemoveItem)
self.AuthorWidgetLayout.addWidget(self.RemoveAuthorWidget)
self.CopyrightInfoLabel = QtGui.QLabel(self.AuthorWidget)
self.CopyrightInfoLabel.setObjectName("CopyrightInfoLabel")
self.AuthorWidgetLayout.addWidget(self.CopyrightInfoLabel)
self.CopyrightWidget = QtGui.QWidget(self.AuthorWidget)
self.CopyrightWidget.setObjectName("CopyrightWidget")
self.CopyrightWidgetLayout = QtGui.QHBoxLayout(self.CopyrightWidget)
self.CopyrightWidgetLayout.setSpacing(8)
self.CopyrightWidgetLayout.setMargin(0)
self.CopyrightWidgetLayout.setObjectName("CopyrightWidgetLayout")
self.CopyrightEditItem = QtGui.QLineEdit(self.CopyrightWidget)
self.CopyrightEditItem.setObjectName("CopyrightEditItem")
self.CopyrightWidgetLayout.addWidget(self.CopyrightEditItem)
self.CopyrightInsertItem = QtGui.QPushButton(self.CopyrightWidget)
self.CopyrightInsertItem.setMaximumSize(QtCore.QSize(29, 16777215))
self.CopyrightInsertItem.setObjectName("CopyrightInsertItem")
self.CopyrightWidgetLayout.addWidget(self.CopyrightInsertItem)
self.AuthorWidgetLayout.addWidget(self.CopyrightWidget)
self.TopWidgetLayout.addWidget(self.AuthorWidget)
self.EditSongFormLayout.addWidget(self.TopWidget)
self.ThemeWidget = QtGui.QWidget(EditSongForm)
self.ThemeWidget.setObjectName("ThemeWidget")
self.ThemeWidgetLayout = QtGui.QHBoxLayout(self.ThemeWidget)
self.ThemeWidgetLayout.setSpacing(8)
self.ThemeWidgetLayout.setMargin(0)
self.ThemeWidgetLayout.setObjectName("ThemeWidgetLayout")
self.ThemeLabel = QtGui.QLabel(self.ThemeWidget)
self.ThemeLabel.setMaximumSize(QtCore.QSize(70, 16777215))
self.ThemeLabel.setObjectName("ThemeLabel")
self.ThemeWidgetLayout.addWidget(self.ThemeLabel)
self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeWidget)
self.ThemeSelectionComboItem.setObjectName("ThemeSelectionComboItem")
self.ThemeWidgetLayout.addWidget(self.ThemeSelectionComboItem)
self.ThemeAddItem = QtGui.QPushButton(self.ThemeWidget)
self.ThemeAddItem.setMaximumSize(QtCore.QSize(110, 16777215))
self.ThemeAddItem.setObjectName("ThemeAddItem")
self.ThemeWidgetLayout.addWidget(self.ThemeAddItem)
self.EditSongFormLayout.addWidget(self.ThemeWidget)
self.ButtonBox = QtGui.QDialogButtonBox(EditSongForm)
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName("ButtonBox")
self.EditSongFormLayout.addWidget(self.ButtonBox)
self.retranslateUi(EditSongForm)
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("rejected()"), EditSongForm.close)
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), EditSongForm.close)
QtCore.QMetaObject.connectSlotsByName(EditSongForm)
def retranslateUi(self, EditSongForm):
EditSongForm.setWindowTitle(QtGui.QApplication.translate("EditSongForm", "Song Editor", None, QtGui.QApplication.UnicodeUTF8))
self.TitleLabel.setText(QtGui.QApplication.translate("EditSongForm", "Title:", None, QtGui.QApplication.UnicodeUTF8))
self.LyricsLabel.setText(QtGui.QApplication.translate("EditSongForm", "Lyrics:", None, QtGui.QApplication.UnicodeUTF8))
self.AuthorsLabel.setText(QtGui.QApplication.translate("EditSongForm", "Authors:", None, QtGui.QApplication.UnicodeUTF8))
self.AuthorAddtoSongItem.setText(QtGui.QApplication.translate("EditSongForm", "Add to Song", None, QtGui.QApplication.UnicodeUTF8))
self.NewAuthorButton.setText(QtGui.QApplication.translate("EditSongForm", "Add a New Author", None, QtGui.QApplication.UnicodeUTF8))
self.AuthorDeleteItem.setText(QtGui.QApplication.translate("EditSongForm", "Delete Author", None, QtGui.QApplication.UnicodeUTF8))
self.SelectedAuthorsLabel.setText(QtGui.QApplication.translate("EditSongForm", "Selected Authors:", None, QtGui.QApplication.UnicodeUTF8))
self.AuthorRemoveItem.setText(QtGui.QApplication.translate("EditSongForm", "Remove Selected Author(s)", None, QtGui.QApplication.UnicodeUTF8))
self.CopyrightInfoLabel.setText(QtGui.QApplication.translate("EditSongForm", "Copyright Info:", None, QtGui.QApplication.UnicodeUTF8))
self.CopyrightInsertItem.setText(QtGui.QApplication.translate("EditSongForm", "©", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeLabel.setText(QtGui.QApplication.translate("EditSongForm", "Theme", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeAddItem.setText(QtGui.QApplication.translate("EditSongForm", "Add a Theme", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -18,184 +18,31 @@ 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 PyQt4.QtGui import QWidget
from PyQt4.QtCore import pyqtSignature
from openlp.core.resources import *
from editsongdialog import Ui_EditSongDialog
class EditSongForm(object):
class EditSongForm(QWidget, Ui_EditSongDialog):
"""
Class documentation goes here.
"""
def __init__(self, songmanager, parent = None):
"""
Constructor
"""
QWidget.__init__(self, parent)
self.setupUi(self)
self.songmanager = songmanager
self.initialise()
def initialise(self):
a=1
def load_song(self, songid):
self.songid = songid
song = self.songmanager.get_song(songid)
print song
self.TitleEditItem.setText(song[1])
self.LyricsTextEdit.setText(song[2])
self.CopyrightEditItem.setText(song[3])
def __init__(self):
self.EditSongForm = QtGui.QWidget()
self.setupUi()
def setupUi(self):
self.EditSongForm.setObjectName("EditSongForm")
self.EditSongForm.resize(665, 481)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.EditSongForm.setWindowIcon(icon)
self.EditSongFormLayout = QtGui.QVBoxLayout(self.EditSongForm)
self.EditSongFormLayout.setSpacing(8)
self.EditSongFormLayout.setMargin(8)
self.EditSongFormLayout.setObjectName("EditSongFormLayout")
self.TopWidget = QtGui.QWidget(self.EditSongForm)
self.TopWidget.setObjectName("TopWidget")
self.TopWidgetLayout = QtGui.QHBoxLayout(self.TopWidget)
self.TopWidgetLayout.setSpacing(8)
self.TopWidgetLayout.setMargin(0)
self.TopWidgetLayout.setObjectName("TopWidgetLayout")
self.TextWidget = QtGui.QWidget(self.TopWidget)
self.TextWidget.setObjectName("TextWidget")
self.TextWidgetLayout = QtGui.QVBoxLayout(self.TextWidget)
self.TextWidgetLayout.setSpacing(8)
self.TextWidgetLayout.setMargin(0)
self.TextWidgetLayout.setObjectName("TextWidgetLayout")
self.TitleLabel = QtGui.QLabel(self.TextWidget)
self.TitleLabel.setObjectName("TitleLabel")
self.TextWidgetLayout.addWidget(self.TitleLabel)
self.TitleEditItem = QtGui.QLineEdit(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.TitleEditItem.sizePolicy().hasHeightForWidth())
self.TitleEditItem.setSizePolicy(sizePolicy)
self.TitleEditItem.setObjectName("TitleEditItem")
self.TextWidgetLayout.addWidget(self.TitleEditItem)
self.LyricsLabel = QtGui.QLabel(self.TextWidget)
self.LyricsLabel.setObjectName("LyricsLabel")
self.TextWidgetLayout.addWidget(self.LyricsLabel)
self.LyricsTextEdit = QtGui.QTextEdit(self.TextWidget)
self.LyricsTextEdit.setLineWrapMode(QtGui.QTextEdit.NoWrap)
self.LyricsTextEdit.setAcceptRichText(False)
self.LyricsTextEdit.setObjectName("LyricsTextEdit")
self.TextWidgetLayout.addWidget(self.LyricsTextEdit)
self.TopWidgetLayout.addWidget(self.TextWidget)
self.AuthorWidget = QtGui.QWidget(self.TopWidget)
self.AuthorWidget.setObjectName("AuthorWidget")
self.AuthorWidgetLayout = QtGui.QVBoxLayout(self.AuthorWidget)
self.AuthorWidgetLayout.setSpacing(8)
self.AuthorWidgetLayout.setMargin(0)
self.AuthorWidgetLayout.setObjectName("AuthorWidgetLayout")
self.AuthorsLabel = QtGui.QLabel(self.AuthorWidget)
self.AuthorsLabel.setObjectName("AuthorsLabel")
self.AuthorWidgetLayout.addWidget(self.AuthorsLabel)
self.AuthorSelectWidget = QtGui.QWidget(self.AuthorWidget)
self.AuthorSelectWidget.setObjectName("AuthorSelectWidget")
self.AuthorSelectWidgetLayout = QtGui.QHBoxLayout(self.AuthorSelectWidget)
self.AuthorSelectWidgetLayout.setSpacing(8)
self.AuthorSelectWidgetLayout.setMargin(0)
self.AuthorSelectWidgetLayout.setObjectName("AuthorSelectWidgetLayout")
self.AuthorsSelectionComboItem = QtGui.QComboBox(self.AuthorSelectWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth())
self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy)
self.AuthorsSelectionComboItem.setEditable(False)
self.AuthorsSelectionComboItem.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically)
self.AuthorsSelectionComboItem.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AuthorsSelectionComboItem.setMinimumContentsLength(8)
self.AuthorsSelectionComboItem.setObjectName("AuthorsSelectionComboItem")
self.AuthorSelectWidgetLayout.addWidget(self.AuthorsSelectionComboItem)
self.AuthorAddtoSongItem = QtGui.QPushButton(self.AuthorSelectWidget)
self.AuthorAddtoSongItem.setMaximumSize(QtCore.QSize(110, 16777215))
self.AuthorAddtoSongItem.setObjectName("AuthorAddtoSongItem")
self.AuthorSelectWidgetLayout.addWidget(self.AuthorAddtoSongItem)
self.AuthorWidgetLayout.addWidget(self.AuthorSelectWidget)
self.AuthorManagementWidget = QtGui.QWidget(self.AuthorWidget)
self.AuthorManagementWidget.setObjectName("AuthorManagementWidget")
self.AuthorManagementWidgetLayout = QtGui.QHBoxLayout(self.AuthorManagementWidget)
self.AuthorManagementWidgetLayout.setSpacing(8)
self.AuthorManagementWidgetLayout.setMargin(0)
self.AuthorManagementWidgetLayout.setObjectName("AuthorManagementWidgetLayout")
self.NewAuthorButton = QtGui.QPushButton(self.AuthorManagementWidget)
self.NewAuthorButton.setObjectName("NewAuthorButton")
self.AuthorManagementWidgetLayout.addWidget(self.NewAuthorButton)
self.AuthorDeleteItem = QtGui.QPushButton(self.AuthorManagementWidget)
self.AuthorDeleteItem.setObjectName("AuthorDeleteItem")
self.AuthorManagementWidgetLayout.addWidget(self.AuthorDeleteItem)
self.AuthorWidgetLayout.addWidget(self.AuthorManagementWidget)
self.SelectedAuthorsLabel = QtGui.QLabel(self.AuthorWidget)
self.SelectedAuthorsLabel.setObjectName("SelectedAuthorsLabel")
self.AuthorWidgetLayout.addWidget(self.SelectedAuthorsLabel)
self.AuthorsListItem = QtGui.QListView(self.AuthorWidget)
self.AuthorsListItem.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.AuthorsListItem.setSelectionRectVisible(True)
self.AuthorsListItem.setObjectName("AuthorsListItem")
self.AuthorWidgetLayout.addWidget(self.AuthorsListItem)
self.RemoveAuthorWidget = QtGui.QWidget(self.AuthorWidget)
self.RemoveAuthorWidget.setObjectName("RemoveAuthorWidget")
self.RemoveAuthorWidgetLayout = QtGui.QHBoxLayout(self.RemoveAuthorWidget)
self.RemoveAuthorWidgetLayout.setSpacing(8)
self.RemoveAuthorWidgetLayout.setMargin(0)
self.RemoveAuthorWidgetLayout.setObjectName("RemoveAuthorWidgetLayout")
spacerItem = QtGui.QSpacerItem(122, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.RemoveAuthorWidgetLayout.addItem(spacerItem)
self.AuthorRemoveItem = QtGui.QPushButton(self.RemoveAuthorWidget)
self.AuthorRemoveItem.setObjectName("AuthorRemoveItem")
self.RemoveAuthorWidgetLayout.addWidget(self.AuthorRemoveItem)
self.AuthorWidgetLayout.addWidget(self.RemoveAuthorWidget)
self.CopyrightInfoLabel = QtGui.QLabel(self.AuthorWidget)
self.CopyrightInfoLabel.setObjectName("CopyrightInfoLabel")
self.AuthorWidgetLayout.addWidget(self.CopyrightInfoLabel)
self.CopyrightWidget = QtGui.QWidget(self.AuthorWidget)
self.CopyrightWidget.setObjectName("CopyrightWidget")
self.CopyrightWidgetLayout = QtGui.QHBoxLayout(self.CopyrightWidget)
self.CopyrightWidgetLayout.setSpacing(8)
self.CopyrightWidgetLayout.setMargin(0)
self.CopyrightWidgetLayout.setObjectName("CopyrightWidgetLayout")
self.CopyrightEditItem = QtGui.QLineEdit(self.CopyrightWidget)
self.CopyrightEditItem.setObjectName("CopyrightEditItem")
self.CopyrightWidgetLayout.addWidget(self.CopyrightEditItem)
self.CopyrightInsertItem = QtGui.QPushButton(self.CopyrightWidget)
self.CopyrightInsertItem.setMaximumSize(QtCore.QSize(29, 16777215))
self.CopyrightInsertItem.setObjectName("CopyrightInsertItem")
self.CopyrightWidgetLayout.addWidget(self.CopyrightInsertItem)
self.AuthorWidgetLayout.addWidget(self.CopyrightWidget)
self.TopWidgetLayout.addWidget(self.AuthorWidget)
self.EditSongFormLayout.addWidget(self.TopWidget)
self.ThemeWidget = QtGui.QWidget(self.EditSongForm)
self.ThemeWidget.setObjectName("ThemeWidget")
self.ThemeWidgetLayout = QtGui.QHBoxLayout(self.ThemeWidget)
self.ThemeWidgetLayout.setSpacing(8)
self.ThemeWidgetLayout.setMargin(0)
self.ThemeWidgetLayout.setObjectName("ThemeWidgetLayout")
self.ThemeLabel = QtGui.QLabel(self.ThemeWidget)
self.ThemeLabel.setMaximumSize(QtCore.QSize(70, 16777215))
self.ThemeLabel.setObjectName("ThemeLabel")
self.ThemeWidgetLayout.addWidget(self.ThemeLabel)
self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeWidget)
self.ThemeSelectionComboItem.setObjectName("ThemeSelectionComboItem")
self.ThemeWidgetLayout.addWidget(self.ThemeSelectionComboItem)
self.ThemeAddItem = QtGui.QPushButton(self.ThemeWidget)
self.ThemeAddItem.setMaximumSize(QtCore.QSize(110, 16777215))
self.ThemeAddItem.setObjectName("ThemeAddItem")
self.ThemeWidgetLayout.addWidget(self.ThemeAddItem)
self.EditSongFormLayout.addWidget(self.ThemeWidget)
self.ButtonBox = QtGui.QDialogButtonBox(self.EditSongForm)
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName("ButtonBox")
self.EditSongFormLayout.addWidget(self.ButtonBox)
self.retranslateUi()
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("rejected()"), self.EditSongForm.close)
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), self.EditSongForm.close)
QtCore.QMetaObject.connectSlotsByName(self.EditSongForm)
def retranslateUi(self):
self.EditSongForm.setWindowTitle(QtGui.QApplication.translate("EditSongForm", "Song Editor", None, QtGui.QApplication.UnicodeUTF8))
self.TitleLabel.setText(QtGui.QApplication.translate("EditSongForm", "Title:", None, QtGui.QApplication.UnicodeUTF8))
self.LyricsLabel.setText(QtGui.QApplication.translate("EditSongForm", "Lyrics:", None, QtGui.QApplication.UnicodeUTF8))
self.AuthorsLabel.setText(QtGui.QApplication.translate("EditSongForm", "Authors:", None, QtGui.QApplication.UnicodeUTF8))
self.AuthorAddtoSongItem.setText(QtGui.QApplication.translate("EditSongForm", "Add to Song", None, QtGui.QApplication.UnicodeUTF8))
self.NewAuthorButton.setText(QtGui.QApplication.translate("EditSongForm", "Add a New Author", None, QtGui.QApplication.UnicodeUTF8))
self.AuthorDeleteItem.setText(QtGui.QApplication.translate("EditSongForm", "Delete Author", None, QtGui.QApplication.UnicodeUTF8))
self.SelectedAuthorsLabel.setText(QtGui.QApplication.translate("EditSongForm", "Selected Authors:", None, QtGui.QApplication.UnicodeUTF8))
self.AuthorRemoveItem.setText(QtGui.QApplication.translate("EditSongForm", "Remove Selected Author(s)", None, QtGui.QApplication.UnicodeUTF8))
self.CopyrightInfoLabel.setText(QtGui.QApplication.translate("EditSongForm", "Copyright Info:", None, QtGui.QApplication.UnicodeUTF8))
self.CopyrightInsertItem.setText(QtGui.QApplication.translate("EditSongForm", "©", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeLabel.setText(QtGui.QApplication.translate("EditSongForm", "Theme", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeAddItem.setText(QtGui.QApplication.translate("EditSongForm", "Add a Theme", None, QtGui.QApplication.UnicodeUTF8))
def show(self):
self.EditSongForm.show()

View File

@ -59,10 +59,10 @@ class SongDBImpl(BibleCommon):
metadata.bind.echo = False
self.Session = sessionmaker()
self.Session.configure(bind=self.db)
authors = Table('authors', metadata, autoload=True)
settings = Table('settings', metadata, autoload=True)
songauthors = Table('songauthors', metadata, autoload=True)
songs = Table('songs', metadata, autoload=True)
self.authors = Table('authors', metadata, autoload=True)
self.settings = Table('settings', metadata, autoload=True)
self.songauthors = Table('songauthors', metadata, autoload=True)
self.songs = Table('songs', metadata, autoload=True)
def create_tables(self):
log.debug( "createTables")
@ -132,11 +132,11 @@ class SongDBImpl(BibleCommon):
session.add(testmeta)
session.commit()
def get_bible_books(self):
log.debug( "get_bible_book ")
def get_song(self, songid):
log.debug( "get_song ")
metadata.bind.echo = False
s = text (""" select name FROM book order by id """)
return self.db.execute(s).fetchall()
s = text (""" select * FROM songs where songid = :c """)
return self.db.execute(s,c=songid ).fetchone()
def get_max_bible_book_verses(self, bookname, chapter):
log.debug( "get_max_bible_book_verses %s,%s ", bookname , chapter)

View File

@ -128,16 +128,11 @@ class SongManager():
# self._loadBook(biblename,bookid, bookname, bookabbrev)
# self._loadChapter(biblename,bookid, bookname, chptr)
def get_bibles(self, mode="full"):
def get_song(self, songid):
"""
Returns a list of Books of the bible
Returns the details of a song
"""
r=[]
for b , o in self.bibleDBCache.iteritems():
if mode != "full":
print self.bibleHTTPCache[b]
r.append(b)
return r
return self.songDBCache.get_song(songid)
def get_bible_books(self,bible):
"""

View File

@ -31,7 +31,8 @@ class SongsPlugin(Plugin):
# Call the parent constructor
Plugin.__init__(self, 'Songs', '1.9.0')
self.weight = -10
self.edit_song_form = EditSongForm()
self.songmanager = SongManager(self.config)
self.edit_song_form = EditSongForm(self.songmanager)
self.openlp_import_form = OpenLPImportForm()
self.opensong_import_form = OpenSongImportForm()
self.openlp_export_form = OpenLPExportForm()
@ -106,18 +107,22 @@ class SongsPlugin(Plugin):
# Add the song widget to the page layout
self.MediaManagerItem.PageLayout.addWidget(self.SongWidget)
self.SongListView = QtGui.QTableWidget()
self.SongListView.setColumnCount(2)
self.SongListView.setColumnCount(3)
self.SongListView.setColumnHidden(0, True)
self.SongListView.setShowGrid(False)
self.SongListView.setSortingEnabled(False)
self.SongListView.setAlternatingRowColors(True)
self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["Song Name","Author"]))
self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["","Song Name","Author"]))
self.SongListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
self.SongListView.setObjectName("listView")
self.MediaManagerItem.PageLayout.addWidget(self.SongListView)
QtCore.QObject.connect(self.SearchTextButton, QtCore.SIGNAL("pressed()"), self.onSearchTextButton)
QtCore.QObject.connect(self.ClearTextButton, QtCore.SIGNAL("pressed()"), self.onClearTextButton)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.SIGNAL("textChanged(const QString&)"), self.onSearchTextEdit)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.SIGNAL("textChanged(const QString&)"), self.onSearchTextEdit)
QtCore.QObject.connect(self.SongListView, QtCore.SIGNAL("itemPressed(QTableWidgetItem * item)"), self.onSongSelected)
#define and add the context menu
self.SongListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
@ -191,7 +196,10 @@ class SongsPlugin(Plugin):
print self.SearchTextEdit.clear()
def onSearchTextEdit(self):
if len(self.SearchTextEdit.displayText()) > 3: # only search if > 3 characters
sl = 3
if self.SearchTypeComboBox.currentText()=="Lyrics":
sl = 7
if len(self.SearchTextEdit.displayText()) > sl: # only search if > 3 characters
self.onSearchTextButton()
def onSearchTextButton(self):
@ -206,10 +214,17 @@ class SongsPlugin(Plugin):
self._display_results()
def onSongSelected(self, item):
print item
def onSongNewClick(self):
self.edit_song_form.show()
def onSongEditClick(self):
print "SongEdit"
cr = self.SongListView.currentRow()
id = int(self.SongListView.item(cr, 0).text())
self.edit_song_form.load_song(id)
self.edit_song_form.show()
def onSongDeleteClick(self):
@ -238,15 +253,17 @@ class SongsPlugin(Plugin):
def _display_results(self):
self.SongListView.clear() # clear the results
self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["Song Name","Author"]))
self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["","Song Name","Author"]))
self.SongListView.setVerticalHeaderLabels(QtCore.QStringList([""]))
self.SongListView.setRowCount(0)
for id, txt, name in self.searchresults:
c = self.SongListView.rowCount()
self.SongListView.setRowCount(c+1)
twi = QtGui.QTableWidgetItem(str(txt))
twi = QtGui.QTableWidgetItem(str(id))
self.SongListView.setItem(c , 0, twi)
twi = QtGui.QTableWidgetItem(str(txt))
self.SongListView.setItem(c , 1, twi)
twi = QtGui.QTableWidgetItem(str(name))
self.SongListView.setItem(c , 1, twi)
self.SongListView.setItem(c , 2, twi)
self.SongListView.setRowHeight(c, 20)