Remove direct usage of AuthorSong

This commit is contained in:
Samuel Mehrbrodt 2014-05-07 12:30:55 +02:00
parent ee7a8b9804
commit a9e620c175
2 changed files with 5 additions and 10 deletions

View File

@ -42,7 +42,7 @@ from openlp.core.common import Registry, RegistryProperties, AppLocation, UiStri
from openlp.core.lib import FileDialog, PluginStatus, MediaType, create_separated_list from openlp.core.lib import FileDialog, PluginStatus, MediaType, create_separated_list
from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box
from openlp.plugins.songs.lib import VerseType, clean_song from openlp.plugins.songs.lib import VerseType, clean_song
from openlp.plugins.songs.lib.db import Book, Song, Author, AuthorSong, AuthorType, Topic, MediaFile from openlp.plugins.songs.lib.db import Book, Song, Author, AuthorType, Topic, MediaFile
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
from openlp.plugins.songs.lib.xml import SongXML from openlp.plugins.songs.lib.xml import SongXML
from openlp.plugins.songs.forms.editsongdialog import Ui_EditSongDialog from openlp.plugins.songs.forms.editsongdialog import Ui_EditSongDialog
@ -916,10 +916,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
self.song.authors_songs = [] self.song.authors_songs = []
for row in range(self.authors_list_view.count()): for row in range(self.authors_list_view.count()):
item = self.authors_list_view.item(row) item = self.authors_list_view.item(row)
author_song = AuthorSong() self.song.add_author(self.manager.get_object(Author, item.data(QtCore.Qt.UserRole)[0]),
author_song.author_id = item.data(QtCore.Qt.UserRole)[0] item.data(QtCore.Qt.UserRole)[1])
author_song.author_type = item.data(QtCore.Qt.UserRole)[1]
self.song.authors_songs.append(author_song)
self.song.topics = [] self.song.topics = []
for row in range(self.topics_list_view.count()): for row in range(self.topics_list_view.count()):
item = self.topics_list_view.item(row) item = self.topics_list_view.item(row)

View File

@ -71,7 +71,7 @@ from lxml import etree, objectify
from openlp.core.common import translate from openlp.core.common import translate
from openlp.core.lib import FormattingTags from openlp.core.lib import FormattingTags
from openlp.plugins.songs.lib import VerseType, clean_song from openlp.plugins.songs.lib import VerseType, clean_song
from openlp.plugins.songs.lib.db import Author, AuthorSong, AuthorType, Book, Song, Topic from openlp.plugins.songs.lib.db import Author, AuthorType, Book, Song, Topic
from openlp.core.utils import get_application_version from openlp.core.utils import get_application_version
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -519,10 +519,7 @@ class OpenLyrics(object):
author = Author.populate(display_name=display_name, author = Author.populate(display_name=display_name,
last_name=display_name.split(' ')[-1], last_name=display_name.split(' ')[-1],
first_name=' '.join(display_name.split(' ')[:-1])) first_name=' '.join(display_name.split(' ')[:-1]))
author_song = AuthorSong() song.add_author(author, author_type)
author_song.author = author
author_song.author_type = author_type
song.authors_songs.append(author_song)
def _process_cclinumber(self, properties, song): def _process_cclinumber(self, properties, song):
""" """