forked from openlp/openlp
Add Song Theme Handling
This commit is contained in:
parent
fbc16a0270
commit
dc40e79ee7
@ -70,6 +70,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), self.onVerseListViewPressed)
|
QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), self.onVerseListViewPressed)
|
||||||
QtCore.QObject.connect(self.SongbookCombo,
|
QtCore.QObject.connect(self.SongbookCombo,
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onSongBookComboChanged)
|
QtCore.SIGNAL(u'activated(int)'), self.onSongBookComboChanged)
|
||||||
|
QtCore.QObject.connect(self.ThemeSelectionComboItem,
|
||||||
|
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged)
|
||||||
# Create other objects and forms
|
# Create other objects and forms
|
||||||
self.songmanager = songmanager
|
self.songmanager = songmanager
|
||||||
self.authors_form = AuthorsForm(self.songmanager)
|
self.authors_form = AuthorsForm(self.songmanager)
|
||||||
@ -110,6 +112,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
for book in books:
|
for book in books:
|
||||||
self.SongbookCombo.addItem(book.name)
|
self.SongbookCombo.addItem(book.name)
|
||||||
|
|
||||||
|
def loadThemes(self, theme_list):
|
||||||
|
self.ThemeSelectionComboItem.clear()
|
||||||
|
self.ThemeSelectionComboItem.addItem(u' ')
|
||||||
|
for theme in theme_list:
|
||||||
|
self.ThemeSelectionComboItem.addItem(theme)
|
||||||
|
|
||||||
def newSong(self):
|
def newSong(self):
|
||||||
log.debug(u'New Song')
|
log.debug(u'New Song')
|
||||||
self.song = Song()
|
self.song = Song()
|
||||||
@ -132,6 +140,13 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
# Not Found
|
# Not Found
|
||||||
id = 0
|
id = 0
|
||||||
book_name.setCurrentIndex(id)
|
book_name.setCurrentIndex(id)
|
||||||
|
if self.song.theme_name is not None and len(self.song.theme_name) > 0:
|
||||||
|
id = self.SongbookCombo.findText(unicode(self.song.theme_name), QtCore.Qt.MatchExactly)
|
||||||
|
if id == -1:
|
||||||
|
# Not Found
|
||||||
|
id = 0
|
||||||
|
self.song.theme_name = None
|
||||||
|
self.SongbookCombo.setCurrentIndex(id)
|
||||||
if len(title) > 1:
|
if len(title) > 1:
|
||||||
self.AlternativeEdit.setText(title[1])
|
self.AlternativeEdit.setText(title[1])
|
||||||
self.CopyrightEditItem.setText(self.song.copyright)
|
self.CopyrightEditItem.setText(self.song.copyright)
|
||||||
@ -233,6 +248,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
book = self.songmanager.get_book_by_name(book_name)
|
book = self.songmanager.get_book_by_name(book_name)
|
||||||
self.song.song_book_id = book.id
|
self.song.song_book_id = book.id
|
||||||
|
|
||||||
|
def onThemeComboChanged(self, item):
|
||||||
|
if item == 0:
|
||||||
|
#None means no Theme
|
||||||
|
self.song.song_theme = None
|
||||||
|
else:
|
||||||
|
them_name = unicode(self.ThemeSelectionComboItem.itemText(item))
|
||||||
|
self.song.theme_name = them_name
|
||||||
|
|
||||||
def onVerseListViewPressed(self):
|
def onVerseListViewPressed(self):
|
||||||
self.EditButton.setEnabled(True)
|
self.EditButton.setEnabled(True)
|
||||||
self.DeleteButton.setEnabled(True)
|
self.DeleteButton.setEnabled(True)
|
||||||
|
@ -238,10 +238,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
for index in indexes:
|
for index in indexes:
|
||||||
id = self.SongListData.getId(index)
|
id = self.SongListData.getId(index)
|
||||||
song = self.parent.songmanager.get_song(id)
|
song = self.parent.songmanager.get_song(id)
|
||||||
if song.theme_name == None or len(song.theme_name) == 0:
|
service_item.theme = song.theme_name
|
||||||
service_item.theme = None
|
|
||||||
else:
|
|
||||||
service_item.theme = song.theme_name
|
|
||||||
if song.lyrics.startswith(u'<?xml version='):
|
if song.lyrics.startswith(u'<?xml version='):
|
||||||
songXML=SongXMLParser(song.lyrics)
|
songXML=SongXMLParser(song.lyrics)
|
||||||
verseList = songXML.get_verses()
|
verseList = songXML.get_verses()
|
||||||
|
@ -79,7 +79,6 @@ class SongsPlugin(Plugin):
|
|||||||
QtCore.QObject.connect(self.ImportOpenlp2Item, QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
|
QtCore.QObject.connect(self.ImportOpenlp2Item, QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
|
||||||
QtCore.QObject.connect(self.ImportOpenSongItem, QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
QtCore.QObject.connect(self.ImportOpenSongItem, QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
||||||
|
|
||||||
|
|
||||||
def add_export_menu_item(self, export_menu):
|
def add_export_menu_item(self, export_menu):
|
||||||
self.ExportSongMenu = QtGui.QMenu(export_menu)
|
self.ExportSongMenu = QtGui.QMenu(export_menu)
|
||||||
self.ExportSongMenu.setObjectName(u'ExportSongMenu')
|
self.ExportSongMenu.setObjectName(u'ExportSongMenu')
|
||||||
@ -125,7 +124,7 @@ class SongsPlugin(Plugin):
|
|||||||
log.debug(u'Handle event called with event %s' % event.event_type)
|
log.debug(u'Handle event called with event %s' % event.event_type)
|
||||||
if event.event_type == EventType.ThemeListChanged:
|
if event.event_type == EventType.ThemeListChanged:
|
||||||
log.debug(u'New Theme request received')
|
log.debug(u'New Theme request received')
|
||||||
#self.edit_custom_form.loadThemes(self.theme_manager.getThemes())
|
self.media_item.edit_song_form.loadThemes(self.theme_manager.getThemes())
|
||||||
if event.event_type == EventType.LoadServiceItem and event.payload == 'Song':
|
if event.event_type == EventType.LoadServiceItem and event.payload == 'Song':
|
||||||
log.debug(u'Load Service Item received')
|
log.debug(u'Load Service Item received')
|
||||||
self.media_item.onSongAddClick()
|
self.media_item.onSongAddClick()
|
||||||
|
Loading…
Reference in New Issue
Block a user