<div class="gmail_quote">On Tue, Feb 7, 2012 at 3:12 PM, Hans Chen <span dir="ltr"><<a href="mailto:hanswchen@gmail.com">hanswchen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
You may want to take a look at KProcess: <a href="http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKProcess.html" target="_blank">http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKProcess.html</a><br>
For example, here's a Python plasmoid that uses it: <a href="http://kde-look.org/content/show.php/Redshift+plasmoid?content=148737" target="_blank">http://kde-look.org/content/show.php/Redshift+plasmoid?content=148737</a><br>
</blockquote><div> </div></div>Took a look at that but I wasn't sure how to do that based on QML.  Here
 are the ideas I've come up with, I'm not sure if they'll work.<br><br>Some of them involve my python helper program using sys.exit() with a 0 or 1 to denote success or failure.<br><br>1) The command I'm using  <b>runCommand(string exe[, array args])</b>
 says in 
<a href="http://techbase.kde.org/Development/Tutorials/Plasma/JavaScript/API-LaunchApp">http://techbase.kde.org/Development/Tutorials/Plasma/JavaScript/API-LaunchApp</a>
 that it returns true on success and false on failure.  I know it 
returns false if I put a program there that doesn't exist.  If I made my
 program exist on sys.exit(1) (which to the commandline is a failed 
program) would that make this command false?  Then I could just use an if statement to change the button color.<br><br>2) Put a javascript 
function in my QML that calls my helper python script.  Then I can have 
it return 0 or 1.  And I can have the button change its color based on 
the output of the javascript.<br><br>3) Based on what I found here ( 
<a href="http://wiki.maemo.org/Quick_Widgets">http://wiki.maemo.org/Quick_Widgets</a> ), but have found little 
documentation elsewhere about, I could use the Process from the first example and 
then for onCompleted and onFailed, make THAT change the button.  Again, 
that would mean that sys.exit() anything but 0 should be onFailed, 
right?<br>
<br>
Any suggestions on which would easiest/most correct for the QML programming paradigm?  If it's #3, I am curious about how my button would call the process and evaluate the results.<br clear="all">--<br>Eric Mesa<div>
<a href="http://about.me/ericmesa" target="_blank">http://about.me/ericmesa</a><br><a href="http://www.ericsbinaryworld.com/" target="_blank">http://www.ericsbinaryworld.com</a></div>