[PyQt] including Unicode in QListWidget
dbeck at ualberta.ca
Tue Jun 19 17:32:07 BST 2012
Thanks for your suggestion. I tried the workaround at the bottom, but it didn't seem to have any effect. However, my installation seems not to match the path you gave (I don't seem to have a /path/to/qt/ directory at all that I can find). I installed PyQt from PyQt-mac-gpl-snapshot-4.9.2-d49ae8bd9152.tar. It created a directory right next to itself called "PyQt" and the mkspecs folder is inside that. I went there, entered the ln command, ran python3.3 configure.py ..., make and make install, but I'm still having the same issue when I run the GUI.
If tonight's snapshot might be a fix, I'll try to install that—would that just be a matter of replacing the existing PyQt folder and going through the configure > make > make install routine? (Sorry for all the dumb questions—I'm willing to admit I'm way in over my head here.)
On 2012-06-19, at 8:42 AM, Phil Thompson wrote:
> On Sun, 17 Jun 2012 10:29:58 -0600, David Beck <dbeck at ualberta.ca> wrote:
>> I am trying to build a GUI for navigating through a large XML database
>> a Mac running OS 10.7, Python 3.3, PyQt 4. I want to get a list of the
>> in all of the nodes called <Orth> and put them into a QListWidget called
>> "hLexNav". To do this, I wrote the following bit of code (this isn't the
>> whole thing, just the parts that are supposed to add items to the
>> import sys
>> from PyQt4 import QtCore, QtGui
>> from xml.dom import minidom
>> import xml.etree.ElementTree as etree
>> from fieldbookGui import Ui_Fieldbook
>> import images
>> import btnCmds
>> class MyForm(QtGui.QMainWindow):
>> def __init__(self, parent=None):
>> QtGui.QWidget.__init__(self, parent)
>> self.ui = Ui_Fieldbook()
>> xmltree = etree.parse('BabyDb.xml')
>> root = xmltree.getroot()
>> for child in root:
>> The first 25 items that are returned by child.findtext('Orth') are:
>> ['a:', 'a:cháj', 'a:chulá:', "a:hé:xtu'", 'a:ho:tán', 'a:kús',
>> "a:li:ma'htín", 'a:li:stá:n', 'a:má', "a:ma'ha:'pi'tzí'n",
>> 'a:nanú:', 'a:tú:n', 'a:tzá:', "a:tzemá'j", 'a:xí:lh', 'a:xtúm',
>> "a:'hála'", "a:'j", "a:'jmá", "a:'jnanú:", "a:'jtzá:", "a:'jtzananú:",
>> In the QListWidget created by this code, I see only items corresponding
>> those elements that do not contain accented vowels (here, those that
>> contain "á", "ú", etc.); items that correpsond to strings with accented
>> vowels are left empty. Further experimentation with addItem( ),
>> and insertItem( ) show that any string that contains an non-ASCII
>> results in an empty Item being inserted into the QListWidget.
>> Any ideas about what is going on would be appreciated.
> It's a compiler bug, see...
> Tonight's snapshot will disable the PEP 393 support if LLVM is being used.
> Another workaround is to enable Qt4's clang support...
> cd /path/to/qt/mkspecs
> ln -s unsupported/macx-clang macx-clang
More information about the PyQt