Dataengnies
Petri Damstén
petri.damsten at gmail.com
Wed Aug 27 13:51:01 CEST 2008
On Tuesday 26 August 2008 23:38:47 Aaron J. Seigo wrote:
> and yes, if the engine is doing any sort of expensive work then the code
> needs to protect against it being called while the async job is in
> progreess.
Yes, that's true.
> doing async calls inside the DataEngine subclas itself is really not the
> best way to do things. encapsulating it inside a DataContainer subclass
> makes it waaaay easier to manage.
This was new to me :-) Converted ExecutableEngine to use custom Container
(attached). One problem. exec is called in constructor to start process for
the first time. checkForUpdate is called when process finished but seems that
m_queued is false and dataUpdated is not called. On second exec (first
updateRequested signal, which comes after first timeout) it works:
plasmoidviewer(22365) ScriptedHtml::connectToEngine:
"/home/damu/scripted_test.py"
plasmoidviewer(22365) ExecutableEngine::sourceRequestEvent:
"/home/damu/scripted_test.py"
plasmoidviewer(22365) ExecutableContainer::exec: "/home/damu/scripted_test.py"
plasmoidviewer(22365) ScriptedHtml::dataUpdated: "/home/damu/scripted_test.py"
QHash()
plasmoidviewer(22365)/libplasma Plasma::DataContainer::checkForUpdate: Dirty:
false
plasmoidviewer(22365) ExecutableContainer::finished:
"/home/damu/scripted_test.py"
plasmoidviewer(22365)/libplasma Plasma::DataContainer::checkForUpdate: Dirty:
true
plasmoidviewer(22365)/libplasma Plasma::SignalRelay::checkQueueing: Queued is
false
plasmoidviewer(22365) ExecutableContainer::exec: "/home/damu/scripted_test.py"
plasmoidviewer(22365)/libplasma Plasma::SignalRelay::timerEvent: Queued set
to: true
plasmoidviewer(22365) ExecutableContainer::finished:
"/home/damu/scripted_test.py"
plasmoidviewer(22365)/libplasma Plasma::DataContainer::checkForUpdate: Dirty:
true
plasmoidviewer(22365)/libplasma Plasma::SignalRelay::checkQueueing: Queued is
true
plasmoidviewer(22365) ScriptedHtml::dataUpdated: "/home/damu/scripted_test.py"
QHash(("stderr", QVariant(QString, "") ) ( "exit code" , QVariant(int, 0) ) (
"exit status" , QVariant(int, 0) ) ( "stdout" , QVariant(QString,
"/home/damu/scripted_test.html
") ) )
One other thing. If query() is run first for the DataEngine doing async calls
it won't work, but I'm not sure if that is important. Applet writer does not
have a way to know it (if engine is async or not), though.
Petri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: executable.cpp
Type: text/x-c++src
Size: 2448 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080827/8dbdc2dc/attachment.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: executable.h
Type: text/x-chdr
Size: 1572 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080827/8dbdc2dc/attachment.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080827/8dbdc2dc/attachment.sig
More information about the Plasma-devel
mailing list