[PyKDE] A few issues with the 20060108 snapshots
Gerard Vermeulen
gerard.vermeulen at grenoble.cnrs.fr
Mon Jan 9 06:36:12 GMT 2006
(1) The following example shows two widgets: one with a working box layout and
one with a broken box layout, while the code is practically identical.
#!/usr/bin/env python
# Demonstrates that PyQt4 breaks QVBoxLayout when it is the QLayout of a
# QWidget which is returned from a function.
import sys
from PyQt4 import QtGui
def make():
# The QVBoxLayout does not work when resizing.
broken = QtGui.QFrame()
broken.setWindowTitle('Broken')
t1 = QtGui.QTextEdit(broken)
t2 = QtGui.QTextEdit(broken)
layout = QtGui.QVBoxLayout(broken)
layout.addWidget(t1)
layout.addWidget(t2)
broken.resize(600, 400)
broken.show()
return broken
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
# The QVBoxLayout works when resizing.
works = QtGui.QFrame()
works.setWindowTitle('Works')
t1 = QtGui.QTextEdit(works)
t2 = QtGui.QTextEdit(works)
layout = QtGui.QVBoxLayout(works)
layout.addWidget(t1)
layout.addWidget(t2)
works.resize(600, 400)
works.show()
# The QVBoxLayout does not work when resizing.
broken = make()
sys.exit(app.exec_())
(2) I may be doing something stupid but I really need to apply the following
patch to build PyQwt for Qt-4 ( see also
http://mats.imk.fraunhofer.de/pipermail/pykde/2005-December/011764.html ):
--- sip-snapshot-20060107/siputils.py.gv 2006-01-08 04:30:40.000000000 +0100
+++ sip-snapshot-20060107/siputils.py 2006-01-08 07:58:51.000000000 +0100
@@ -467,7 +467,13 @@
if self.config.qt_version >= 0x040000:
# This is really just a help for PyQt's configure.py when it is
# detecting what Qt modules are available.
- qtmods = self.config.pyqt_modules[:]
+ qtmods = self.config.pyqt_modules
+ if isinstance(qtmods, list):
+ # True for PyQt's configure
+ qtmods = qtmods[:]
+ else:
+ # True for PyQwt's configure, unless I am really stupid
+ qtmods = qtmods.split()
qtmods.extend(self._qt)
for mod in qtmods:
#- end patch -#
If I do not apply the patch, I get the following exeption:
An internal error occured. Please report all the output
from the program, including the following traceback, to
pyqwt-users at lists.sourceforge.net
Traceback (most recent call last):
File "configure.py", line 867, in ?
main()
File "configure.py", line 841, in main
options = check_compiler(configuration, options)
File "configure.py", line 293, in check_compiler
if compile_qt_program(name, configuration):
File "configure.py", line 51, in compile_qt_program
exe, build = makefile.build_command(name)
File "/home/packer/usr/lib/python2.4/site-packages/sipconfig.py", line 1545, in build_command
self.ready()
File "/home/packer/usr/lib/python2.4/site-packages/sipconfig.py", line 916, in ready
self.finalise()
File "/home/packer/usr/lib/python2.4/site-packages/sipconfig.py", line 1630, in finalise
Makefile.finalise(self)
File "/home/packer/usr/lib/python2.4/site-packages/sipconfig.py", line 572, in finalise
qtmods.extend(self._qt)
AttributeError: 'str' object has no attribute 'extend'
The code leading to this exception is:
makefile = sipconfig.ProgramMakefile(
configuration, console=True, qt=True, warnings=True)
makefile.extra_defines.extend(extra_defines)
makefile.extra_include_dirs.extend(extra_include_dirs)
makefile.extra_lib_dirs.extend(extra_lib_dirs)
makefile.extra_libs.extend(extra_libs)
exe, build = makefile.build_command(name)
Gerard
More information about the PyQt
mailing list