> Probably PyQt. If you can produce a simple example that demonstrates the
> behaviour then I'll have a look at it.
>
> Phil
Ok, this simple example seems to trigger it. I've simply taken tutorial 5 and
added many superfluous QtCore.QObjects and connections. Change line 36 to
"generate_many = False" and things should be back to normal.
Note that there are many objects being generated: O(2^depth), where depth is
given in line 37, but only O(log depth) signals being emitted at every button
click.
We haven't been able to fully determine what exactly in the system
configuration triggers this. It certainly seems system or version dependent:
we have seen this on macs and linux, but not all of the machines. In fact, at
least one linux and one mac computer does not experience the slowness. Even
worse, one of the systems that experiences slowdown in our main application
("big app") does not experience it in this small example ("toy app"), and I
couldn't trigger the problem in any small example.
Here's the best information we could gather.
----
System that doesn't experience slowdown, neither in big app nor toy app:
AMD64 Opterons, running Ubuntu Feisty, 4GB RAM
system:
Python: 2.5.1 (r251:54863, May 2 2007, 16:27:44) [GCC 4.1.2 (Ubuntu
4.1.2-0ubuntu4)]
sip: 4.5
Qt: 4.2.2
PyQt: 4.1
System that experiences slowdown in both big app and toy app:
Xeon, running RHEL4, 6 GB RAM
system: Linux-2.6.9-55.ELsmp-x86_64-with-redhat-4-Nahant_Update_5
Python: 2.5.1 (r251:54863, Jun 13 2007, 18:29:50) [GCC 3.4.6 20060404 (Red
Hat 3.4.6-8)]
sip: snapshot-20070612
Qt: 4.3.0
PyQt: 4-snapshot-20070612
System that experiences slowdown in big app _but not_ in toy app:
PowerMac G5 Dual 2.5GHz, 4GB RAM
system: Darwin-8.10.0-Power_Macintosh-powerpc-32bit
Python: 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc.
build 5341)]
sip: 4.6
Qt: 4.2.3
PyQt 4.2
----
Let me know if you need more information.
Thank you very much,
-carlos
#!/usr/bin/env python
from PyQt4 import QtCore, QtGui
import random
import sys
class SignalGenerator(QtCore.QObject):
def __init__(self, level, state, parent=None):
QtCore.QObject.__init__(self)
self._left = None
self._right = None
self._state = state
self._level = level
if parent:
self.connect(parent,
QtCore.SIGNAL("some_signal"),
self.handle_signal)
if level == 0:
return
self._left = SignalGenerator(level-1, 0, self)
self._right = SignalGenerator(level-1, 1, self)
def handle_signal(self, value):
b = (value & (1 << self._level)) >> self._level
if self._level == 0:
if b == self._state:
print "Trigger ", value, self
else:
if b == self._state:
self.emit(QtCore.SIGNAL("some_signal"), value)
generate_many = True
depth = 13
class MyWidget(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
quit = QtGui.QPushButton("Generate")
quit.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold))
lcd = QtGui.QLCDNumber(2)
slider = QtGui.QSlider(QtCore.Qt.Horizontal)
slider.setRange(0, 99)
slider.setValue(0)
self.connect(quit, QtCore.SIGNAL("clicked()"),
self.trigger_signals)
self.connect(slider, QtCore.SIGNAL("valueChanged(int)"),
lcd, QtCore.SLOT("display(int)"))
layout = QtGui.QVBoxLayout()
layout.addWidget(quit)
layout.addWidget(lcd)
layout.addWidget(slider)
self.setLayout(layout)
if generate_many:
self._generator = SignalGenerator(depth, 0)
def trigger_signals(self):
if generate_many:
self._generator.emit(QtCore.SIGNAL("some_signal"),
random.randint(1, 1 << depth))
app = QtGui.QApplication(sys.argv)
widget = MyWidget()
widget.show()
sys.exit(app.exec_())
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt