From f7e05974c426219a117bf0c50dd991fb6d5e7d67 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Thu, 20 Aug 2009 22:04:01 +0200 Subject: [PATCH] Modified get_active_song in the main source file to return the song object and not a copy of it. --- songbook-editor.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/songbook-editor.py b/songbook-editor.py index e145264..2b5435d 100755 --- a/songbook-editor.py +++ b/songbook-editor.py @@ -88,27 +88,9 @@ class interface(QtGui.QMainWindow): # Get the song object of the active song def get_active_song(self): - # Get data - newtitle = unicode(self.ui.le_title.text()) - newmauthor = unicode(self.ui.le_mauthor.text()) - newtauthor = unicode(self.ui.le_tauthor.text()) - newyear = unicode(self.ui.le_year.text()) - newtone = unicode(self.ui.le_tone.text()) - newsong = song(newtitle, [], newmauthor, newtauthor, newtone, newyear) - - newbody = unicode(self.ui.te_body.toPlainText()) - # Just debug - # print newbody - newbody = re.split("\n\n+", newbody) - for paragraph in newbody: - if(len(paragraph) < 3): - break - if( (paragraph[0] == 'R') & (paragraph[1] == ':') ): - newsong.add_chorus(paragraph.split("R:")[1]) - else: - newsong.add_verse(paragraph) - - return newsong + for song in self.song_db: + if( song.title == unicode(self.ui.le_title.text()) ): + return song def get_active_song_in_list(self): newsong = self.get_active_song() -- 2.1.4