From: pin Date: Tue, 9 Feb 2010 15:11:26 +0000 (+0000) Subject: encodage des caractères : minwii semble être content avec du iso-8859-1 X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/commitdiff_plain/9371dfb82887daf6c2c4124def9929284239190a?ds=inline encodage des caractères : minwii semble être content avec du iso-8859-1 git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@20 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/gui/PGUConfiguration.py b/src/gui/PGUConfiguration.py index 5e9f7e7..12330ba 100644 --- a/src/gui/PGUConfiguration.py +++ b/src/gui/PGUConfiguration.py @@ -111,7 +111,7 @@ class PGUConfiguration(pguGui.Desktop): else : label = self.createLabel(key) elif self.file.endswith('.xml') : - self.song = musicXml2Song(self.file, printNotes=True) + self.song = musicXml2Song(self.file, printNotes=False) filename = os.path.basename(self.file) label = self.createLabel(filename) self.browseButton = pguGui.Button(label) diff --git a/src/gui/SongPlayingScreen.py b/src/gui/SongPlayingScreen.py index 5ddd67a..a64adb6 100644 --- a/src/gui/SongPlayingScreen.py +++ b/src/gui/SongPlayingScreen.py @@ -728,7 +728,7 @@ class SongPlayingScreen: note, lyricIndex = self.songIterator.next() self.highlightedNote = note.column self.highlightedNoteNumber = note.midi - self.syllabus = str(note.lyrics[lyricIndex]) + self.syllabus = note.lyrics[lyricIndex].syllabus('iso-8859-1') self.nextCascadeLockLengthMultiplier = note.duration self.midiNoteNumbers[self.highlightedNote] = self.highlightedNoteNumber diff --git a/src/songs/musicxmltosong.py b/src/songs/musicxmltosong.py index eb5d5c3..d24d81a 100755 --- a/src/songs/musicxmltosong.py +++ b/src/songs/musicxmltosong.py @@ -110,7 +110,7 @@ class Part(object) : def iterNotes(self) : "exécution de la chanson avec l'alternance couplets / refrains" - for verse in self.verses : + for verse in cycle(self.verses) : print "---partie---" repeats = len(verse[0].lyrics) if repeats > 1 : @@ -257,9 +257,12 @@ class Lyric(object) : self.syllabic = _getNodeValue(node, 'syllabic', 'single') self.text = _getNodeValue(node, 'text') - def __str__(self) : + def syllabus(self, encoding='utf-8'): text = self._syllabicModifiers[self.syllabic] % self.text - return text.encode('utf-8') + return text.encode(encoding) + + def __str__(self) : + return self.syllabus() __repr__ = __str__