Re: [PyQt] Help understanding a backtrace
On Sun, Jan 29, 2012 at 10:14:48PM +, Phil Thompson wrote: Backout that change and apply the second one. Doing that results in a crash, with the assertion causing the output python2: objmap.c:267: add_object: Assertion `sw-flags 0x0200 == 0' failed. Backtrace attached. Kovid. -- _ Dr. Kovid Goyal http://www.kovidgoyal.net http://calibre-ebook.com _ [New LWP 13034] [New LWP 13040] [New LWP 13039] [Thread debugging using libthread_db enabled] Using host libthread_db library /lib64/libthread_db.so.1. Core was generated by `python2 /usr/bin/calibre-parallel'. Program terminated with signal 6, Aborted. #0 0x7f2335508ac5 in raise () from /lib64/libc.so.6 Thread 3 (Thread 0x7f2312e06700 (LWP 13039)): #0 0x7f233586e58c in pthread_cond_wait () from /lib64/libpthread.so.0 No symbol table info available. #1 0x7f2324a3a4d4 in WTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib64/qt4/libQtWebKit.so.4 No symbol table info available. #2 0x7f2335869d0c in start_thread () from /lib64/libpthread.so.0 No symbol table info available. #3 0x7f23355afdbd in clone () from /lib64/libc.so.6 No symbol table info available. Thread 2 (Thread 0x7f23124ed700 (LWP 13040)): #0 0x7f23355a6ee3 in poll () from /lib64/libc.so.6 No symbol table info available. #1 0x7f232e4377c3 in g_main_context_poll (n_fds=1, fds=0x7f230c000be0, timeout=-1, context=0x3adc6d0, priority=optimized out) at gmain.c:3402 poll_func = 0x7f232e4476e0 g_poll #2 g_main_context_iterate (context=0x3adc6d0, block=1, dispatch=1, self=optimized out) at gmain.c:3084 max_priority = 2147483647 timeout = -1 some_ready = optimized out nfds = 1 allocated_nfds = optimized out fds = 0x7f230c000be0 #3 0x7f232e437c91 in g_main_context_iteration (context=0x3adc6d0, may_block=1) at gmain.c:3152 retval = optimized out #4 0x7f232ecafc8f in QEventDispatcherGlib::processEvents (this=0x3aa4640, flags=...) at kernel/qeventdispatcher_glib.cpp:422 d = 0x3ae89a0 canWait = true result = optimized out #5 0x7f232ec83f22 in QEventLoop::processEvents (this=optimized out, flags=...) at kernel/qeventloop.cpp:149 d = 0x7f230c000b10 #6 0x7f232ec8416c in QEventLoop::exec (this=0x7f23124ece80, flags=...) at kernel/qeventloop.cpp:201 d = 0x7f230c000b10 app = 0x39903d0 #7 0x7f232eb99724 in QThread::exec (this=optimized out) at thread/qthread.cpp:498 d = 0x3ae8c50 locker = {val = 61770976} eventLoop = {QObject = {_vptr.QObject = 0x7f232efb58d0, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x7f232ed400c0 QObject, data = 0x7f232ed40160, extradata = 0x7f232efad500}}, d_ptr = {d = 0x7f230c000b10}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x7f232ed48d20 Qt, data = 0x7f232ed4c5e0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x7f232efad4e0, stringdata = 0x7f232ed525a0 QEventLoop, data = 0x7f232ed525c0, extradata = 0x0}}} returnCode = optimized out #8 0x7f232eb9bf85 in QThreadPrivate::start (arg=0x1c6af80) at thread/qthread_unix.cpp:331 thr = 0x1c6af80 data = 0x3ae2ff0 #9 0x7f2335869d0c in start_thread () from /lib64/libpthread.so.0 No symbol table info available. #10 0x7f23355afdbd in clone () from /lib64/libc.so.6 No symbol table info available. Thread 1 (Thread 0x7f233602b700 (LWP 13034)): #0 0x7f2335508ac5 in raise () from /lib64/libc.so.6 No symbol table info available. #1 0x7f2335509f46 in abort () from /lib64/libc.so.6 No symbol table info available. #2 0x7f233550184e in __assert_fail_base () from /lib64/libc.so.6 No symbol table info available. #3 0x7f2335501910 in __assert_fail () from /lib64/libc.so.6 No symbol table info available. #4 0x7f232e1e7348 in add_object (om=0x7f232e3efb80, addr=0x3c2af20, val=0x37cff30) at objmap.c:267 next = 0x0 sw = 0x37db7a0 he = 0x1c17830 __PRETTY_FUNCTION__ = add_object #5 0x7f232e1e70d1 in sipOMAddObject (om=0x7f232e3efb80, val=0x37cff30) at objmap.c:163 addr = 0x3c2af20 base_ctd = 0x7fff129fd9f0 #6 0x7f232e1e2526 in sipSimpleWrapper_init (self=0x37cff30, args=0x7f2335fea050, kwds=0x0) at siplib.c:9149 sipNew = 0x3c2af20 sipFlags = 4 owner = 0x0 wt = 0x1c53ae0 td = 0x7f232f3eb8e0 ctd = 0x7f232f3eb8e0 unused = 0x0 unused_p = 0x0 got_kw_handler = 1 kw_handler = 0x7f232f15dbc0 qpycore_pyqtconfigure(_object*, QObject*, _object*) __PRETTY_FUNCTION__ = sipSimpleWrapper_init #7 0x7f2335b1f9f8 in type_call (type=optimized out, args=0x7f2335fea050, kwds=0x0) at Objects/typeobject.c:737 obj = 0x37cff30 #8 0x7f2335aca5d3 in PyObject_Call (func=0x1c53ae0, arg=optimized out, kw=optimized
[PyQt] Custom webkit protocol example not working anymore?
Hello, I tried http://diotavelli.net/PyQtWiki/Using%20a%20Custom%20Protocol%20with%20QtWebKit (I attached the code). Unfortunately I do not see anything on the page after clicking the link with the new protocol. Has anything changed or is it a bug in the version I used (PyQt 4.8.3, sip 4.12.1) ? Regards Henning #!/usr/bin/env python # -*- coding: utf-8 -*- # Code from http://www.diotavelli.net/PyQtWiki/Using%20a%20Custom%20Protocol%20with%20QtWebKit import sys from PyQt4.QtCore import QTimer, QVariant, SIGNAL from PyQt4.QtGui import * from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply from PyQt4.QtWebKit import QWebView html = html head titleTest page for the download:// scheme/title /head body h1Downloads/h1 a href=download://myfileDownload a file/a hr / a href=http://www.google.com;A normal link/a /body /html class DownloadReply(QNetworkReply): def __init__(self, parent, url, operation): QNetworkReply.__init__(self, parent) self.content = htmlheadtitleTest/title/headbodyThis is a test./body/html self.offset = 0 self.setHeader(QNetworkRequest.ContentTypeHeader, QVariant(text/html; charset=ASCII)) self.setHeader(QNetworkRequest.ContentLengthHeader, QVariant(len(self.content))) QTimer.singleShot(0, self, SIGNAL(readyRead())) QTimer.singleShot(0, self, SIGNAL(finished())) self.open(self.ReadOnly | self.Unbuffered) self.setUrl(url) def abort(self): pass def bytesAvailable(self): return len(self.content) - self.offset def isSequential(self): return True def readData(self, maxSize): print readData called with, maxSize print offset is, self.offset if self.offset len(self.content): end = min(self.offset + maxSize, len(self.content)) data = self.content[self.offset:end] self.offset = end return data class NetworkAccessManager(QNetworkAccessManager): def __init__(self, old_manager): QNetworkAccessManager.__init__(self) self.old_manager = old_manager self.setCache(old_manager.cache()) self.setCookieJar(old_manager.cookieJar()) self.setProxy(old_manager.proxy()) self.setProxyFactory(old_manager.proxyFactory()) def createRequest(self, operation, request, data): if request.url().scheme() != download: return QNetworkAccessManager.createRequest(self, operation, request, data) if operation == self.GetOperation: # Handle download:// URLs separately by creating custom # QNetworkReply objects. reply = DownloadReply(self, request.url(), self.GetOperation) return reply else: return QNetworkAccessManager.createRequest(self, operation, request, data) if __name__ == __main__: app = QApplication(sys.argv) view = QWebView() old_manager = view.page().networkAccessManager() new_manager = NetworkAccessManager(old_manager) view.page().setNetworkAccessManager(new_manager) view.setHtml(html) view.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Help understanding a backtrace
I was able to trace the python code that is triggering the assert. Basically, it is the following sequence: view = self.parent() At this point view is a subclass of QMainWindow and view.parent() returns None Calling view.size() causes the assert to be triggered. Interestingly the assert is only triggered the second time this code is run, which tells me that probably the underlying Qt object corresponding to view has been deleted. view is the main window of the application, there is reference to it kept at the python level. Note that this is only one instance where the assert is triggered, I am fairly certain that there will be several unrelated code paths throughout calibre that will trigger it, given the various crashes I have experienced. Reading the SIP changelog, one thing of note: The QMainWindow subclass has multiple inheritance. It is defined as class EbookViewer(MainWindow, Ui_EbookViewer): where Ui_EbookViewer comes from a compiled .ui file and MainWindow is a simple subclass of QMainWindow. The definition of EbookViewer is here: http://bazaar.launchpad.net/~kovid/calibre/trunk/view/head:/src/calibre/gui2/viewer/main.py#L171 and the MainWindow class is: http://bazaar.launchpad.net/~kovid/calibre/trunk/view/head:/src/calibre/gui2/main_window.py#L90 Let me know if there's anything else I can do. Kovid. On Sun, Jan 29, 2012 at 10:14:48PM +, Phil Thompson wrote: On Sun, 29 Jan 2012 22:20:26 +0530, Kovid Goyal ko...@kovidgoyal.net wrote: Got another crash, with the addition of SIP_ALIAS. The backtrace is a little different, now the crash happens in PyObject__GcUntrack called from removeParent (backtrace attached). To be clear this is running off sip 4.13.1 release tarball with the first change you asked for (addition of SIP_ALIAS in object_add()) How would you like me to proceed? Backout that change and apply the second one. Phil !DSPAM:3,4f25c4da18598762377731! -- _ Dr. Kovid Goyal http://www.kovidgoyal.net http://calibre-ebook.com _ signature.asc Description: Digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Help understanding a backtrace
On Mon, 30 Jan 2012 17:43:30 +0530, Kovid Goyal ko...@kovidgoyal.net wrote: I was able to trace the python code that is triggering the assert. Basically, it is the following sequence: view = self.parent() At this point view is a subclass of QMainWindow and view.parent() returns None Calling view.size() causes the assert to be triggered. Interestingly the assert is only triggered the second time this code is run, which tells me that probably the underlying Qt object corresponding to view has been deleted. view is the main window of the application, there is reference to it kept at the python level. Note that this is only one instance where the assert is triggered, I am fairly certain that there will be several unrelated code paths throughout calibre that will trigger it, given the various crashes I have experienced. Reading the SIP changelog, one thing of note: The QMainWindow subclass has multiple inheritance. It is defined as class EbookViewer(MainWindow, Ui_EbookViewer): where Ui_EbookViewer comes from a compiled .ui file and MainWindow is a simple subclass of QMainWindow. The definition of EbookViewer is here: http://bazaar.launchpad.net/~kovid/calibre/trunk/view/head:/src/calibre/gui2/viewer/main.py#L171 and the MainWindow class is: http://bazaar.launchpad.net/~kovid/calibre/trunk/view/head:/src/calibre/gui2/main_window.py#L90 Let me know if there's anything else I can do. Try the current tip of the 4.13-maint branch without any additional changes... hg pull -u Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Parent/Child widget clipping
Greetings All, Doing some prototyping where I have a simple QTreeWidget with 3 items. Each item has 3 simple children. Using QTreeWidget.setItemWidget()I set/insert a simple QTableWidget into a child of one of the tree's parent items (first column) The problem is that the child-table width is wider than the parent-tree's first column, so that parent-tree-column2 clips the child-table. This phenomena is pretty much identical to this example on stackoverflow (last pix) http://stackoverflow.com/questions/6133367/qtreewidget-with-multiple-columns-limits-number-of-child-items However, in that example, the problem is solved by manually (or could be automatic) resizing of the parent columns by simply pulling it wider,etc.. But in my prototype, I need the entire child-table to display in it's entirety but I need the columns of the parent-tree to remain the same width. In other words, I need to override the default behaviour of having the tree define the child's display region. I've tried several things...all to no avail... I chose to use Tree/Table-Widgets this time, instead of Tree/Table-Viewswould the views method perhaps solve this dilemma? If there's no way to solve this directlyany thoughts about constraining the position of a widget to another widget?...bypassing the parent/child relationship in favor of functionality that would snap a table widget's position to a marker, or anchor on the tree widget? Sounds crude, I know...but trying to figure out any workaround... Would doing something like setItemLayout (instead of setItemWidget) yield a layout that would paint over it's parent?(albeit I can't seem to find a function like setItemLayout, lol) Any and all suggestions or solutions or workarounds are greatly appreciated.. Cheers, Jim (Simple example attached) example2.py Description: Binary data ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Parent/Child widget clipping
On Tuesday 31 January 2012, 00:07:24 James Polk wrote: Greetings All, Doing some prototyping where I have a simple QTreeWidget with 3 items. Each item has 3 simple children. Using QTreeWidget.setItemWidget()I set/insert a simple QTableWidget into a child of one of the tree's parent items (first column) The problem is that the child-table width is wider than the parent-tree's first column, so that parent-tree-column2 clips the child-table. This phenomena is pretty much identical to this example on stackoverflow (last pix) http://stackoverflow.com/questions/6133367/qtreewidget-with-multiple- columns-limits-number-of-child-items However, in that example, the problem is solved by manually (or could be automatic) resizing of the parent columns by simply pulling it wider,etc.. But in my prototype, I need the entire child-table to display in it's entirety but I need the columns of the parent-tree to remain the same width. In other words, I need to override the default behaviour of having the tree define the child's display region. Excuse me, but I still don't get, what you really want to archive. If you want your table span the full tree widget width, try this after setItemWidget: self.LargeTable.setFirstItemColumnSpanned(self.LargeTable.topLevelItem(0).child(1), True) Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Parent/Child widget clipping
Whoo! That did it, Peter!! Thank you, Sir! tips hat I owe you another beer! -- View this message in context: http://python.6.n6.nabble.com/Parent-Child-widget-clipping-tp4352146p4352262.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] Help understanding a backtrace
On Mon, Jan 30, 2012 at 12:22:35PM +, Phil Thompson wrote: Try the current tip of the 4.13-maint branch without any additional changes... hg pull -u Done, albeit with hg clone -b 4.13-maint instead as pull wasn't doing the right thing. I'll let you know in a week if there are no more crashes, sooner otherwise. Kovid. -- _ Dr. Kovid Goyal http://www.kovidgoyal.net http://calibre-ebook.com _ signature.asc Description: Digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt