forked from openlp/openlp
Text clean ups
Move Author / Topic / Book edit form Song Edit Add above to Toolbar Add Icons
This commit is contained in:
parent
52cea4125a
commit
b1fd518ff6
@ -243,3 +243,9 @@ class Plugin(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def shutdown(self):
|
||||||
|
"""
|
||||||
|
Called by the plugin Manager to cleanup things
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
@ -174,3 +174,10 @@ class PluginManager(object):
|
|||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
plugin.initialise()
|
plugin.initialise()
|
||||||
|
|
||||||
|
def cleanup_plugins(self):
|
||||||
|
"""
|
||||||
|
Loop through all the plugins and give them an opportunity to
|
||||||
|
clean themselves up
|
||||||
|
"""
|
||||||
|
for plugin in self.plugins:
|
||||||
|
plugin.cleanup()
|
||||||
|
@ -139,16 +139,24 @@ class MainWindow(object):
|
|||||||
if ret == QtGui.QMessageBox.Save:
|
if ret == QtGui.QMessageBox.Save:
|
||||||
self.ServiceManagerContents.onSaveService()
|
self.ServiceManagerContents.onSaveService()
|
||||||
self.mainDisplay.close()
|
self.mainDisplay.close()
|
||||||
|
self.cleanUp()
|
||||||
event.accept()
|
event.accept()
|
||||||
elif ret == QtGui.QMessageBox.Discard:
|
elif ret == QtGui.QMessageBox.Discard:
|
||||||
self.mainDisplay.close()
|
self.mainDisplay.close()
|
||||||
|
self.cleanUp()
|
||||||
event.accept()
|
event.accept()
|
||||||
else:
|
else:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
else:
|
else:
|
||||||
self.mainDisplay.close()
|
self.mainDisplay.close()
|
||||||
|
self.cleanUp()
|
||||||
event.accept()
|
event.accept()
|
||||||
|
|
||||||
|
def cleanUp(self):
|
||||||
|
# Call the cleanup method to shutdown plugins.
|
||||||
|
log.info(u'cleanup plugins')
|
||||||
|
self.plugin_manager.initialise_plugins()
|
||||||
|
|
||||||
def OosChanged(self, reset = False, oosName = None):
|
def OosChanged(self, reset = False, oosName = None):
|
||||||
"""
|
"""
|
||||||
Hook to change the title if the OOS has been changed
|
Hook to change the title if the OOS has been changed
|
||||||
|
@ -58,7 +58,6 @@ class BibleDBImpl(BibleCommon):
|
|||||||
|
|
||||||
def add_verse(self, bookid, chap, vse, text):
|
def add_verse(self, bookid, chap, vse, text):
|
||||||
#log.debug(u'add_verse %s,%s,%s", bookid, chap, vse)
|
#log.debug(u'add_verse %s,%s,%s", bookid, chap, vse)
|
||||||
#metadata.bind.echo = False
|
|
||||||
verse = Verse()
|
verse = Verse()
|
||||||
verse.book_id = bookid
|
verse.book_id = bookid
|
||||||
verse.chapter = chap
|
verse.chapter = chap
|
||||||
@ -69,8 +68,6 @@ class BibleDBImpl(BibleCommon):
|
|||||||
|
|
||||||
def create_chapter(self, bookid, chap, textlist):
|
def create_chapter(self, bookid, chap, textlist):
|
||||||
log.debug(u'create_chapter %s,%s', bookid, chap)
|
log.debug(u'create_chapter %s,%s', bookid, chap)
|
||||||
#log.debug(u'Text %s ", textlist)
|
|
||||||
#metadata.bind.echo = False
|
|
||||||
#text list has book and chapter as first to elements of the array
|
#text list has book and chapter as first to elements of the array
|
||||||
for verse_number, verse_text in textlist.iteritems():
|
for verse_number, verse_text in textlist.iteritems():
|
||||||
verse = Verse()
|
verse = Verse()
|
||||||
@ -83,7 +80,6 @@ class BibleDBImpl(BibleCommon):
|
|||||||
|
|
||||||
def create_book(self, bookname, bookabbrev, testament=1):
|
def create_book(self, bookname, bookabbrev, testament=1):
|
||||||
log.debug(u'create_book %s,%s', bookname, bookabbrev)
|
log.debug(u'create_book %s,%s', bookname, bookabbrev)
|
||||||
#metadata.bind.echo = False
|
|
||||||
book = Book()
|
book = Book()
|
||||||
book.testament_id = testament
|
book.testament_id = testament
|
||||||
book.name = bookname
|
book.name = bookname
|
||||||
@ -94,7 +90,6 @@ class BibleDBImpl(BibleCommon):
|
|||||||
|
|
||||||
def save_meta(self, key, value):
|
def save_meta(self, key, value):
|
||||||
log.debug(u'save_meta %s/%s', key, value)
|
log.debug(u'save_meta %s/%s', key, value)
|
||||||
#metadata.bind.echo = False
|
|
||||||
bmeta = BibleMeta()
|
bmeta = BibleMeta()
|
||||||
bmeta.key = key
|
bmeta.key = key
|
||||||
bmeta.value = value
|
bmeta.value = value
|
||||||
@ -116,7 +111,6 @@ class BibleDBImpl(BibleCommon):
|
|||||||
|
|
||||||
def _load_testament(self, testament):
|
def _load_testament(self, testament):
|
||||||
log.debug(u'load_testaments %s', testament)
|
log.debug(u'load_testaments %s', testament)
|
||||||
#metadata.bind.echo = False
|
|
||||||
test = ONTestament()
|
test = ONTestament()
|
||||||
test.name = testament
|
test.name = testament
|
||||||
self.session.add(test)
|
self.session.add(test)
|
||||||
@ -128,17 +122,11 @@ class BibleDBImpl(BibleCommon):
|
|||||||
|
|
||||||
def get_max_bible_book_verses(self, bookname, chapter):
|
def get_max_bible_book_verses(self, bookname, chapter):
|
||||||
log.debug(u'get_max_bible_book_verses %s, %s', bookname, chapter)
|
log.debug(u'get_max_bible_book_verses %s, %s', bookname, chapter)
|
||||||
#metadata.bind.echo = False
|
|
||||||
#s = text (u'select max(verse.verse) from verse,book where chapter = :c and book_id = book.id and book.name = :b ')
|
|
||||||
#return self.db.execute(s, c=chapter, b=bookname).fetchone()
|
|
||||||
verse = self.session.query(Verse).join(Book).filter(Book.name==bookname).filter(Verse.chapter==chapter).order_by(Verse.verse.desc()).first()
|
verse = self.session.query(Verse).join(Book).filter(Book.name==bookname).filter(Verse.chapter==chapter).order_by(Verse.verse.desc()).first()
|
||||||
return verse.verse
|
return verse.verse
|
||||||
|
|
||||||
def get_max_bible_book_chapter(self, bookname):
|
def get_max_bible_book_chapter(self, bookname):
|
||||||
log.debug(u'get_max_bible_book_chapter %s', bookname)
|
log.debug(u'get_max_bible_book_chapter %s', bookname)
|
||||||
#metadata.bind.echo = False
|
|
||||||
#s = text (u'select max(verse.chapter) from verse,book where book_id = book.id and book.name = :b')
|
|
||||||
#return self.db.execute(s, b=bookname).fetchone()
|
|
||||||
verse = self.session.query(Verse).join(Book).filter(Book.name==bookname).order_by(Verse.chapter.desc()).first()
|
verse = self.session.query(Verse).join(Book).filter(Book.name==bookname).order_by(Verse.chapter.desc()).first()
|
||||||
return verse.chapter
|
return verse.chapter
|
||||||
|
|
||||||
@ -151,34 +139,24 @@ class BibleDBImpl(BibleCommon):
|
|||||||
|
|
||||||
def get_bible_chapter(self, id, chapter):
|
def get_bible_chapter(self, id, chapter):
|
||||||
log.debug(u'get_bible_chapter %s, %s', id, chapter)
|
log.debug(u'get_bible_chapter %s, %s', id, chapter)
|
||||||
#metadata.bind.echo = False
|
|
||||||
return self.session.query(Verse).filter_by(chapter=chapter).filter_by(book_id=id).first()
|
return self.session.query(Verse).filter_by(chapter=chapter).filter_by(book_id=id).first()
|
||||||
|
|
||||||
def get_bible_text(self, bookname, chapter, sverse, everse):
|
def get_bible_text(self, bookname, chapter, sverse, everse):
|
||||||
log.debug(u'get_bible_text %s, %s, %s, %s', bookname, chapter, sverse, everse)
|
log.debug(u'get_bible_text %s, %s, %s, %s', bookname, chapter, sverse, everse)
|
||||||
#metadata.bind.echo = False
|
|
||||||
#bookname = bookname + u"%"
|
|
||||||
#s = text (u'select name,chapter,verse.verse, verse.text FROM verse , book where verse.book_id == book.id AND verse.chapter == :c AND (verse.verse between :v1 and :v2) and (book.name like :b)')
|
|
||||||
#return self.db.execute(s, c=chapter, v1=sverse , v2=everse, b=bookname).fetchall()
|
|
||||||
verses = self.session.query(Verse).join(Book).filter(Book.name==bookname).filter(Verse.chapter==chapter).filter(Verse.verse>=sverse).filter(Verse.verse<=everse).order_by(Verse.verse).all()
|
verses = self.session.query(Verse).join(Book).filter(Book.name==bookname).filter(Verse.chapter==chapter).filter(Verse.verse>=sverse).filter(Verse.verse<=everse).order_by(Verse.verse).all()
|
||||||
return verses
|
return verses
|
||||||
|
|
||||||
def get_verses_from_text(self, versetext):
|
def get_verses_from_text(self, versetext):
|
||||||
log.debug(u'get_verses_from_text %s',versetext)
|
log.debug(u'get_verses_from_text %s',versetext)
|
||||||
#metadata.bind.echo = False
|
|
||||||
versetext = u'%%%s%%' % versetext
|
versetext = u'%%%s%%' % versetext
|
||||||
#s = text (u'select book.name, verse.chapter, verse.verse, verse.text FROM verse , book where verse.book_id == book.id and verse.text like :t')
|
|
||||||
#return self.db.execute(s, t=versetext).fetchall()
|
|
||||||
verses = self.session.query(Verse).filter(Verse.text.like(versetext)).all()
|
verses = self.session.query(Verse).filter(Verse.text.like(versetext)).all()
|
||||||
return verses
|
return verses
|
||||||
|
|
||||||
def dump_bible(self):
|
def dump_bible(self):
|
||||||
log.debug( u'.........Dumping Bible Database')
|
log.debug( u'.........Dumping Bible Database')
|
||||||
log.debug( '...............................Books ')
|
log.debug( '...............................Books ')
|
||||||
#s = text (u'select * FROM book ')
|
|
||||||
books = self.session.query(Book).all()
|
books = self.session.query(Book).all()
|
||||||
log.debug(books)
|
log.debug(books)
|
||||||
log.debug( u'...............................Verses ')
|
log.debug( u'...............................Verses ')
|
||||||
#s = text (u'select * FROM verse ')
|
|
||||||
verses = self.session.query(Verse).all()
|
verses = self.session.query(Verse).all()
|
||||||
log.debug(verses)
|
log.debug(verses)
|
||||||
|
@ -29,8 +29,8 @@ from bibleCSVimpl import BibleCSVImpl
|
|||||||
from bibleDBimpl import BibleDBImpl
|
from bibleDBimpl import BibleDBImpl
|
||||||
from bibleHTTPimpl import BibleHTTPImpl
|
from bibleHTTPimpl import BibleHTTPImpl
|
||||||
|
|
||||||
from openlp.plugins.bibles.lib.tables import *
|
#from openlp.plugins.bibles.lib.tables import *
|
||||||
from openlp.plugins.bibles.lib.classes import *
|
#from openlp.plugins.bibles.lib.classes import *
|
||||||
|
|
||||||
class BibleMode(object):
|
class BibleMode(object):
|
||||||
Full = 1
|
Full = 1
|
||||||
|
@ -68,19 +68,14 @@ class Verse(BaseModel):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def init_models(db_url):
|
def init_models(db_url):
|
||||||
engine = create_engine(db_url)
|
engine = create_engine(db_url)
|
||||||
metadata.bind = engine
|
metadata.bind = engine
|
||||||
session = scoped_session(sessionmaker(autoflush=True,
|
session = scoped_session(sessionmaker(autoflush=True,
|
||||||
autocommit=False,
|
autocommit=False,
|
||||||
bind=engine))
|
bind=engine))
|
||||||
# Don't think this is needed...
|
|
||||||
#metadata.bind.echo = False
|
|
||||||
#Define the tables and indexes
|
|
||||||
return metadata, session
|
return metadata, session
|
||||||
|
|
||||||
|
|
||||||
metadata = MetaData()
|
metadata = MetaData()
|
||||||
meta_table = Table(u'metadata', metadata,
|
meta_table = Table(u'metadata', metadata,
|
||||||
Column(u'key', types.Unicode(255), primary_key=True, index=True),
|
Column(u'key', types.Unicode(255), primary_key=True, index=True),
|
||||||
|
@ -51,7 +51,8 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||||||
Refresh the screen and rest fields
|
Refresh the screen and rest fields
|
||||||
"""
|
"""
|
||||||
self.AuthorListWidget.clear()
|
self.AuthorListWidget.clear()
|
||||||
self.onClearButtonClick() # tidy up screen
|
# tidy up screen
|
||||||
|
self.onClearButtonClick()
|
||||||
authors = self.songmanager.get_authors()
|
authors = self.songmanager.get_authors()
|
||||||
for author in authors:
|
for author in authors:
|
||||||
author_name = QtGui.QListWidgetItem(author.display_name)
|
author_name = QtGui.QListWidgetItem(author.display_name)
|
||||||
@ -127,6 +128,9 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||||||
self.DisplayEdit.setFocus()
|
self.DisplayEdit.setFocus()
|
||||||
|
|
||||||
def _validate_form(self):
|
def _validate_form(self):
|
||||||
|
"""
|
||||||
|
Validate the form and set if Add button if valid.
|
||||||
|
"""
|
||||||
# We need at lease a display name
|
# We need at lease a display name
|
||||||
if len(self.DisplayEdit.displayText()) == 0:
|
if len(self.DisplayEdit.displayText()) == 0:
|
||||||
self.AddUpdateButton.setEnabled(False)
|
self.AddUpdateButton.setEnabled(False)
|
||||||
|
@ -178,9 +178,9 @@ class Ui_EditSongDialog(object):
|
|||||||
self.AuthorRemoveItem = QtGui.QPushButton(self.AuthorRemoveWidget)
|
self.AuthorRemoveItem = QtGui.QPushButton(self.AuthorRemoveWidget)
|
||||||
self.AuthorRemoveItem.setObjectName(u'AuthorRemoveItem')
|
self.AuthorRemoveItem.setObjectName(u'AuthorRemoveItem')
|
||||||
self.AuthorRemoveLayout.addWidget(self.AuthorRemoveItem)
|
self.AuthorRemoveLayout.addWidget(self.AuthorRemoveItem)
|
||||||
self.AddAuthorsButton = QtGui.QPushButton(self.AuthorRemoveWidget)
|
# self.AddAuthorsButton = QtGui.QPushButton(self.AuthorRemoveWidget)
|
||||||
self.AddAuthorsButton.setObjectName(u'AddAuthorsButton')
|
# self.AddAuthorsButton.setObjectName(u'AddAuthorsButton')
|
||||||
self.AuthorRemoveLayout.addWidget(self.AddAuthorsButton)
|
# self.AuthorRemoveLayout.addWidget(self.AddAuthorsButton)
|
||||||
self.AuthorsLayout.addWidget(self.AuthorRemoveWidget)
|
self.AuthorsLayout.addWidget(self.AuthorRemoveWidget)
|
||||||
self.AdditionalLayout.addWidget(self.AuthorsGroupBox)
|
self.AdditionalLayout.addWidget(self.AuthorsGroupBox)
|
||||||
self.SongBookGroup = QtGui.QGroupBox(self.AdditionalWidget)
|
self.SongBookGroup = QtGui.QGroupBox(self.AdditionalWidget)
|
||||||
@ -197,14 +197,14 @@ class Ui_EditSongDialog(object):
|
|||||||
self.SongbookCombo.setSizePolicy(sizePolicy)
|
self.SongbookCombo.setSizePolicy(sizePolicy)
|
||||||
self.SongbookCombo.setObjectName(u'SongbookCombo')
|
self.SongbookCombo.setObjectName(u'SongbookCombo')
|
||||||
self.SongbookLayout.addWidget(self.SongbookCombo, 0, 0, 1, 1)
|
self.SongbookLayout.addWidget(self.SongbookCombo, 0, 0, 1, 1)
|
||||||
self.AddSongBookButton = QtGui.QPushButton(self.SongBookGroup)
|
# self.AddSongBookButton = QtGui.QPushButton(self.SongBookGroup)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
# sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
# sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
# sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.AddSongBookButton.sizePolicy().hasHeightForWidth())
|
# sizePolicy.setHeightForWidth(self.AddSongBookButton.sizePolicy().hasHeightForWidth())
|
||||||
self.AddSongBookButton.setSizePolicy(sizePolicy)
|
# self.AddSongBookButton.setSizePolicy(sizePolicy)
|
||||||
self.AddSongBookButton.setObjectName(u'AddSongBookButton')
|
# self.AddSongBookButton.setObjectName(u'AddSongBookButton')
|
||||||
self.SongbookLayout.addWidget(self.AddSongBookButton, 0, 1, 1, 1)
|
# self.SongbookLayout.addWidget(self.AddSongBookButton, 0, 1, 1, 1)
|
||||||
self.AdditionalLayout.addWidget(self.SongBookGroup)
|
self.AdditionalLayout.addWidget(self.SongBookGroup)
|
||||||
self.TopicGroupBox = QtGui.QGroupBox(self.AdditionalWidget)
|
self.TopicGroupBox = QtGui.QGroupBox(self.AdditionalWidget)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
||||||
@ -255,9 +255,9 @@ class Ui_EditSongDialog(object):
|
|||||||
self.TopicRemoveItem = QtGui.QPushButton(self.TopicRemoveWidget)
|
self.TopicRemoveItem = QtGui.QPushButton(self.TopicRemoveWidget)
|
||||||
self.TopicRemoveItem.setObjectName(u'TopicRemoveItem')
|
self.TopicRemoveItem.setObjectName(u'TopicRemoveItem')
|
||||||
self.TopicRemoveLayout.addWidget(self.TopicRemoveItem)
|
self.TopicRemoveLayout.addWidget(self.TopicRemoveItem)
|
||||||
self.AddTopicButton = QtGui.QPushButton(self.TopicRemoveWidget)
|
# self.AddTopicButton = QtGui.QPushButton(self.TopicRemoveWidget)
|
||||||
self.AddTopicButton.setObjectName(u'AddTopicButton')
|
# self.AddTopicButton.setObjectName(u'AddTopicButton')
|
||||||
self.TopicRemoveLayout.addWidget(self.AddTopicButton)
|
# self.TopicRemoveLayout.addWidget(self.AddTopicButton)
|
||||||
self.TopicLayout.addWidget(self.TopicRemoveWidget)
|
self.TopicLayout.addWidget(self.TopicRemoveWidget)
|
||||||
self.AdditionalLayout.addWidget(self.TopicGroupBox)
|
self.AdditionalLayout.addWidget(self.TopicGroupBox)
|
||||||
self.CopyrightgroupBox = QtGui.QGroupBox(self.AdditionalWidget)
|
self.CopyrightgroupBox = QtGui.QGroupBox(self.AdditionalWidget)
|
||||||
@ -313,8 +313,9 @@ class Ui_EditSongDialog(object):
|
|||||||
EditSongDialog.setTabOrder(self.AuthorAddtoSongItem, self.AuthorsListView)
|
EditSongDialog.setTabOrder(self.AuthorAddtoSongItem, self.AuthorsListView)
|
||||||
EditSongDialog.setTabOrder(self.AuthorsListView, self.AuthorRemoveItem)
|
EditSongDialog.setTabOrder(self.AuthorsListView, self.AuthorRemoveItem)
|
||||||
EditSongDialog.setTabOrder(self.AuthorRemoveItem, self.SongbookCombo)
|
EditSongDialog.setTabOrder(self.AuthorRemoveItem, self.SongbookCombo)
|
||||||
EditSongDialog.setTabOrder(self.SongbookCombo, self.AddSongBookButton)
|
#EditSongDialog.setTabOrder(self.SongbookCombo, self.AddSongBookButton)
|
||||||
EditSongDialog.setTabOrder(self.AddSongBookButton, self.SongTopicCombo)
|
#EditSongDialog.setTabOrder(self.AddSongBookButton, self.SongTopicCombo)
|
||||||
|
EditSongDialog.setTabOrder(self.SongbookCombo, self.SongTopicCombo)
|
||||||
EditSongDialog.setTabOrder(self.SongTopicCombo, self.TopicsListView)
|
EditSongDialog.setTabOrder(self.SongTopicCombo, self.TopicsListView)
|
||||||
EditSongDialog.setTabOrder(self.TopicsListView, self.TopicRemoveItem)
|
EditSongDialog.setTabOrder(self.TopicsListView, self.TopicRemoveItem)
|
||||||
EditSongDialog.setTabOrder(self.TopicRemoveItem, self.CopyrightEditItem)
|
EditSongDialog.setTabOrder(self.TopicRemoveItem, self.CopyrightEditItem)
|
||||||
@ -336,13 +337,13 @@ class Ui_EditSongDialog(object):
|
|||||||
self.AuthorsGroupBox.setTitle(translate(u'EditSongDialog', u'Authors'))
|
self.AuthorsGroupBox.setTitle(translate(u'EditSongDialog', u'Authors'))
|
||||||
self.AuthorAddtoSongItem.setText(translate(u'EditSongDialog', u'Add to Song'))
|
self.AuthorAddtoSongItem.setText(translate(u'EditSongDialog', u'Add to Song'))
|
||||||
self.AuthorRemoveItem.setText(translate(u'EditSongDialog', u'Remove'))
|
self.AuthorRemoveItem.setText(translate(u'EditSongDialog', u'Remove'))
|
||||||
self.AddAuthorsButton.setText(translate(u'EditSongDialog', u'Manage Authors'))
|
#self.AddAuthorsButton.setText(translate(u'EditSongDialog', u'Manage Authors'))
|
||||||
self.SongBookGroup.setTitle(translate(u'EditSongDialog', u'Song Book'))
|
self.SongBookGroup.setTitle(translate(u'EditSongDialog', u'Song Book'))
|
||||||
self.AddSongBookButton.setText(translate(u'EditSongDialog', u'Manage Song Books'))
|
#self.AddSongBookButton.setText(translate(u'EditSongDialog', u'Manage Song Books'))
|
||||||
self.TopicGroupBox.setTitle(translate(u'EditSongDialog', u'Topic'))
|
self.TopicGroupBox.setTitle(translate(u'EditSongDialog', u'Topic'))
|
||||||
self.AddTopicsToSongButton.setText(translate(u'EditSongDialog', u'Add to Song'))
|
self.AddTopicsToSongButton.setText(translate(u'EditSongDialog', u'Add to Song'))
|
||||||
self.TopicRemoveItem.setText(translate(u'EditSongDialog', u'Remove'))
|
self.TopicRemoveItem.setText(translate(u'EditSongDialog', u'Remove'))
|
||||||
self.AddTopicButton.setText(translate(u'EditSongDialog', u'Manage Topics'))
|
#self.AddTopicButton.setText(translate(u'EditSongDialog', u'Manage Topics'))
|
||||||
self.CopyrightgroupBox.setTitle(translate(u'EditSongDialog', u'Copyright Infomaton'))
|
self.CopyrightgroupBox.setTitle(translate(u'EditSongDialog', u'Copyright Infomaton'))
|
||||||
self.CopyrightInsertItem.setText(translate(u'EditSongDialog', u'(c)'))
|
self.CopyrightInsertItem.setText(translate(u'EditSongDialog', u'(c)'))
|
||||||
self.CCLILabel.setText(translate(u'EditSongDialog', u'CCLI Number:'))
|
self.CCLILabel.setText(translate(u'EditSongDialog', u'CCLI Number:'))
|
||||||
|
@ -40,24 +40,24 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# Connecting signals and slots
|
# Connecting signals and slots
|
||||||
QtCore.QObject.connect(self.AddAuthorsButton,
|
# QtCore.QObject.connect(self.AddAuthorsButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onAddAuthorsButtonClicked)
|
# QtCore.SIGNAL(u'clicked()'), self.onAddAuthorsButtonClicked)
|
||||||
QtCore.QObject.connect(self.AuthorAddtoSongItem,
|
QtCore.QObject.connect(self.AuthorAddtoSongItem,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onAuthorAddtoSongItemClicked)
|
QtCore.SIGNAL(u'clicked()'), self.onAuthorAddtoSongItemClicked)
|
||||||
QtCore.QObject.connect(self.AuthorRemoveItem,
|
QtCore.QObject.connect(self.AuthorRemoveItem,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onAuthorRemovefromSongItemClicked)
|
QtCore.SIGNAL(u'clicked()'), self.onAuthorRemovefromSongItemClicked)
|
||||||
QtCore.QObject.connect(self.AuthorsListView,
|
QtCore.QObject.connect(self.AuthorsListView,
|
||||||
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onAuthorsListViewPressed)
|
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onAuthorsListViewPressed)
|
||||||
QtCore.QObject.connect(self.AddTopicButton,
|
# QtCore.QObject.connect(self.AddTopicButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onAddTopicButtonClicked)
|
# QtCore.SIGNAL(u'clicked()'), self.onAddTopicButtonClicked)
|
||||||
QtCore.QObject.connect(self.AddTopicsToSongButton,
|
QtCore.QObject.connect(self.AddTopicsToSongButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onTopicAddtoSongItemClicked)
|
QtCore.SIGNAL(u'clicked()'), self.onTopicAddtoSongItemClicked)
|
||||||
QtCore.QObject.connect(self.TopicRemoveItem,
|
QtCore.QObject.connect(self.TopicRemoveItem,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onTopicRemovefromSongItemClicked)
|
QtCore.SIGNAL(u'clicked()'), self.onTopicRemovefromSongItemClicked)
|
||||||
QtCore.QObject.connect(self.TopicsListView,
|
QtCore.QObject.connect(self.TopicsListView,
|
||||||
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onTopicListViewPressed)
|
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onTopicListViewPressed)
|
||||||
QtCore.QObject.connect(self.AddSongBookButton,
|
# QtCore.QObject.connect(self.AddSongBookButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onAddSongBookButtonClicked)
|
# QtCore.SIGNAL(u'clicked()'), self.onAddSongBookButtonClicked)
|
||||||
QtCore.QObject.connect(self.CopyrightInsertItem,
|
QtCore.QObject.connect(self.CopyrightInsertItem,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertItemTriggered)
|
QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertItemTriggered)
|
||||||
QtCore.QObject.connect(self.AddButton,
|
QtCore.QObject.connect(self.AddButton,
|
||||||
@ -75,9 +75,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
# Create other objects and forms
|
# Create other objects and forms
|
||||||
self.songmanager = songmanager
|
self.songmanager = songmanager
|
||||||
self.eventmanager = eventmanager
|
self.eventmanager = eventmanager
|
||||||
self.authors_form = AuthorsForm(self.songmanager)
|
# self.authors_form = AuthorsForm(self.songmanager)
|
||||||
self.topics_form = TopicsForm(self.songmanager)
|
# self.topics_form = TopicsForm(self.songmanager)
|
||||||
self.song_book_form = SongBookForm(self.songmanager)
|
# self.song_book_form = SongBookForm(self.songmanager)
|
||||||
self.verse_form = EditVerseForm()
|
self.verse_form = EditVerseForm()
|
||||||
self.initialise()
|
self.initialise()
|
||||||
self.AuthorsListView.setSortingEnabled(False)
|
self.AuthorsListView.setSortingEnabled(False)
|
||||||
@ -207,6 +207,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
|
|
||||||
def onAuthorAddtoSongItemClicked(self):
|
def onAuthorAddtoSongItemClicked(self):
|
||||||
item = int(self.AuthorsSelectionComboItem.currentIndex())
|
item = int(self.AuthorsSelectionComboItem.currentIndex())
|
||||||
|
if item > -1:
|
||||||
item_id = (self.AuthorsSelectionComboItem.itemData(item)).toInt()[0]
|
item_id = (self.AuthorsSelectionComboItem.itemData(item)).toInt()[0]
|
||||||
author = self.songmanager.get_author(item_id)
|
author = self.songmanager.get_author(item_id)
|
||||||
self.song.authors.append(author)
|
self.song.authors.append(author)
|
||||||
@ -215,7 +216,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.AuthorsListView.addItem(author_item)
|
self.AuthorsListView.addItem(author_item)
|
||||||
|
|
||||||
def onAuthorsListViewPressed(self):
|
def onAuthorsListViewPressed(self):
|
||||||
if self.AuthorsListView.count() >1:
|
if self.AuthorsListView.count() > 1:
|
||||||
self.AuthorRemoveItem.setEnabled(True)
|
self.AuthorRemoveItem.setEnabled(True)
|
||||||
|
|
||||||
def onAuthorRemovefromSongItemClicked(self):
|
def onAuthorRemovefromSongItemClicked(self):
|
||||||
@ -229,6 +230,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
|
|
||||||
def onTopicAddtoSongItemClicked(self):
|
def onTopicAddtoSongItemClicked(self):
|
||||||
item = int(self.SongTopicCombo.currentIndex())
|
item = int(self.SongTopicCombo.currentIndex())
|
||||||
|
if item > -1:
|
||||||
item_id = (self.SongTopicCombo.itemData(item)).toInt()[0]
|
item_id = (self.SongTopicCombo.itemData(item)).toInt()[0]
|
||||||
topic = self.songmanager.get_topic(item_id)
|
topic = self.songmanager.get_topic(item_id)
|
||||||
self.song.topics.append(topic)
|
self.song.topics.append(topic)
|
||||||
@ -247,29 +249,30 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.song.topics.remove(topic)
|
self.song.topics.remove(topic)
|
||||||
row = self.TopicsListView.row(item)
|
row = self.TopicsListView.row(item)
|
||||||
self.TopicsListView.takeItem(row)
|
self.TopicsListView.takeItem(row)
|
||||||
def onAddAuthorsButtonClicked(self):
|
|
||||||
"""
|
|
||||||
Slot documentation goes here.
|
|
||||||
"""
|
|
||||||
self.authors_form.load_form()
|
|
||||||
self.authors_form.exec_()
|
|
||||||
self.loadAuthors()
|
|
||||||
|
|
||||||
def onAddTopicButtonClicked(self):
|
# def onAddAuthorsButtonClicked(self):
|
||||||
"""
|
# """
|
||||||
Slot documentation goes here.
|
# Slot documentation goes here.
|
||||||
"""
|
# """
|
||||||
self.topics_form.load_form()
|
# self.authors_form.load_form()
|
||||||
self.topics_form.exec_()
|
# self.authors_form.exec_()
|
||||||
self.loadTopics()
|
# self.loadAuthors()
|
||||||
|
#
|
||||||
def onAddSongBookButtonClicked(self):
|
# def onAddTopicButtonClicked(self):
|
||||||
"""
|
# """
|
||||||
Slot documentation goes here.
|
# Slot documentation goes here.
|
||||||
"""
|
# """
|
||||||
self.song_book_form.load_form()
|
# self.topics_form.load_form()
|
||||||
self.song_book_form.exec_()
|
# self.topics_form.exec_()
|
||||||
self.loadBooks()
|
# self.loadTopics()
|
||||||
|
#
|
||||||
|
# def onAddSongBookButtonClicked(self):
|
||||||
|
# """
|
||||||
|
# Slot documentation goes here.
|
||||||
|
# """
|
||||||
|
# self.song_book_form.load_form()
|
||||||
|
# self.song_book_form.exec_()
|
||||||
|
# self.loadBooks()
|
||||||
|
|
||||||
def onSongBookComboChanged(self, item):
|
def onSongBookComboChanged(self, item):
|
||||||
if item == 0:
|
if item == 0:
|
||||||
|
@ -22,7 +22,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import MediaManagerItem, translate, ServiceItem, SongXMLParser , contextMenuAction, contextMenuSeparator
|
from openlp.core.lib import MediaManagerItem, translate, ServiceItem, SongXMLParser , contextMenuAction, contextMenuSeparator
|
||||||
|
|
||||||
from openlp.plugins.songs.forms import EditSongForm
|
from openlp.plugins.songs.forms import EditSongForm, AuthorsForm, TopicsForm, SongBookForm
|
||||||
|
|
||||||
class SongList(QtGui.QListWidget):
|
class SongList(QtGui.QListWidget):
|
||||||
|
|
||||||
@ -59,6 +59,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.ConfigSection = u'song'
|
self.ConfigSection = u'song'
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager)
|
self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager)
|
||||||
|
self.authors_form = AuthorsForm(self.parent.songmanager)
|
||||||
|
self.topics_form = TopicsForm(self.parent.songmanager)
|
||||||
|
self.song_book_form = SongBookForm(self.parent.songmanager)
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
# Add a toolbar
|
# Add a toolbar
|
||||||
@ -90,6 +93,19 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.addToolbarButton(translate(u'SongMediaItem', u'Add Song To Service'),
|
self.addToolbarButton(translate(u'SongMediaItem', u'Add Song To Service'),
|
||||||
translate(u'SongMediaItem', u'Add the selected song(s) to the service'),
|
translate(u'SongMediaItem', u'Add the selected song(s) to the service'),
|
||||||
':/system/system_add.png', self.onSongAddClick, 'SongAddItem')
|
':/system/system_add.png', self.onSongAddClick, 'SongAddItem')
|
||||||
|
self.addToolbarSeparator()
|
||||||
|
## Author Edit Button ##
|
||||||
|
self.addToolbarButton(translate(u'SongMediaItem', u'Edit Authors'),
|
||||||
|
translate(u'SongMediaItem', u'Maintain the list of Song Authors'),
|
||||||
|
':/songs/song_author_edit.png', self.onEditAuthorClick, 'SongAuthorEditItem')
|
||||||
|
## Author Edit Button ##
|
||||||
|
self.addToolbarButton(translate(u'SongMediaItem', u'Edit Books'),
|
||||||
|
translate(u'SongMediaItem', u'Maintain the list of Song Books'),
|
||||||
|
':/songs/song_book_edit.png', self.onEditBookClick, 'SongAuthorEditItem')
|
||||||
|
## Author Edit Button ##
|
||||||
|
self.addToolbarButton(translate(u'SongMediaItem', u'Edit Topics'),
|
||||||
|
translate(u'SongMediaItem', u'Maintain the list of Song Topics'),
|
||||||
|
':/songs/song_topic_edit.png', self.onEditTopicClick, 'SongAuthorEditItem')
|
||||||
## Add the songlist widget ##
|
## Add the songlist widget ##
|
||||||
# Create the tab widget
|
# Create the tab widget
|
||||||
self.SongWidget = QtGui.QWidget(self)
|
self.SongWidget = QtGui.QWidget(self)
|
||||||
@ -222,6 +238,18 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.edit_song_form.newSong()
|
self.edit_song_form.newSong()
|
||||||
self.edit_song_form.exec_()
|
self.edit_song_form.exec_()
|
||||||
|
|
||||||
|
def onEditAuthorClick(self):
|
||||||
|
self.authors_form.load_form()
|
||||||
|
self.authors_form.exec_()
|
||||||
|
|
||||||
|
def onEditTopicClick(self):
|
||||||
|
self.topics_form.load_form()
|
||||||
|
self.topics_form.exec_()
|
||||||
|
|
||||||
|
def onEditBookClick(self):
|
||||||
|
self.song_book_form.load_form()
|
||||||
|
self.song_book_form.exec_()
|
||||||
|
|
||||||
def onSongEditClick(self):
|
def onSongEditClick(self):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item is not None:
|
if item is not None:
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
<file>song_edit.png</file>
|
<file>song_edit.png</file>
|
||||||
<file>song_export.png</file>
|
<file>song_export.png</file>
|
||||||
<file>song_new.png</file>
|
<file>song_new.png</file>
|
||||||
|
<file>song_author_edit.png</file>
|
||||||
|
<file>song_topic_edit.png</file>
|
||||||
|
<file>song_book_edit.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="slides" >
|
<qresource prefix="slides" >
|
||||||
<file>slide_close.png</file>
|
<file>slide_close.png</file>
|
||||||
|
Loading…
Reference in New Issue
Block a user