Hi,
The method has to be defined as a slot.
@QtCore.Slot()
def shouldInterruptJavaScript(self):
Tibold
On 30 July 2011 01:12, Goran Rakic <[email protected]> wrote:
> Hi all,
>
> I posted this question to Stack Overflow but I guess this mailing list
> should be a better source for getting help.
>
> I would like to override shouldInterruptJavaScript slot in
> PySide.QtWebKit.QWebPage to silently ignore JavaScript interrupt
> requests. I have my own timer setup and I do not need a default message
> dialog that shows by default.
>
> This is an example code I wrote, but my shouldInterruptJavaScript method
> is never called. I see the same code used in PhantomJS and webscraping
> open source projects.
>
> import sys
> from PySide.QtGui import QApplication
> from PySide.QtWebKit import QWebPage
>
> class QWebPageHeadless(QWebPage):
> # FIXME: This is not working, the slot is not overriden!
> def shouldInterruptJavaScript(self):
> print "Interrupt javascript request ignored..."
> return False
>
> if __name__ == "__main__":
> app = QApplication(sys.argv)
> page = QWebPageHeadless()
> page.mainFrame().setHtml('<script>while(1);</script>')
> sys.exit(app.exec_())
>
>
> I have Python 2.7.1, PySide 1.0.5, Qt 4.7.2.
>
> Is there something special how should I reimplement
> shouldInterruptJavaScript in my subclass or is there a workaround?
>
>
> Thanks,
> Goran Rakic
>
> PS - The original SO post at http://stackoverflow.com/questions/6868286/
>
>
> _______________________________________________
> PySide mailing list
> [email protected]
> http://lists.pyside.org/listinfo/pyside
>
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside