Re: [PyQt] install pyqt

2012-06-17 Thread wolf python london
On 17 June 2012 09:22, 水静流深 1248283...@qq.com wrote:
 my system is debian 6.0.4
 1.i have installed qt
 download qt-everywhere-opensource-src-4.8.2
 extract it
 cd ./qt-everywhere-opensource-src-4.8.2
  ./configure
   make
  make install

 2.when i install my pyqt
 1)download  PyQt-x11-gpl-4.9.1
 2)cd ./PyQt-x11-gpl-4.9.1
 3)root@debian:/home/debian/PyQt-x11-gpl-4.9.1# python  configure.py
 Error: Make sure you have a working Qt v4 qmake on your PATH or use the -q
 argument to explicitly specify a working Qt v4 qmake.
 root@debian:/home/debian/PyQt-x11-gpl-4.9.1#  find  /  -name 'qmake*'
 /usr/local/Trolltech/Qt-4.8.2/bin/qmake
 (omitted many outputs)
 it look like everything is installed.
It(qmake)  indeed get installed, but  is not in your PATH.
$ echo  $PATH
to see whether it contains   /usr/local/Trolltech/Qt-4.8.2/bin, if not
add it into your PATH.

 how can i install  pyqt in my debian?
I still suggest installing pyqt via dpkg or aptitude. It's not the
latest, but can save you much time.
One problem is it doesn't support python3, you can only  use PyQt4 in python2.
# aptitude install  python-qt4  pyqt4-dev-tools

BTW, Debian testing and unstable ships latest PyQt4  and it supports python3.



 ___
 PyQt mailing list    PyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 

Yes, I use Debian GNU/L
wolf python london(WPL)
Do as you soul should do !

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] including Unicode in QListWidget

2012-06-17 Thread David Beck
I am trying to build a GUI for navigating through a large XML database on a Mac 
running OS 10.7, Python 3.3, PyQt 4. I want to get a list of the text 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 listbox):


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()
self.ui.setupUi(self)


xmltree = etree.parse('BabyDb.xml')
root = xmltree.getroot()
for child in root:
  self.ui.hLexNav.addItem(child.findtext('Orth'))

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:mixtzayán', 'a:nanú:', 'a:tú:n', 
'a:tzá:', a:tzemá'j, 'a:xí:lh', 'a:xtúm', 'a:xú:x', a:'hála', a:'j, 
a:'jmá, a:'jnanú:, a:'jtzá:, a:'jtzananú:, a:'kní:]

In the QListWidget created by this code, I see only items corresponding to 
those elements that do not contain accented vowels (here, those that don't 
contain á, ú, etc.); items that correpsond to strings with accented vowels 
are left empty. Further experimentation with addItem( ), addItems(), and 
insertItem( ) show that any string that contains an non-ASCII character results 
in an empty Item being inserted into the QListWidget.

Any ideas about what is going on would be appreciated.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] including Unicode in QListWidget

2012-06-17 Thread Knacktus

Am 17.06.2012 18:29, schrieb David Beck:

I am trying to build a GUI for navigating through a large XML database on a Mac running OS 
10.7, Python 3.3, PyQt 4. I want to get a list of the text in all of the nodes 
calledOrth  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 listbox):


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()
 self.ui.setupUi(self)


 xmltree = etree.parse('BabyDb.xml')
 root = xmltree.getroot()
 for child in root:
   self.ui.hLexNav.addItem(child.findtext('Orth'))

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:mixtzayán', 'a:nanú:', 'a:tú:n', 
'a:tzá:', a:tzemá'j, 'a:xí:lh', 'a:xtúm', 'a:xú:x', a:'hála', a:'j, a:'jmá, a:'jnanú:, a:'jtzá:, 
a:'jtzananú:, a:'kní:]

