[PyQt] QMessage box question...

2009-10-16 Thread Laurent Dufrechou
Hi,

I have a QMessageBox which have small text and informative text, but
have big lines as detailed text. (kind of exeption log)
Thus, my dialog is quite small and when the user shows the details,
this
is almost unreadable.

My current code:

def MessageBox(title, text, info, detail, info_icon, buttons, default =
None):
msg_box = QMessageBox()
msg_box.setWindowTitle(title)
icon = QIcon()
icon.addPixmap(QPixmap(":/icons/Ressources/my.ico"),
   QIcon.Normal, QIcon.Off)
msg_box.setWindowIcon(icon)
msg_box.setText(text)
msg_box.setInformativeText(info)
if detail != "":
msg_box.setDetailedText(detail)
msg_box.setIcon(info_icon)
msg_box.setStandardButtons(buttons)
if default is not None:
msg_box.setDefaultButton(default)

window = MessageBox("Application Error","An unhandled exception has
occured.",
"ddd\n",

("t"*10+"\n")*100,
QMessageBox.Critical, QMessageBox.Ignore)


Detailed info are almost unreadable :(

Any direction appreciated!
Laurent

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


Re: [PyQt] Freezes and crashes with signal autoconnection

2009-10-16 Thread Christian Roche

Hi again!


Phil Thompson-5 wrote:
> 
> If you have a list of the QThread instances you can scan the list when
> finished() is received to see which one it is. There is an obvious race
> condition with that approach.
> 

I don't know if this race condition is obvious but I'm personally unable to
identify it. Could you please kindly elaborate a bit for a multi-threading
newbie ? :-)


Phil Thompson-5 wrote:
> 
> You could define a method in your QThread sub-class that finished() is
> connect to. That method just emits another signal but with the QThread
> instance as an argument.
> 

I also have a hard time understanding this one. How could finished() connect
to a method in the originating thread, which by definition is supposed not
to exist anymore since it has emitted this very signal? Or is the semantics
for this signal more complex?

By the way, I applied the first approach you suggested, i.e., I use
Qt.BlockingQueuedConnection when passing arguments in signals from threads
to main, and I now have a slot that collects finished() signals, browse the
list of threads and deletes those that it finds effectively finished. The
behavior is definitely better on Linux, although not perfect, however on
Windows I still get lots of crashes with no error messages at all.
Sometimes, but not always, the application spurts some weird error messages
in the middle of the run, not right before the crash, like 


> NotImplementedError: QAbstractListModel.rowCount() is abstract and must be
> overridden
> 
although this method is overriden of course, and works most of the time; or
(the application is using shelve):


> Traceback (most recent call last):
>   File "E:\Python\gallery\gallery\gallery.py", line 107, in data
> return QVariant(self.getLink(index).getPixmap())
>   File "E:\Python\gallery\gallery\threads.py", line 76, in getPixmap
> filepath = imageCache.getImageFile(self)
>   File "E:\Python\gallery\gallery\threads.py", line 148, in getImageFile
> if self.cache.has_key(url):
>   File "E:\Programs\Python\lib\shelve.py", line 107, in has_key
> return key in self.dict
>   File "E:\Programs\Python\lib\_abcoll.py", line 329, in __contains__
> self[key]
>   File "E:\Programs\Python\lib\bsddb\__init__.py", line 266, in
> __getitem__
> self._checkOpen()
> AttributeError: 'str' object has no attribute '_checkOpen'
> 
or simply (this one arrives right before the crash):


> NotImplementedError
> 

