From cd0388f681aa41a3c55f1d4ebc6c36767adca429 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Sat, 11 Apr 2009 11:39:04 +0200 Subject: [PATCH] Spero di aver sistemato... --- songbook-editor.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/songbook-editor.py b/songbook-editor.py index 17a7630..49f301e 100755 --- a/songbook-editor.py +++ b/songbook-editor.py @@ -1,5 +1,3 @@ -<<<<<<< HEAD:songbook-editor.py -======= #!/usr/bin/env python from PyQt4 import QtGui, QtCore @@ -23,11 +21,11 @@ class interface(QtGui.QMainWindow): print "TODO: Save data on exit" def get_active_song(self): - newtitle = str(self.ui.le_title.text()) - newmauthor = str(self.ui.le_mauthor.text()) - newtauthor = str(self.ui.le_tauthor.text()) - newyear = str(self.ui.le_year.text()) - newtone = str(self.ui.le_tone.text()) + 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()) @@ -48,6 +46,8 @@ class interface(QtGui.QMainWindow): filetowrite = lm.create_song(song) filename = QtGui.QFileDialog.getSaveFileName(self, "Salva file latex", "/home/leonardo", "LaTeX Source File (*.tex)") handle = open(filename, 'w') + # Just remember that filetowrite is an "unicode" object, treat it + # as it just deserve handle.write(filetowrite.encode("utf-8")) handle.close() @@ -61,4 +61,3 @@ if __name__ == "__main__": widget = interface(lm) widget.show() app.exec_() ->>>>>>> 399e64e... Convertita tutta la gestione in unicode per non avere problemi:songbook-editor.py -- 2.1.4