In the QListWidget created by this code, I see only items corresponding to those elements that do 
not contain accented vowels (here, those that don't contain á, ú, etc.); 
items that correpsond to strings with accented vowels are left empty. Further experimentation with 
addItem( ), addItems(), and insertItem( ) show that any string that contains an non-ASCII character 
results in an empty Item being inserted into the QListWidget.

Any ideas about what is going on would be appreciated.


Are you 100 % sure that unicode is handled properly while reading the 
xml? I never had problems with unicode and PyQt but I strictly using 
unicode strings only in my apps.


This for example works for me (Python 2.7):

# -*- coding: utf-8 -*-

if __name__ == __main__:

import sys
from PyQt4.QtGui import *
app = QApplication(sys.argv)
list_widget = QListWidget()
list_widget.addItem(uÄÜ^°  là lÁ)
list_widget.show()
app.exec_()




___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Qt5 roadmap?

2012-06-17 Thread Phil Thompson
On Sat, 16 Jun 2012 07:27:11 -0700, David Cortesi davecort...@gmail.com
wrote:
 Folks,
 
 Per the Qt Project roadmap (http://qt-project.org/wiki/Qt_5.0) Qt 5 is
 supposed to be in beta now (the alpha is available at
 http://qt-project.org/prereleases), with final release by the end of
 June.

I wouldn't put too much faith in those dates.

 I look in vain for a pyqt roadmap at riverbank.co.uk, although I do see
 roadmaps for sip and dip. So, what's the anticipation for PyQt5 release?
 Any news?

Qt5 support will be in two stages.

Current PyQt4 snapshots build against the alpha release of Qt5 (QtCore and
QtGui modules only at the moment). This will allow you to run your current
PyQt4 code with Qt5. You will get any speed improvements, bug fixes etc in
Qt5 but not any of the new functionality.

There will be a PyQt5 that will support the new functionality of Qt5, and
reflect its different structure (eg. QWidget will be in PyQt5.QtWidgets
rather than PyQt4.QtGui). Backwards compatibility with PyQt4 will not be
maintained.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] install pyqt

2012-06-17 Thread Phil Thompson
On Sun, 17 Jun 2012 09:22:12 +0800, 水静流深 1248283...@qq.com wrote:
 my system is debian 6.0.4
 1.i have installed qt 
 download qt-everywhere-opensource-src-4.8.2
 extract it
 cd ./qt-everywhere-opensource-src-4.8.2
  ./configure
   make
  make install 
 
 
 
 2.when i install my pyqt
 1)download  PyQt-x11-gpl-4.9.1
 2)cd ./PyQt-x11-gpl-4.9.1
 3)root@debian:/home/debian/PyQt-x11-gpl-4.9.1# python  configure.py
 Error: Make sure you have a working Qt v4 qmake on your PATH or use the
-q
 argument to explicitly specify a working Qt v4 qmake.
 root@debian:/home/debian/PyQt-x11-gpl-4.9.1#  find  /  -name 'qmake*'
 
 /usr/local/Trolltech/Qt-4.8.2/bin/qmake
 
 (omitted many outputs)
 it look like everything is installed.
 how can i install  pyqt in my debian?

python configure.py -q /usr/local/Trolltech/Qt-4.8.2/bin/qmake

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Qt5 roadmap?

2012-06-17 Thread Detlev Offenbach


