Just some explanations: * Martin Michlmayr <[EMAIL PROTECTED]> [2007-08-27 17:33]: > def insstr(self, s): > if not s: return > - self.w.addstr(s[:-1]) > - self.w.hline(ord(s[-1]), 1) # insch() work-around > + s1 = s[:-1] > + s2 = s[-1] > + if type(s) == types.UnicodeType: > + s1 = s1.encode(locale.getpreferredencoding(), "replace") > + s2 = s2.encode(locale.getpreferredencoding(), "replace") > + # HACK: sometimes self.w.addstr() returns a curses error. > + # Maybe related to strings that take up the whole screen > + try: > + self.w.addstr(s1) > + self.w.hline(ord(s[-1]), 1) # insch() work-around > + except: pass
Well, I don't get the whole insch() work-around stuff going on here. But in any case, in an UTF-8 locale I something get an exception from curses, maybe it's related to songs that have long titles, but I'm not really sure why this is happening. > def putstr(self, entry, *pos): > - s = string.translate(str(entry), Window.translationTable) > + if type(entry) == types.StringType: > + s = entry > + else: > + s = entry.text() This is pretty ugly, but essentially you cannot call str() anymore because that will give you an exception since Python tries to convert the string to ASCII and that often fails. Often this function is called with a ListEntry so I converted its str function to text. But sometimes the function gets passed a normal string (e.g. when you press 'h' to open the help). Anyway, this is not nice but I didn't investigate more closely. -- Martin Michlmayr http://www.cyrius.com/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]