Re: [PyQt] ANN: PyQt v4.8.2 Released

2010-12-27 Thread Phil Thompson
On Sun, 26 Dec 2010 17:28:22 -0600, Rex Dieter rdie...@math.unl.edu
wrote:
 Phil Thompson wrote:
 
 PyQt v4.8.2 has been released.
 
 I'm seeing a build failure against python3, 

You mean Python v3.2a. There are source code incompatibilities in Python
v3.2b. Use the latest beta version.

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


Re: [PyQt] A possible bug in PyQt when loading Boolean values via QSettings

2010-12-27 Thread Phil Thompson
On Sun, 26 Dec 2010 20:30:28 +, Baz Walter baz...@gmail.com wrote:
 On 25/12/10 10:16, Phil Thompson wrote:
 It's not a bug. You can't make assumptions about the capabilities of
the
 backend (platform specific) storage regarding saving type information.
 You
 have to explicitly test for the values that might come back.
 
 are you saying that portability may be compromised when using the 
 QVariant v2 api with QSettings?

It depends on the QSettings backend (if any of the backends behave
differently).

 with the QVariant v1 api, QSettings will always return a QVariant - so 
 there is a consistent (and portable) way to deal with whatever values 
 are delivered by the backend:
 
 settings.py
 ===
 from PyQt4.QtCore import QSettings
 
 settings = QSettings('foo', 'foo')
 settings.clear()
 key = 'section/item'
 print('item = %s' % repr(settings.value(key)))
 settings.setValue(key, False)
 print('item = %s' % repr(settings.value(key)))
 
 # re-sync with storage
 settings = QSettings('foo', 'foo')
 print('item = %s' % repr(settings.value(key)))
 
 
 $ python2 settings.py
 item = PyQt4.QtCore.QVariant object at 0xb743aed4
 item = PyQt4.QtCore.QVariant object at 0xb743aed4
 item = PyQt4.QtCore.QVariant object at 0xb743aed4
 
 $ python3 settings.py
 item = None
 item = False
 item = 'false'
 
 i am only able to test this on linux at the moment.
 
 but might i get different output from python3 if i ran this on windows?

A typical backend will save values as a string without any metadata
describing the original type. In QVariant v1 the conversion back is done by
QVariant::toBool() which only checks for true and false, so that is the
behaviour to be replicated in QVariant v2.

If this is a problem then I could add an optional keyword argument to
QSettings.value() that takes a Python type argument and will automatically
return a value of that type or raise an exception...

b = settings.value(key, type=bool)

...or any other suggestions?

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


Re: [PyQt] A possible bug in PyQt when loading Boolean values via QSettings

2010-12-27 Thread Baz Walter

On 27/12/10 10:04, Phil Thompson wrote:

A typical backend will save values as a string without any metadata
describing the original type. In QVariant v1 the conversion back is done by
QVariant::toBool() which only checks for true and false, so that is the
behaviour to be replicated in QVariant v2.

If this is a problem then I could add an optional keyword argument to
QSettings.value() that takes a Python type argument and will automatically
return a value of that type or raise an exception...

 b = settings.value(key, type=bool)

...or any other suggestions?


i expanded my previous test to include a few other types:

from PyQt4.QtCore import QSettings, QPoint

settings = QSettings('foo', 'foo')
settings.clear()
settings.beginGroup('section')
settings.setValue('bool', False)
print('bool = %s' % repr(settings.value('bool')))
settings.setValue('int', 42)
print('int = %s' % repr(settings.value('int')))
settings.setValue('point', QPoint(10, 20))
print('point = %s' % repr(settings.value('point')))
settings.setValue('list', [1, 2, 3])
print('list = %s' % repr(settings.value('list')))
settings.endGroup()

# re-sync with storage
settings = QSettings('foo', 'foo')
settings.beginGroup('section')
print('bool = %s' % repr(settings.value('bool')))
print('int = %s' % repr(settings.value('int')))
print('point = %s' % repr(settings.value('point')))
print('list = %s' % repr(settings.value('list')))
settings.endGroup()

output for linux, using python 3.1.3, qt 4.7.1, sip 4.11.2, pyqt 4.8.1:

$ python3 settings.py
bool = False
int = 42
point = PyQt4.QtCore.QPoint(10, 20)
list = [1, 2, 3]
bool = 'false'
int = '42'
point = PyQt4.QtCore.QPoint(10, 20)
list = ['1', '2', '3']

output for win xp, using python 3.1.3, qt 4.7.1, sip 4.12, pyqt 4.8.2:


c:\python31\python.exe settings.py

bool = 'false'
int = 42
point = PyQt4.QtCore.QPoint(10, 20)
list = ['1', '2', '3']
bool = 'false'
int = 42
point = PyQt4.QtCore.QPoint(10, 20)
list = ['1', '2', '3']

so it looks like portability *has* been compromised. there are 
differences between linux and windows both before and after a re-sync.


also, i think xavion may be right to suggest there is at least one other 
bug here. on linux, there is inconsistency between some values before 
and after a re-sync that is not present on windows.


(of course, it goes without saying that the easy way to avoid all these 
complications is to use the QVariant v1 api).



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


[PyQt] StackedWidget bug in 4.8.2

2010-12-27 Thread Alexander Nestorov
After upgrading to 4.8.2 from 4.8.1 my app stopped working. I'm pretty sure
that the bug is not mine as
my app just loads an .ui file generated with QtDesigner.

Here is the log: http://pastebin.ca/2030773

Regards

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

Re: [PyQt] StackedWidget bug in 4.8.2

2010-12-27 Thread Sebastian Wiesner
2010/12/27 Alexander Nestorov alexander...@gmail.com:
 After upgrading to 4.8.2 from 4.8.1 my app stopped working. I'm pretty sure
 that the bug is not mine as
 my app just loads an .ui file generated with QtDesigner.

 Here is the log: http://pastebin.ca/2030773

To fix this issue, just open
/usr/lib/python2.7/site-packages/PyQt4/uic/uiparser.py, move to line
161 and replace QtGui.StackedWidget with QtGui.QStackedWidget.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt