nburdick / lilykde

Automatically exported from code.google.com/p/lilykde
0 stars 0 forks source link

TypeError 'QString' and 'unicode' #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. LC_ALL=ru_RU.UTF-8 frescobaldi
2. type something

Error message:

$ LC_ALL=ru_RU.UTF-8 frescobaldi
Traceback (most recent call last):
  File "/usr/src/RPM/BUILD/frescobaldi-0.7.13/python/kateshell/app.py",
line 363, in slotModifiedChanged
  File "/usr/share/kde4/apps/frescobaldi/lib/signals.py", line 69, in
__call__
    func(obj, *args[:func.func_code.co_argcount-1], **kwargs)
  File "/usr/share/kde4/apps/frescobaldi/lib/kateshell/mainwindow.py",
line 320, in updateCaption
    self.setCaption(name + " [%s]" % i18n("modified"))
TypeError: unsupported operand type(s) for +: 'QString' and 'unicode

There is no problem with non-unicode locale (LC_ALL=C frescobaldi).

Original issue reported on code.google.com by artem.zo...@gmail.com on 18 Aug 2009 at 5:54

GoogleCodeExporter commented 8 years ago
Do you have recent versions of sip, PyQt4 and PyKDE4 installed? Which versions? 
And
which Python version (Frescobaldi has not yet been tested with Python3)?

On my 2 systems this works:
% python
>>> from PyQt4.QtCore import *
>>> QString("bla") + u"bla"
PyQt4.QtCore.QString(u'blabla')

Original comment by wbsoft on 21 Aug 2009 at 7:34

GoogleCodeExporter commented 8 years ago
python-module-sip-4.8.1 python-module-PyQt4-4.5.2  python-module-kde4-4.3.0 
python-2.5.4

I've fixed 'QString' + 'unicode' bug with:
-self.setCaption(name + " [%s]" % i18n("modified"))
+self.setCaption(unicode(name) + " [%s]" % i18n("modified"))

Original comment by artem.zo...@gmail.com on 21 Aug 2009 at 8:45

GoogleCodeExporter commented 8 years ago
All versions seem recent enough. Although I do not fully understand why in some 
cases
the QString does not want to cooperate with unicode, your fix is robust and 
should
avoid this error in the future.

If you have some time, could you please test the following solution on your 
system,
which seems even more elegant to me?

self.setCaption("%s [%s]" % (name, i18n("modified")))

Thanks,

Original comment by wbsoft on 22 Aug 2009 at 11:39

GoogleCodeExporter commented 8 years ago
Fixed in SVN r1428, please test :)

Original comment by wbsoft on 24 Aug 2009 at 11:37