From 9371dfb82887daf6c2c4124def9929284239190a Mon Sep 17 00:00:00 2001 From: pin Date: Tue, 9 Feb 2010 15:11:26 +0000 Subject: [PATCH 1/1] =?utf8?q?encodage=20des=20caract=C3=A8res=20:=20minwi?= =?utf8?q?i=20semble=20=C3=AAtre=20content=20avec=20du=20iso-8859-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@20 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/gui/PGUConfiguration.py | 2 +- src/gui/SongPlayingScreen.py | 2 +- src/songs/musicxmltosong.py | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) 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__ -- 2.20.1