It all seems to be related to the ImageLink instances emitting a signal
towards a QAbstractListModel layoutChanged signal once download is complete.
I have no problem when I remove this signal (except of course that the
display does not refresh >-() However this all happens in the main thread as
far as I can tell. I'm going to try and extract a use case for that one but
I'm afraid it won't be easy. In the meantime if you could point me to a
possible likely cause I'd be very grateful!

Thanks again for your help!
Chris
-- 
View this message in context: 
http://www.nabble.com/Freezes-and-crashes-with-signal-autoconnection-tp25716493p25932041.html
Sent from the PyQt mailing list archive at Nabble.com.

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


Re: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Giovanni Bajo

On 10/16/2009 3:38 PM, Phil Thompson wrote:

On Fri, 16 Oct 2009 15:31:08 +0200, Giovanni Bajo 
wrote:

On 10/16/2009 10:10 AM, Phil Thompson wrote:

All outstanding bug reports against PyQt and SIP have been resolved - if
you disagree then let me know.

I plan to release PyQt v4.6.1 and SIP v4.9.1 early next week.

BTW, the current PyQt snapshot will build against Qt v4.6-beta1.

Hi Phil,

I got some GC-related random crashes in a testsuite run after you fixed 
the QApplication destruction. I investigated them enough to see that 
it's related to invokation of focusPolicy() or other focus-related 
virtual methods on an already-deleted object, but they are hard to track 
down and I am not sure whenever I will have a reproduction recipe ready.


Is there anything specific to focus stuff that rings a bell to you?


No. The obvious source of the problem is the QApplication being deleted too
soon in relation to some other object.


I delete all top-level widgets, flush all the events 
(qApp.processEvents()), and run an explicit gc.collect() pass. I 
actually don't know what else to do...


I start to believe that it's a Qt problem rather than a PyQt's one; eg: 
some globals somewhere in the focus code that is not reset by 
QApplication's destructor and still points to some destroyed object.


I'll have a further look.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] problem with pyqt 4.6

2009-10-16 Thread Linos

Phil Thompson escribió:

On Fri, 16 Oct 2009 16:27:00 +0200, Linos  wrote:

i dont know if this is a bug or a change in behaviour but keyPressEvent
dont 
catch the keyboard events in my QWidget or QDialog subclasses. In the
example 
added with PyQt 4.4 you can press any key and get his int code printed

but
with 
last snapshot it never prints anything.


- CODE

# -*- coding: utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

class TestWidget(QWidget):
 def __init__(self, parent):
 super(TestWidget, self).__init__()

 self.button = QPushButton("test")

 layout = QVBoxLayout()
 layout.addWidget(self.button)
 self.setLayout(layout)

 def keyPressEvent(self, event):
 print event.key()


def main():
 app = QApplication(sys.argv)

 widget = TestWidget(None)
 widget.show()
 return app.exec_()

if __name__ == "__main__":
 main()


Works fine for me.

Phil


Yes you have reason i have downloaded, compiled and installed the snapshots 
sip-4.9.1-snapshot-20091015.tar.gz and 
PyQt-x11-gpl-4.6.1-snapshot-20091014.tar.gz and now it works, i had installed 
the old snapshots sip-4.9.1-snapshot-20091010 and 
PyQt-x11-gpl-4.6.1-snapshot-20091009 before, thanks.


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


Re: [PyQt] problem with pyqt 4.6

2009-10-16 Thread Phil Thompson
On Fri, 16 Oct 2009 16:27:00 +0200, Linos  wrote:
> i dont know if this is a bug or a change in behaviour but keyPressEvent
> dont 
> catch the keyboard events in my QWidget or QDialog subclasses. In the
> example 
> added with PyQt 4.4 you can press any key and get his int code printed
but
> with 
> last snapshot it never prints anything.
> 
> - CODE
> 
> # -*- coding: utf-8 -*-
> import sys
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
> 
> class TestWidget(QWidget):
>  def __init__(self, parent):
>  super(TestWidget, self).__init__()
> 
>  self.button = QPushButton("test")
> 
>  layout = QVBoxLayout()
>  layout.addWidget(self.button)
>  self.setLayout(layout)
> 
>  def keyPressEvent(self, event):
>  print event.key()
> 
> 
> def main():
>  app = QApplication(sys.argv)
> 
>  widget = TestWidget(None)
>  widget.show()
>  return app.exec_()
> 
> if __name__ == "__main__":
>  main()

Works fine for me.

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


[PyQt] problem with pyqt 4.6

2009-10-16 Thread Linos
i dont know if this is a bug or a change in behaviour but keyPressEvent dont 
catch the keyboard events in my QWidget or QDialog subclasses. In the example 
added with PyQt 4.4 you can press any key and get his int code printed but with 
last snapshot it never prints anything.


- CODE

# -*- coding: utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

class TestWidget(QWidget):
def __init__(self, parent):
super(TestWidget, self).__init__()

self.button = QPushButton("test")

layout = QVBoxLayout()
layout.addWidget(self.button)
self.setLayout(layout)

def keyPressEvent(self, event):
print event.key()


def main():
app = QApplication(sys.argv)

widget = TestWidget(None)
widget.show()
return app.exec_()

if __name__ == "__main__":
main()

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


Re: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Phil Thompson
On Fri, 16 Oct 2009 15:31:08 +0200, Giovanni Bajo 
wrote:
> On 10/16/2009 10:10 AM, Phil Thompson wrote:
>> All outstanding bug reports against PyQt and SIP have been resolved - if
>> you disagree then let me know.
>> 
>> I plan to release PyQt v4.6.1 and SIP v4.9.1 early next week.
>> 
>> BTW, the current PyQt snapshot will build against Qt v4.6-beta1.
> 
> Hi Phil,
> 
> I got some GC-related random crashes in a testsuite run after you fixed 
> the QApplication destruction. I investigated them enough to see that 
> it's related to invokation of focusPolicy() or other focus-related 
> virtual methods on an already-deleted object, but they are hard to track 
> down and I am not sure whenever I will have a reproduction recipe ready.
> 
> Is there anything specific to focus stuff that rings a bell to you?

No. The obvious source of the problem is the QApplication being deleted too
soon in relation to some other object.

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


Re: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Giovanni Bajo

On 10/16/2009 10:10 AM, Phil Thompson wrote:

All outstanding bug reports against PyQt and SIP have been resolved - if
you disagree then let me know.

I plan to release PyQt v4.6.1 and SIP v4.9.1 early next week.

BTW, the current PyQt snapshot will build against Qt v4.6-beta1.


Hi Phil,

I got some GC-related random crashes in a testsuite run after you fixed 
the QApplication destruction. I investigated them enough to see that 
it's related to invokation of focusPolicy() or other focus-related 
virtual methods on an already-deleted object, but they are hard to track 
down and I am not sure whenever I will have a reproduction recipe ready.


Is there anything specific to focus stuff that rings a bell to you?
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


RE: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Phil Thompson
On Fri, 16 Oct 2009 16:34:12 +0600, "Igor Prischepoff" 
wrote:
>>BTW, the current PyQt snapshot will build against Qt v4.6-beta1.
>>Phil
> Wow, that's great!
> Is Animation framework and state machine supported?
> 
> Can't wait to test those c00l animations! :)
> 
> pyqt 4.6.1. on next week will be build against qt 4.6 beta or qt 4.5?
> I would like to port couple of new animation demos to pyqt!
> Could I have an exe installer please?

I said it built against the beta, I didn't say it supported the new
features of the beta. That support will be added when Qt v4.6 is released.

All I've done is work around the incompatibilities introduced in the beta.

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


RE: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Igor Prischepoff
>BTW, the current PyQt snapshot will build against Qt v4.6-beta1.
>Phil
Wow, that's great!
Is Animation framework and state machine supported?

Can't wait to test those c00l animations! :)

pyqt 4.6.1. on next week will be build against qt 4.6 beta or qt 4.5?
I would like to port couple of new animation demos to pyqt!
Could I have an exe installer please?

---
Igor
igor at tyumbit.ru

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


Re: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Hans-Peter Jansen
Am Freitag 16 Oktober 2009 schrieb Phil Thompson:
> All outstanding bug reports against PyQt and SIP have been resolved - if
> you disagree then let me know.

Unfortunately, I've crashed eric again with current snapshots as available 
on: 

http://download.opensuse.org/repositories/home:/frispete:/branches:/KDE:/KDE4:/Factory:/Desktop/

To be exact, it's sip-4.9.1-snapshot-20091014.tar.gz + yesterdays fix,
PyQt-x11-gpl-4.6.1-snapshot-20091014.tar.gz, eric 4.3.8, and pysvn 1.7.0.
The whole suite is build against Qt-4.5.3 now. 

Again, I've committed a newly added directory (8 binary files with a total of 
6kb) in a small project. On the commit confirmation dialog, I hit close 
immediately, when it turned enabled, which triggers the crash. This is pretty
reliably reproducible that way. 

