Posted: Mon 30 Jul 2012, 10:16 Post subject:
Several progress bars inside a single window script [SOLVED]
Hello,
I would like to know if it is possible and (if yes) how to build a gtkdialog script that shows several progress bars displayed inside a single window but running one after the other. When the first one has terminated to do its job, then the second one starts and so on...
Thank you!
Cordialement. _________________ Last edited by Argolance on Tue 31 Jul 2012, 05:45; edited 1 time in total
akash_rawal
Joined: 25 Aug 2010 Posts: 232 Location: ISM Dhanbad, Jharkhand, India
Posted: Mon 30 Jul 2012, 14:29 Post subject:
Re: Multiple progress bars inside a single window script?
This can be easily done using pipes. Example:
Code:
#!/bin/bash
function reader()
{
#This will be used to read from pipes
while true; do echo "`< $task_dir/$1`"; done
}
export -f reader
function task()
{
#Sample task 1
for i in `seq 20 20 100`; do
echo "$i" > "$task_dir/pipe_1"
echo "Doing task 1... ($i %)" > "$task_dir/pipe_1"
sleep 0.3 #Delay just to simulate a task
done
echo "done" > "$task_dir/pipe_1"
#Sample task 2
for i in `seq 20 20 100`; do
echo "$i" > "$task_dir/pipe_2"
echo "Doing task 2... ($i %)" > "$task_dir/pipe_2"
sleep 0.3 #Delay just to simulate a task
done
echo "done" > "$task_dir/pipe_2"
#Sample task 3
for i in `seq 20 20 100`; do
echo "$i" > "$task_dir/pipe_3"
echo "Doing task 3... ($i %)" > "$task_dir/pipe_3"
sleep 0.3 #Delay just to simulate a task
done
echo "done" > "$task_dir/pipe_3"
#After 2s close the window
sleep 2
echo "100"
}
export -f task
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum