diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 28cba079a..f701536bc 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -155,21 +155,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): Check the validity of the form. Only display the 'save' if the data can be saved. """ valid = True # Lets be nice and assume the data is correct. - if len(self.TitleEditItem.displayText()) == 0: #Song title missing + if len(self.TitleEditItem.displayText()) == 0: valid = False - #self._color_widget(self.TitleEditItem, True) - #else: - #self._color_widget(self.TitleEditItem, False) - if len(self.CopyrightEditItem.displayText()) == 0: #Song title missing + if len(self.CopyrightEditItem.displayText()) == 0: valid = False - #self._color_widget(self.CopyrightEditItem, True) - #else: - #self._color_widget(self.CopyrightEditItem, False) - - if valid: - self.ButtonBox.addButton(self.savebutton, QtGui.QDialogButtonBox.AcceptRole) # hide the save button tile screen is valid - else: - self.ButtonBox.removeButton(self.savebutton) # hide the save button tile screen is valid def _color_widget(self, slot, invalid): r = Qt.QPalette(slot.palette()) @@ -193,4 +182,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.CopyrightEditItem.setCursorPosition(pos + 1) def onAccept(self): - a = c + #self.song.topics.append(9) << need opject here + self.song.title = unicode(self.TitleEditItem.displayText()) + self.song.copyright = unicode(self.CopyrightEditItem.displayText()) + 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 6ef309fa6..783c446c3 100644 --- a/openlp/plugins/songs/lib/manager.py +++ b/openlp/plugins/songs/lib/manager.py @@ -34,8 +34,8 @@ class SongManager(): """ global log - log = logging.getLogger('SongManager') - log.info('Song manager loaded') + log = logging.getLogger(u'SongManager') + log.info(u'Song manager loaded') def __init__(self, config): """ @@ -43,7 +43,7 @@ class SongManager(): don't exist. """ self.config = config - log.debug('Song Initialising') + log.debug(u'Song Initialising') self.db_url = u'' db_type = self.config.get_config(u'db type', u'sqlite') if db_type == u'sqlite': @@ -58,7 +58,7 @@ class SongManager(): self.session = init_models(self.db_url) if not songs_table.exists(): metadata.create_all() - log.debug('Song Initialised') + log.debug(u'Song Initialised') def process_dialog(self, dialogobject): self.dialogobject = dialogobject @@ -99,6 +99,8 @@ class SongManager(): self.session.commit() return True except: + log.error(u'Errow thrown %s', sys.exc_info()[1]) + print u'Errow thrown ', sys.exc_info()[1] return False def delete_song(self, song): @@ -130,6 +132,7 @@ class SongManager(): self.session.commit() return True except: + log.error(u'Errow thrown %s', sys.exc_info()[1]) return False def delete_author(self, authorid): @@ -142,7 +145,7 @@ class SongManager(): self.session.commit() return True except: - log.error("Errow thrown %s", sys.exc_info()[1]) + log.error(u'Errow thrown %s', sys.exc_info()[1]) return False def get_topics(self): @@ -166,6 +169,7 @@ class SongManager(): self.session.commit() return True except: + log.error(u'Errow thrown %s', sys.exc_info()[1]) return False def delete_topic(self, topicid): @@ -178,7 +182,7 @@ class SongManager(): self.session.commit() return True except: - log.error("Errow thrown %s", sys.exc_info()[1]) + log.error(u'Errow thrown %s', sys.exc_info()[1]) return False def get_books(self): @@ -214,5 +218,5 @@ class SongManager(): self.session.commit() return True except: - log.error("Errow thrown %s", sys.exc_info()[1]) + log.error(u'Errow thrown %s', sys.exc_info()[1]) return False