Starting program: /usr/bin/python 
/usr/lib/python2.6/site-packages/eric4/eric4.py
[Thread debugging using libthread_db enabled]
[New Thread 0xb3a2ab90 (LWP 27336)]
[New Thread 0xb320fb90 (LWP 27365)]
[New Thread 0xb2a0eb90 (LWP 27366)]
[New Thread 0xb220db90 (LWP 27367)]
[Thread 0xb220db90 (LWP 27367) exited]
[Thread 0xb2a0eb90 (LWP 27366) exited]
[New Thread 0xb220db90 (LWP 27373)]
[New Thread 0xb2a0eb90 (LWP 27374)]
[Thread 0xb2a0eb90 (LWP 27374) exited]
[Thread 0xb220db90 (LWP 27373) exited]
[New Thread 0xb2a0eb90 (LWP 27375)]
[Thread 0xb2a0eb90 (LWP 27375) exited]
[New Thread 0xb2a0eb90 (LWP 27376)]
[Thread 0xb2a0eb90 (LWP 27376) exited]
[New Thread 0xb2a0eb90 (LWP 27377)]

Program received signal SIGSEGV, Segmentation fault.
0xb7885585 in QCoreApplication::postEvent(QObject*, QEvent*, int) () from 
/usr/lib/libQtCore.so.4
(gdb) bt
#0  0xb7885585 in QCoreApplication::postEvent(QObject*, QEvent*, int) () from 
/usr/lib/libQtCore.so.4
#1  0xb788586c in QCoreApplication::postEvent(QObject*, QEvent*) () from 
/usr/lib/libQtCore.so.4
#2  0xb7895127 in QObject::deleteLater() () from /usr/lib/libQtCore.so.4
#3  0xb7b1cf70 in PyQtProxy::unislot (this=0xaa21bf8, qargs=0xa9ee398) at 
qpycore_pyqtproxy.cpp:384
#4  0xb7b1d085 in PyQtProxy::qt_metacall (this=0xaa21bf8, 
_c=QMetaObject::InvokeMetaMethod, _id=1, _a=0xa9ee398)
at qpycore_pyqtproxy.cpp:344
#5  0xb789aee8 in QMetaObject::activate(QObject*, int, int, void**) () from 
/usr/lib/libQtCore.so.4
#6  0xb7b23174 in qpycore_emit (qtx=0xaa21a88, signal_index=5, 
parsed_signature=0xb3b5460, sigargs=0xb7c5602c)
at qpycore_sip_helpers.cpp:422
#7  0xb7b23b28 in qpycore_qobject_emit (qtx=0xaa21a88, sig=0x8303e1c 
"2accepted()", sigargs=0xb7c5602c)
at qpycore_sip_helpers.cpp:358
#8  0xb7b0b33b in meth_QObject_emit (sipSelf=0xaad65ac, sipArgs=0x831146c) at 
sip/QtCore/qobject.sip:409
#9  0xb7ea4875 in PyCFunction_Call (func=0x82fb2ac, arg=0x831146c, kw=0x0) at 
Objects/methodobject.c:81
#10 0xb7ef7485 in PyEval_EvalFrameEx (f=0xb3180fc, throwflag=0) at 
Python/ceval.c:3679
#11 0xb7efcb9b in PyEval_EvalCodeEx (co=0xa39b458, globals=0xa320b54, 
locals=0x0, args=0x8311498, argcount=1, kws=0x0, 
kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2942
#12 0xb7e91a29 in function_call (func=0xa39aa04, arg=0x831148c, kw=0x0) at 
Objects/funcobject.c:524
#13 0xb7e6cc1c in PyObject_Call (func=0xa39aa04, arg=0x831148c, kw=0x0) at 
Objects/abstract.c:2487
#14 0xb7e7a9fe in instancemethod_call (func=0xa39aa04, arg=0x831148c, kw=0x0) 
at Objects/classobject.c:2579
#15 0xb7e6cc1c in PyObject_Call (func=0xa37557c, arg=0xb7c5602c, kw=0x0) at 
Objects/abstract.c:2487
#16 0xb7ef574f in PyEval_CallObjectWithKeywords (func=0xa37557c, 
arg=0xb7c5602c, kw=0x0) at Python/ceval.c:3548
#17 0xb79a86cf in sip_api_invoke_slot (slot=0xaa1ba64, sigargs=0xb7c5602c) at 
qtlib.c:191
#18 0xb7b1ce5b in PyQtProxy::invokeSlot (sl...@0xaa1ba64, qargs=0xbfffc1d8) at 
qpycore_pyqtproxy.cpp:426
#19 0xb7b1cf55 in PyQtProxy::unislot (this=0xaa1ba48, qargs=0xbfffc1d8) at 
qpycore_pyqtproxy.cpp:379
#20 0xb7b1d085 in PyQtProxy::qt_metacall (this=0xaa1ba48, 
_c=QMetaObject::InvokeMetaMethod, _id=1, _a=0xbfffc1d8)
at qpycore_pyqtproxy.cpp:344
#21 0xb789aee8 in QMetaObject::activate(QObject*, int, int, void**) () from 
/usr/lib/libQtCore.so.4
#22 0xb789bb72 in QMetaObject::activate(QObject*, QMetaObject const*, int, 
void**) () from /usr/lib/libQtCore.so.4
#23 0xb6627ed7 in QDialogButtonBox::accepted() () from /usr/lib/libQtGui.so.4
#24 0xb6628168 in ?? () from /usr/lib/libQtGui.so.4
#25 0xb662a086 in QDialogButtonBox::qt_metacall(QMetaObject::Call, int, void**) 
() from /usr/lib/libQtGui.so.4
#26 0xb712907a in sipQDialogButtonBox::qt_metacall (this=0xaa14030, 
_c=QMetaObject::InvokeMetaMethod, _id=31, 
_a=0xbfffc39c) at sipQtGuiQDialogButtonBox.cpp:386
#27 0xb789aee8 in QMetaObject::activate(QObject*, int, int, void**) () from 
/usr/lib/libQtCore.so.4
#28 0xb789b320 in QMetaObject::activate(QObject*, QMetaObject const*, int, int, 
void**) () from /usr/lib/libQtCore.so.4
#29 0xb68ccb71 in QAbstractButton::clicked(bool) () from /usr/lib/libQtGui.so.4
#30 0xb65f4459 in ?? () from /usr/lib/libQtGui.so.4

