Page 1 of 1
Background processing with gtkdialog
Posted: Sat 02 Nov 2013, 20:05
by matiasbatero
Hi to everyone.
I don't know how to get sub-processes working in background in gtkdialog.
Gtkdialog wait always a command/process finish signal in order to continue rendering the GUI.
I have a example, i want to extract Size, Path and MD5 sum from a file (file-selector widget) and puts results on a TREE widget.
MD5sum is the slow part of this process. Gtkdialog seems paralized until md5sum finish the job.
I want to put results as they are generated.
There is a way to do this??
If not, the only solution is a "waiting splash screen" and wait :S
Posted: Sat 02 Nov 2013, 20:15
by don570
Xdialog has logbox option
http://xdialog.free.fr/doc/box.html
which is useful to show results instantaneously.
Several gtkdialog scripts use it.
________________________________
Re: Background processing with gtkdialog
Posted: Sun 03 Nov 2013, 11:53
by zigbert
matiasbatero wrote:Gtkdialog wait always a command/process finish signal in order to continue rendering the GUI.
Wrong
There are (at least) 3 ways to update gui based on external actions.
1.) Add the tag attributes
file-monitor="true" auto-refresh="true". See
http://code.google.com/p/gtkdialog/wiki/tree
2.) Add an <action> to the <progressbar> widget, and it will execute as the bar reach 100%.
3.) The <timer> widget runs its <action> each sec (or whatever interval set). See
http://code.google.com/p/gtkdialog/wiki/timer
A more complex example is found in chapter 4 of
Gtkdialog - Tips and tricks
Sigmund
Re: Background processing with gtkdialog
Posted: Tue 05 Nov 2013, 01:49
by matiasbatero
zigbert wrote:matiasbatero wrote:Gtkdialog wait always a command/process finish signal in order to continue rendering the GUI.
Wrong
There are (at least) 3 ways to update gui based on external actions.
1.) Add the tag attributes
file-monitor="true" auto-refresh="true". See
http://code.google.com/p/gtkdialog/wiki/tree
2.) Add an <action> to the <progressbar> widget, and it will execute as the bar reach 100%.
3.) The <timer> widget runs its <action> each sec (or whatever interval set). See
http://code.google.com/p/gtkdialog/wiki/timer
A more complex example is found in chapter 4 of
Gtkdialog - Tips and tricks
Sigmund
Thanks Zigbert!!! i will do that. Next i'll post my results.
Posted: Tue 05 Nov 2013, 01:51
by matiasbatero
don570 wrote:Xdialog has logbox option
http://xdialog.free.fr/doc/box.html
which is useful to show results instantaneously.
Several gtkdialog scripts use it.
________________________________
Thanks!!! Seems that work, but it's not applicable in this case.
Posted: Thu 07 Nov 2013, 00:21
by don570
I wrote this short script to better understand Xdialog --logbox
and running a function in background
As an exercise remove the line ...
[ $A -gt 10 ] && break
and see what chaos occurs
Code: Select all
#!/bin/sh
add_function() {
rm -f /root/log_file
A=0
while true
do
let "A=$A+1"
echo "$A" >> /root/log_file
[ $A -gt 10 ] && break
sleep 2
done
}
export -f add_function
export MAIN_DIALOG='
<vbox border-width="20">
<button>
<label>Start</label>
<action>add_function &</action>
<action>exit:EXIT</action>
</button>
</vbox>
'
gtkdialog --program MAIN_DIALOG
export MAIN_DIALOG='
<vbox border-width="20">
<button>
<label>log box</label>
<action>Xdialog --date-stamp --no-cancel --logbox /root/log_file 0 0 &</action>
</button>
</vbox>
'
gtkdialog --program MAIN_DIALOG
____________________________________________
Posted: Thu 07 Nov 2013, 02:50
by technosaurus