• yad > fenêtre de progression

      Lorsqu’on utilise --progress, yad lit les lignes de données depuis la sortie standard. Si les lignes commencent par # le texte après # sera displayed in the progress bar label. Numeric values treats like a persents for progress bar.

       

      --progress-text=TEXT texte de progression

       

      --percentage=NOMBRE pourcentage initial

       

      --pulsate barre pulsative

       

      --auto-close Ferme la fenêtre dès que les 100% sont atteints

       

      --auto-kill tue les processus parent si cancel est cliqué

       

      --rtl direction de la barre de progression de droite à gauche

       

      --value=VALUE valeur initiale

       

      --min-value=VALUE--max-value=VALUE valeurs mini / maxi

       

      --step=VALUE valeur des intervalles (ou pas)

       

      --page=VALUE taille de la pagination

       

      --print-partial Print partial values

       

      --hide-value masquer les valeurs

       

      --vertical afficher une barre verticales

       

      --invert inverser la progression

       

      --mark=NAME:VALUE ajouter un repère (may be used multiple times)

       

      --bar=LABEL[:TYPE] Add the progress bar (NORM, RTL ou PULSE)

       

      LOG

      --enable-log[=TEXT] Show log window. This window gathers all of lines from stdin, started from # instead of setting appropriate progress labels. Optional argument TEXT is a text label for window expander.

      --log-on-top Place log window above progress bar.

      --log-expanded Start with expanded log window.

      --log-height Set the height of log window.

      MULTI PROGRESS

      Exemple : afficher les disques durs montés :

       

      eval exec yad --image=drive-harddisk --text="Disk usage:" --width=650 --multi-progress \
      $(df -hT $1 | tail -n +2 | awk '{printf  "--bar=\"<b>%s</b> (%s - %s) [%s/%s]\" %s ", $7, $1, $2, $4, $3, $6}')

       

       

      --bar=LABEL[:TYPE] Add the progress bar (TYPE : NORM, RTL ou PULSE)

      pulse for pulsating progress bar (moves on receiving data) or perm for permanent pulsatin progress bar. prem progress bar understant two commands - start for start movement and stop for stop it.

      --align=TYPE Set alignment of bar labels. Possible types are left, center or right. Default is left.

      --watch-bar=NUMBER Watch for 100% of bar NUMBER for close dialog.

      --auto-kill Kill parent process if cancel button is pressed. Initial values for bars set as an extra arguments. Each lines with progress data passed to stdin must be started from N: where N is a number of progress bar.

       

       

       

       

      Afficher une barre de progression lors d’une recherche de fichiers :

       

      #! /bin/bash
      myNR=0
      fcMY(){
         while read data; do
            myNR=$((myNR + 1))               # file counter prefix number
            echo "$myNR"
            echo "$data" | sed 's/&/&amp;/g' # sanitize ampersand char (due to yad error message)
            echo "#Found $myNR item(s)"      # third line here goes the text for the progress bar
         done | tee >(lisT)
      
         # A way to kill the progress (well, sort of)
         echo ""
         echo ""
         echo 100 # Printing 100 closes the progress dialog
      }
      
      function lisT(){
         (yad \
         --notebook \
         --list --column "Num" \
         --column "Files" \
         --column "hidden" \
         --title "Some App Title" \
         --fontname "mono 10" \
         --width 600 --height 300 \
         --hide-column="3" \
         --print-column="2" \
         --separator="" > /home/roelof/Desktop/result.txt # write the result(s) to a file
         if [[ $? == 1 ]]; then
         rm -f /home/roelof/Desktop/result.txt
         exit 0
         fi) || exit
      }
      
      find /home/roelof/Desktop/FBset/ -name '*.jpg' | \
      fcMY | awk 'NR % 3 == 0;fflush()' | yad --progress --pulsate --auto-close --auto-kill --button gtk-cancel:1 --on-top
      
      # awk - prints every third line and flushes to stdout
      #---------------------

       

       

 

Aucun commentaire

 

Laissez un commentaire