On Sunday 17 June 2012, 18:24:55 Phil Thompson wrote:
 On Sat, 16 Jun 2012 07:27:11 -0700, David Cortesi davecort...@gmail.com
 
 wrote:
  Folks,
  
  Per the Qt Project roadmap (http://qt-project.org/wiki/Qt_5.0) Qt 5 is
  supposed to be in beta now (the alpha is available at
  http://qt-project.org/prereleases), with final release by the end of
  June.
 
 I wouldn't put too much faith in those dates.
 
  I look in vain for a pyqt roadmap at riverbank.co.uk, although I do see
  roadmaps for sip and dip. So, what's the anticipation for PyQt5 release?
  Any news?
 
 Qt5 support will be in two stages.
 
 Current PyQt4 snapshots build against the alpha release of Qt5 (QtCore and
 QtGui modules only at the moment). This will allow you to run your current
 PyQt4 code with Qt5. You will get any speed improvements, bug fixes etc in
 Qt5 but not any of the new functionality.
 
 There will be a PyQt5 that will support the new functionality of Qt5, and
 reflect its different structure (eg. QWidget will be in PyQt5.QtWidgets
 rather than PyQt4.QtGui). Backwards compatibility with PyQt4 will not be
 maintained.

Is it planned to include a tool converting existing code from PyQt4 to PyQt5 
(something like 2to3 for Python)?

Regards,
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Qt5 roadmap?

2012-06-17 Thread Hernan Grecco
 Current PyQt4 snapshots build against the alpha release of Qt5 (QtCore and
 QtGui modules only at the moment). This will allow you to run your current
 PyQt4 code with Qt5. You will get any speed improvements, bug fixes etc in
 Qt5 but not any of the new functionality.

 There will be a PyQt5 that will support the new functionality of Qt5, and
 reflect its different structure (eg. QWidget will be in PyQt5.QtWidgets
 rather than PyQt4.QtGui). Backwards compatibility with PyQt4 will not be
 maintained.

Is there going to be any support for selecting Qt4 or Qt5 via flag
(like sip.setapi) o are you planning to at some point make a PyQt5
package that uses only Qt5 while PyQt4 only uses Qt4?

Thanks,

Hernan
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Possible bug with QtCore.QPropertyAnimation and QAxContainer.QAxWidget

2012-06-17 Thread Itay Brandes
There is a possible bug when trying to use *QAxContainer.QAxWidget*, *
QtGui.QGraphicsOpacityEffect* and *QtCore.QPropertyAnimation* in the same
application.

This happens when trying to animate a widget's opacity (creating a fade
out effect).
The animation won't update correctly if a QAxWidget is present somewhere in
the same window.
The bug can be seen here:
http://itayb.hostzi.com/eventloop_doesnt_update.avi

A test case that causes the weird behavior is attached.

Thanks!


animation_test_case.py
Description: Binary data
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Qt5 roadmap?

2012-06-17 Thread Phil Thompson
On Sun, 17 Jun 2012 19:38:13 +0200, Detlev Offenbach
det...@die-offenbachs.de wrote:
 On Sunday 17 June 2012, 18:24:55 Phil Thompson wrote:
 On Sat, 16 Jun 2012 07:27:11 -0700, David Cortesi
davecort...@gmail.com
 
 wrote:
  Folks,
  
  Per the Qt Project roadmap (http://qt-project.org/wiki/Qt_5.0) Qt 5
is
  supposed to be in beta now (the alpha is available at
  http://qt-project.org/prereleases), with final release by the end of
  June.
 
 I wouldn't put too much faith in those dates.
 
  I look in vain for a pyqt roadmap at riverbank.co.uk, although I do
see
  roadmaps for sip and dip. So, what's the anticipation for PyQt5
  release?
  Any news?
 
 Qt5 support will be in two stages.
 
 Current PyQt4 snapshots build against the alpha release of Qt5 (QtCore
 and
 QtGui modules only at the moment). This will allow you to run your
 current
 PyQt4 code with Qt5. You will get any speed improvements, bug fixes etc
 in
 Qt5 but not any of the new functionality.
 
 There will be a PyQt5 that will support the new functionality of Qt5,
and
 reflect its different structure (eg. QWidget will be in PyQt5.QtWidgets
 rather than PyQt4.QtGui). Backwards compatibility with PyQt4 will not
be
 maintained.
 
 Is it planned to include a tool converting existing code from PyQt4 to
 PyQt5 
 (something like 2to3 for Python)?

No. It might be just a case of changing import statements.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Qt5 roadmap?

2012-06-17 Thread Phil Thompson
On Sun, 17 Jun 2012 19:42:38 +0200, Hernan Grecco
hernan.gre...@gmail.com
wrote:
 Current PyQt4 snapshots build against the alpha release of Qt5 (QtCore
 and
 QtGui modules only at the moment). This will allow you to run your
 current
 PyQt4 code with Qt5. You will get any speed improvements, bug fixes etc
 in
 Qt5 but not any of the new functionality.

 There will be a PyQt5 that will support the new functionality of Qt5,
and
 reflect its different structure (eg. QWidget will be in PyQt5.QtWidgets
 rather than PyQt4.QtGui). Backwards compatibility with PyQt4 will not
be
 maintained.
 
 Is there going to be any support for selecting Qt4 or Qt5 via flag
 (like sip.setapi) o are you planning to at some point make a PyQt5
 package that uses only Qt5 while PyQt4 only uses Qt4?

PyQt5 would build against Qt5 only.

PyQt4 would build against Qt4 or Qt5. The API wouldn't change (well, not
much as the Qt5 API isn't exactly the same as the Qt4 API).

The Qt version is a compile time issue.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] install pyqt

2012-06-17 Thread Juan José Gómez Romera
Do you need really the last version, if you dont, you can install from
repositories:

# aptitude install python-qt4

If you really need the last version, you have to compiling, so you need
first install all compiling packages, a bunch of dev packages i'm sure.

# apt-get build-dep python-qt4

if you are use with apt-pinning http://wiki.debian.org/AptPreferences,
you can try to install last version of pyqt4 from
wheezyhttp://packages.debian.org/wheezy/python-qt4(v. 4.9.1), but
only if you are comfortable with apt-pinning.


2012/6/17 水静流深 1248283...@qq.com

 my system is debian 6.0.4
 1.i have installed qt
 download qt-everywhere-opensource-src-4.8.2
 extract it
 cd ./qt-everywhere-opensource-src-4.8.2
  ./configure
   make
  make install

 2.when i install my pyqt
 1)download  PyQt-x11-gpl-4.9.1
 2)cd ./PyQt-x11-gpl-4.9.1
 3)root@debian:/home/debian/PyQt-x11-gpl-4.9.1# python  configure.py
 Error: Make sure you have a working Qt v4 qmake on your PATH or use the -q
 argument to explicitly specify a working Qt v4 qmake.
 root@debian:/home/debian/PyQt-x11-gpl-4.9.1#  find  /  -name 'qmake*'
 /usr/local/Trolltech/Qt-4.8.2/bin/qmake
 (omitted many outputs)
 it look like everything is installed.
 how can i install  pyqt in my debian?


 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] including Unicode in QListWidget

