On May 29, 2008, at 7:50 AM, Henning Hraban Ramm wrote:
> CAP &Rückgängig: Ctrl+Z <type 'str'>
> HK Ctrl+Z <type 'str'>
> CURR Ctrl+Z <type 'unicode'>
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
> packages/dabo/dabo/ui/uiwx/dMenuItem.py:80:
> UnicodeWarning: Unicode unequal comparison failed to convert both
> arguments to Unicode - interpreting them as being unequal
> if cap != curr:
When I ran this, all my 'cap' values were unicode. I'm wondering why
yours are all str.
> I know it's ugly and probably doesn't fix everything (my About box
> should have a caption of "Über" in German, that's still messed up) -
> can you guess where the real error sits? Maybe in dPemMixin's Caption
> handling?
dMenuItem has its own Caption property, so it isn't anything in
dPemMixin.
Here's another possible solution. Yeah, it's a bit of a hack, and
doesn't solve all our unicode problems, but it seems a bit less
hackish than your patch. Replace your _redefine() method with this:
def _redefine(self):
"""Combine the Caption and HotKey into the format needed by
wxPython."""
cap = self.Caption
hk = self.HotKey
if hk:
cap = "%s\t%s" % (cap, hk)
curr = self.GetText()
def toUni(s):
if isinstance(s, str):
try:
enc = self.Application.Encoding
except AttributeError:
enc = dabo.defaultEncoding
s = unicode(s, enc)
return s
if toUni(cap) != toUni(curr):
## Win32 seems to need to clear the caption first, or funkiness
## can arise. And win32 in wx2.8 needs for the caption to never
be
## an empty string, or you'll get an invalid stock id assertion.
self.SetText(" ")
if cap == "":
cap = " "
self.SetText(cap)
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]