From fb815b8ca67b95a7dbb7bd86101762dbe2cc62be Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 13 Jun 2009 17:15:55 +0100 Subject: [PATCH] New Song Works Speed Up media Item Fix Song definition --- openlp/plugins/songs/forms/editsongform.py | 5 ----- openlp/plugins/songs/lib/manager.py | 9 +++++++++ openlp/plugins/songs/lib/mediaitem.py | 2 -- openlp/plugins/songs/lib/tables.py | 2 +- openlp/plugins/songs/lib/textlistdata.py | 1 - 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index bd575ec9e..2f80727f5 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -266,11 +266,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.processLyrics() self.processTitle() self.song.song_book_id = 0 -# for i in range(0, self.AuthorsListView.count()): -# print self.AuthorsListView.item(i) -# for i in range(0, self.TopicsListView.count()): -# print self.TopicsListView.item(i) - self.songmanager.save_song(self.song) self.close() diff --git a/openlp/plugins/songs/lib/manager.py b/openlp/plugins/songs/lib/manager.py index 08c944263..460e1f596 100644 --- a/openlp/plugins/songs/lib/manager.py +++ b/openlp/plugins/songs/lib/manager.py @@ -99,6 +99,7 @@ class SongManager(): self.session.commit() return True except: + self.session.rollback() log.error(u'Errow thrown %s', sys.exc_info()[1]) return False @@ -109,6 +110,7 @@ class SongManager(): self.session.commit() return True except: + self.session.rollback() log.error(u'Errow thrown %s', sys.exc_info()[1]) print u'Errow thrown ', sys.exc_info()[1] return False @@ -139,6 +141,7 @@ class SongManager(): self.session.commit() return True except: + self.session.rollback() log.error(u'Errow thrown %s', sys.exc_info()[1]) return False @@ -152,6 +155,7 @@ class SongManager(): self.session.commit() return True except: + self.session.rollback() log.error(u'Errow thrown %s', sys.exc_info()[1]) return False @@ -176,6 +180,7 @@ class SongManager(): self.session.commit() return True except: + self.session.rollback() log.error(u'Errow thrown %s', sys.exc_info()[1]) return False @@ -189,6 +194,7 @@ class SongManager(): self.session.commit() return True except: + self.session.rollback() log.error(u'Errow thrown %s', sys.exc_info()[1]) return False @@ -213,6 +219,8 @@ class SongManager(): self.session.commit() return True except: + self.session.rollback() + log.error(u'Errow thrown %s', sys.exc_info()[1]) return False def delete_book(self, bookid): @@ -225,5 +233,6 @@ class SongManager(): self.session.commit() return True except: + self.session.rollback() log.error(u'Errow thrown %s', sys.exc_info()[1]) return False diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 1f68c86cc..b3868e0d3 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -215,7 +215,6 @@ class SongMediaItem(MediaManagerItem): id = self.SongListData.getId(index) self.edit_song_form.loadSong(id) self.edit_song_form.exec_() - self.onSearchTextButtonClick() def onSongDeleteClick(self): indexes = self.SongListView.selectedIndexes() @@ -223,7 +222,6 @@ class SongMediaItem(MediaManagerItem): id = self.SongListData.getId(index) self.parent.songmanager.delete_song(id) self.SongListData.deleteRow(index) - self.onSearchTextButtonClick() def onSongPreviewClick(self): service_item = ServiceItem(self.parent) diff --git a/openlp/plugins/songs/lib/tables.py b/openlp/plugins/songs/lib/tables.py index 1bdd51a4e..3f975c364 100644 --- a/openlp/plugins/songs/lib/tables.py +++ b/openlp/plugins/songs/lib/tables.py @@ -38,7 +38,7 @@ song_books_table = Table('song_books', metadata, # Definition of the "songs" table songs_table = Table('songs', metadata, - Column('id', types.Integer(), primary_key=True), + Column('id', types.Integer, primary_key=True), Column('song_book_id', types.Integer, ForeignKey('song_books.id'), default=0), Column('title', types.Unicode(255), nullable=False), Column('lyrics', types.UnicodeText, nullable=False), diff --git a/openlp/plugins/songs/lib/textlistdata.py b/openlp/plugins/songs/lib/textlistdata.py index 2ede4a242..64703ea79 100644 --- a/openlp/plugins/songs/lib/textlistdata.py +++ b/openlp/plugins/songs/lib/textlistdata.py @@ -42,7 +42,6 @@ class TextListData(QtCore.QAbstractListModel): def insertRow(self, row, id, title): self.beginInsertRows(QtCore.QModelIndex(),row,row) - log.debug("insert row %d:%s for id %d" % (row,title, id)) self.items.insert(row, (id, title)) self.endInsertRows()