Re: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Phil Thompson
On Fri, 16 Oct 2009 17:51:21 +0900, INADA Naoki 
wrote:
> To reproduce.
> 
> class _Base:
>   def foo(self):
> self.setWindowTitle('foo')
> 
> class MyWindow(QWindow, _Base):
> def __init__(self):
> QWindow.__init__(self)
> self.setWindowTitle()
> 
> To avoid segfault:
> 
> class _Base(object):
> 
> Can't PyQt detect multiple inheritance from old-style class?

As I said, all bug reports have been fixed. However the point is for you to
prove it for yourself by testing with the current snapshots.

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


Re: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread INADA Naoki
To reproduce.

class _Base:
  def foo(self):
self.setWindowTitle('foo')

class MyWindow(QWindow, _Base):
def __init__(self):
QWindow.__init__(self)
self.setWindowTitle()

To avoid segfault:

class _Base(object):

Can't PyQt detect multiple inheritance from old-style class?


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


Re: [PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Ville M. Vainio
On Fri, Oct 16, 2009 at 11:10 AM, Phil Thompson
 wrote:

> All outstanding bug reports against PyQt and SIP have been resolved - if
> you disagree then let me know.

So this one should be fixed now:

https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/452453
http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg19157.html

?

-- 
Ville M. Vainio
http://tinyurl.com/vainio
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Next Releases of PyQt and SIP

2009-10-16 Thread Phil Thompson
All outstanding bug reports against PyQt and SIP have been resolved - if
you disagree then let me know.

I plan to release PyQt v4.6.1 and SIP v4.9.1 early next week.

BTW, the current PyQt snapshot will build against Qt v4.6-beta1.

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