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
Background processing with gtkdialog
- matiasbatero
- Posts: 60
- Joined: Fri 12 Oct 2012, 01:27
- Location: Mar del Plata, Argentina
Xdialog has logbox option
http://xdialog.free.fr/doc/box.html
which is useful to show results instantaneously.
Several gtkdialog scripts use it.
________________________________
http://xdialog.free.fr/doc/box.html
which is useful to show results instantaneously.
Several gtkdialog scripts use it.
________________________________
Re: Background processing with gtkdialog
Wrongmatiasbatero wrote:Gtkdialog wait always a command/process finish signal in order to continue rendering the GUI.
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
- matiasbatero
- Posts: 60
- Joined: Fri 12 Oct 2012, 01:27
- Location: Mar del Plata, Argentina
Re: Background processing with gtkdialog
Thanks Zigbert!!! i will do that. Next i'll post my results.zigbert wrote:Wrongmatiasbatero wrote:Gtkdialog wait always a command/process finish signal in order to continue rendering the GUI.
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
- matiasbatero
- Posts: 60
- Joined: Fri 12 Oct 2012, 01:27
- Location: Mar del Plata, Argentina
Thanks!!! Seems that work, but it's not applicable in this case.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.
________________________________
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
____________________________________________
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
Last edited by don570 on Thu 07 Nov 2013, 17:14, edited 1 time in total.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
A=$((A+1))don570 wrote:Code: Select all
#!/bin/sh ... let "A=$A+1"
https://wiki.ubuntu.com/DashAsBinSh#let
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].