2012-06-17 Thread David Beck
 Message: 2
 Date: Sun, 17 Jun 2012 18:42:54 +0200
 From: Knacktus knack...@googlemail.com
 To: pyqt@riverbankcomputing.com
 Subject: Re: [PyQt] including Unicode in QListWidget
 Message-ID: 4fde090e.1070...@googlemail.com
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
 Am 17.06.2012 18:29, schrieb David Beck:
 I am trying to build a GUI for navigating through a large XML database on a 
 Mac running OS 10.7, Python 3.3, PyQt 4. I want to get a list of the text in 
 all of the nodes calledOrth  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 listbox):
 
 
 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()
 self.ui.setupUi(self)
 
 
 xmltree = etree.parse('BabyDb.xml')
 root = xmltree.getroot()
 for child in root:
   self.ui.hLexNav.addItem(child.findtext('Orth'))
 
 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:mixtzay?n', 
 'a:nan?:', 'a:t?:n', 'a:tz?:', a:tzem?'j, 'a:x?:lh', 'a:xt?m', 'a:x?:x', 
 a:'h?la', a:'j, a:'jm?, a:'jnan?:, a:'jtz?:, a:'jtzanan?:, 
 a:'kn?:]
 
 In the QListWidget created by this code, I see only items corresponding to 
 those elements that do not contain accented vowels (here, those that don't 
 contain ?, ?, etc.); items that correpsond to strings with accented 
 vowels are left empty. Further experimentation with addItem( ), addItems(), 
 and insertItem( ) show that any string that contains an non-ASCII character 
 results in an empty Item being inserted into the QListWidget.
 
 Any ideas about what is going on would be appreciated.
 
 Are you 100 % sure that unicode is handled properly while reading the 
 xml? I never had problems with unicode and PyQt but I strictly using 
 unicode strings only in my apps.
 
 This for example works for me (Python 2.7):
 
 # -*- coding: utf-8 -*-
 
 if __name__ == __main__:
 
 import sys
 from PyQt4.QtGui import *
 app = QApplication(sys.argv)
 list_widget = QListWidget()
 list_widget.addItem(u??^?  l? l?)
 list_widget.show()
 app.exec_()
 

