[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QWebEnginePage API for callbacks
From: David Cortesi <davecortesi () gmail ! com>
Date: 2015-01-06 3:59:13
Message-ID: CALyzANveNbn8oDKLB5hLDeg7tvUHTA96GwfvS+Sho3Lpw6bcLA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Mon, Jan 5, 2015 at 3:26 PM, Andreas Pakulat <apaku@gmx.de> wrote:
>
> I'm a bit at a loss what to do following a call to such a method. What is
>> the best way to "idle" until the callback comes? n.b. I don't see any
>> WebEngine specific guidance at the PyQt5 doc [2].
>>
>
> I'd say just as all other callbacks in Qt (i.e. signal/slots), return
> control to the qt event loop.
>
Could you clarify a bit? The doc [1] for QWebEnginePage.toPlainText() will
at some unknown future time call my callback passing the text of the page.
But I would make that call in some code that needs that text -- to write it
to a file, say. So in a custom class based on QWebEngineView, I capture the
^S key, perhaps, for Save. I put a findSaveDialog and get a path string and
open a text stream for output. Then...
self.page().toPlainText( lambda s : self.save_plain_text = s )
# Here -- twiddle my thumbs until I can...
output_stream << self.save_plain_text
Is this the kind of thing you have in mind?
self.save_plain_text = None
self.page().toPlainText( lambda s : self.save_plain_text = s )
while self.save_plain_text is None : QCoreApplication.processEvents()
output_stream << self.save_plain_text
[Attachment #5 (text/html)]
<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan \
5, 2015 at 3:26 PM, Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de" \
target="_blank">apaku@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div \
class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div>I'm a bit at a loss what to do following a call to such a method. \
What is the best way to "idle" until the callback comes? n.b. I don't \
see any WebEngine specific guidance at the PyQt5 doc \
[2].</div></div></blockquote><div><br></div></span><div>I'd say just as all other \
callbacks in Qt (i.e. signal/slots), return control to the qt event \
loop.</div></div></div></div></blockquote><div><br></div><div>Could you clarify a \
bit? The doc [1] for QWebEnginePage.toPlainText() will at some unknown future time \
call my callback passing the text of the page. But I would make that call in some \
code that needs that text -- to write it to a file, say. So in a custom class based \
on QWebEngineView, I capture the ^S key, perhaps, for Save. I put a findSaveDialog \
and get a path string and open a text stream for output. Then...<br><br></div><div> \
self.page().toPlainText( lambda s : self.save_plain_text = s )<br></div><div> # \
Here -- twiddle my thumbs until I can...<br></div><div> output_stream \
<< self.save_plain_text<br><br></div>Is this the kind of thing you have in \
mind?<br><br></div><div class="gmail_quote"> self.save_plain_text = \
None<br></div><div class="gmail_quote"> self.page().toPlainText( lambda s : \
self.save_plain_text = s )<br></div><div class="gmail_quote"> while \
self.save_plain_text is None : QCoreApplication.processEvents()<br> \
output_stream << self.save_plain_text<br><br><br></div></div></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic