05.02-progress_bar_test 

05.02-progress_bar_test.png

Example 20. File 05.02-progress_bar_test

#! /usr/bin/gtkdialog -e

function progress() {
        for i in $(seq 0 10 100); do
                echo $i
                [ "$i" -le 30 ] && echo "Start..."
                [ "$i" -le 60 -a "$i" -gt 30 ] && echo "Middle..."
                [ "$i" -gt 60 ] && echo "End..."

                sleep 0.3
        done;

        echo ready
}

function progress_fast() {
        for i in $(seq 0 1 10000); do
                echo $((i/100))
                [ "$i" -le 3000 ] && echo "Start..."
                [ "$i" -le 6000 -a "$i" -gt 3000 ] && echo "Middle..."
                [ "$i" -gt 6000 ] && echo "End..."
                #sleep 0.1
        done;

        echo ready
}

export MAIN_DIALOG='
<vbox>
  <entry>
    <variable>ENTRY</variable>
    <input>date</input>
  </entry>
  <hbox>
    <button cancel> </button>
    <button>
      <label>Launch</label>
      <action type="launch">BAR_DIALOG</action>
    </button>
    <button>
      <label>Close</label>
      <action type="exit">CLOSE</action>
    </button>
  </hbox>
</vbox>
'

export BAR_DIALOG='
<vbox>
  <frame Progress>
    <text>
      <label>Some text describing what is happening.</label>
    </text>
    <progressbar>
      <variable>PROGRESS_BAR</variable>
      <label>Some Text</label>
      <input>progress_fast</input>
      <action type="refresh">ENTRY</action>
      <action type="closewindow">BAR_DIALOG</action>
      <action>echo ready</action>
    </progressbar>
  </frame>
  <hbox>
   <button cancel>
     <action type="closewindow">BAR_DIALOG</action>
   </button>
  </hbox>
 </vbox>
'