Yes, it seems to be independent of the XML. For instance, I get the same thing 
when I run the little app below (the GUI is generated by pyuic4): 

import sys
from PyQt4 import QtCore, QtGui

try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s

class Ui_UTFWidget(object):
def setupUi(self, UTFWidget):
UTFWidget.setObjectName(_fromUtf8(UTFWidget))
UTFWidget.resize(400, 300)
self.centralWidget = QtGui.QWidget(UTFWidget)
self.centralWidget.setObjectName(_fromUtf8(centralWidget))
self.listWidget = QtGui.QListWidget(self.centralWidget)
self.listWidget.setGeometry(QtCore.QRect(17, 9, 362, 241))
self.listWidget.setObjectName(_fromUtf8(listWidget))
UTFWidget.setCentralWidget(self.centralWidget)
self.menuBar = QtGui.QMenuBar(UTFWidget)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 400, 22))
self.menuBar.setObjectName(_fromUtf8(menuBar))
self.menuUTF_test = QtGui.QMenu(self.menuBar)
self.menuUTF_test.setObjectName(_fromUtf8(menuUTF_test))
UTFWidget.setMenuBar(self.menuBar)
self.mainToolBar = QtGui.QToolBar(UTFWidget)
self.mainToolBar.setObjectName(_fromUtf8(mainToolBar))
UTFWidget.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
self.statusBar = QtGui.QStatusBar(UTFWidget)
self.statusBar.setObjectName(_fromUtf8(statusBar))
UTFWidget.setStatusBar(self.statusBar)
self.menuBar.addAction(self.menuUTF_test.menuAction())

self.retranslateUi(UTFWidget)
QtCore.QMetaObject.connectSlotsByName(UTFWidget)

def retranslateUi(self, UTFWidget):
UTFWidget.setWindowTitle(QtGui.QApplication.translate(UTFWidget, 
UTFWidget, None, QtGui.QApplication.UnicodeUTF8))
self.menuUTF_test.setTitle(QtGui.QApplication.translate(UTFWidget, 
UTF test, None, QtGui.QApplication.UnicodeUTF8))

class MyForm(QtGui.QMainWindow):
  def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_UTFWidget()
self.ui.setupUi(self)

self.ui.listWidget.addItem(abcde)
self.ui.listWidget.addItem(áɬʔéí)

if __name__ == __main__:
  app = QtGui.QApplication(sys.argv)
  myapp = MyForm()
  myapp.show()
  sys.exit(app.exec_())

notice that there are two additem() methods, one which adds straight ASCII, the 
other which adds some non-ASCII characters. When I run the 

Re: [PyQt] including Unicode in QListWidget

2012-06-17 Thread Knacktus

Am 17.06.2012 22:55, schrieb David Beck:

Message: 2
Date: Sun, 17 Jun 2012 18:42:54 +0200
From: Knacktus knack...@googlemail.com mailto:knack...@googlemail.com
To: pyqt@riverbankcomputing.com mailto:pyqt@riverbankcomputing.com
Subject: Re: [PyQt] including Unicode in QListWidget
Message-ID: 4fde090e.1070...@googlemail.com
mailto:4fde090e.1070...@googlemail.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Am 17.06.2012 18:29, schrieb David Beck:

I am trying to build a GUI for navigating through a large XML
database on a Mac running OS 10.7, Python 3.3, PyQt 4. I want to get
a list of the text in all of the nodes calledOrth 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 listbox):


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()
self.ui.setupUi(self)


xmltree = etree.parse('BabyDb.xml')
root = xmltree.getroot()
for child in root:
self.ui.hLexNav.addItem(child.findtext('Orth'))

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:mixtzay?n', 'a:nan?:', 'a:t?:n', 'a:tz?:', a:tzem?'j, 'a:x?:lh',
'a:xt?m', 'a:x?:x', a:'h?la', a:'j, a:'jm?, a:'jnan?:,
a:'jtz?:, a:'jtzanan?:, a:'kn?:]

In the QListWidget created by this code, I see only items
corresponding to those elements that do not contain accented vowels
(here, those that don't contain ?, ?, etc.); items that
correpsond to strings with accented vowels are left empty. Further
experimentation with addItem( ), addItems(), and insertItem( ) show
that any string that contains an non-ASCII character results in an
empty Item being inserted into the QListWidget.

Any ideas about what is going on would be appreciated.


Are you 100 % sure that unicode is handled properly while reading the
xml? I never had problems with unicode and PyQt but I strictly using
unicode strings only in my apps.

This for example works for me (Python 2.7):

# -*- coding: utf-8 -*-

if __name__ == __main__:

import sys
from PyQt4.QtGui import *
app = QApplication(sys.argv)
list_widget = QListWidget()
list_widget.addItem(u??^? l? l?)
list_widget.show()
app.exec_()



Yes, it seems to be independent of the XML. For instance, I get the same
thing when I run the little app below (the GUI is generated by pyuic4):

import sys
from PyQt4 import QtCore, QtGui

try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s

class Ui_UTFWidget(object):
def setupUi(self, UTFWidget):
UTFWidget.setObjectName(_fromUtf8(UTFWidget))
UTFWidget.resize(400, 300)
self.centralWidget = QtGui.QWidget(UTFWidget)
self.centralWidget.setObjectName(_fromUtf8(centralWidget))
self.listWidget = QtGui.QListWidget(self.centralWidget)
self.listWidget.setGeometry(QtCore.QRect(17, 9, 362, 241))
self.listWidget.setObjectName(_fromUtf8(listWidget))
UTFWidget.setCentralWidget(self.centralWidget)
self.menuBar = QtGui.QMenuBar(UTFWidget)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 400, 22))
self.menuBar.setObjectName(_fromUtf8(menuBar))
self.menuUTF_test = QtGui.QMenu(self.menuBar)
self.menuUTF_test.setObjectName(_fromUtf8(menuUTF_test))
UTFWidget.setMenuBar(self.menuBar)
self.mainToolBar = QtGui.QToolBar(UTFWidget)
self.mainToolBar.setObjectName(_fromUtf8(mainToolBar))
UTFWidget.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
self.statusBar = QtGui.QStatusBar(UTFWidget)
self.statusBar.setObjectName(_fromUtf8(statusBar))
UTFWidget.setStatusBar(self.statusBar)
self.menuBar.addAction(self.menuUTF_test.menuAction())

self.retranslateUi(UTFWidget)
QtCore.QMetaObject.connectSlotsByName(UTFWidget)

def retranslateUi(self, UTFWidget):
UTFWidget.setWindowTitle(QtGui.QApplication.translate(UTFWidget,
UTFWidget, None, QtGui.QApplication.UnicodeUTF8))
self.menuUTF_test.setTitle(QtGui.QApplication.translate(UTFWidget,
UTF test, None, QtGui.QApplication.UnicodeUTF8))

class MyForm(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_UTFWidget()
self.ui.setupUi(self)

self.ui.listWidget.addItem(abcde)
self.ui.listWidget.addItem(áɬʔéí)


Make this a unicode string (Python 2.7):

self.ui.listWidget.addItem(uáɬʔéí)


if __name__ == __main__:
app = QtGui.QApplication(sys.argv)
myapp = MyForm()
myapp.show()
sys.exit(app.exec_())


notice that there are two additem() methods, one which adds straight
ASCII, the other which adds some non-ASCII