easybashgui functions

Only these...

message & ok_message & alert_message
question
text
input
menu
& list
fselect & dselect
wait_seconds
& wait_for & terminate_wait_for
progress

adjust





Want know more on
easybashgui
functions ?


 function                     
arguments                                                                   
description                                                                                                             
 message

 "[text]"
( 1 argument )
 question

 "[text]"
 ( 1 argument, box output to exit code and STDERR ) (1)
 text  ( STDIN, NO argument, box output to "${dir_tmp}/${file_tmp}" and STDERR ) (2)
 wait_seconds

 "[integer]" 
  ( 1 argument )
 wait_for "[text]"
  ( 1 argument, PID to kill to "wait_for__PID" variable and STDERR ) (3)
 terminate_wait_for    ( 1 argument only in easydialog, otherwise, NO argument ) (3)
 fselect "<init. dir.>"
 ( 1 <optional> argument, box output to "${dir_tmp}/${file_tmp}" and STDERR ) (4)
 dselect "<init. dir.>"     
   ( 1 <optional> argument, box output to "${dir_tmp}/${file_tmp}" and STDERR ) (4)
 input 1 "[init 1]"
  ( 2 arguments, box output to "${dir_tmp}/${file_tmp}" and STDERR )
 input 2 "[label 1]" "[init 1]" "[label 2]" "[init 2]"
  ( 5 arguments, box output to "${dir_tmp}/${file_tmp}" and STDERR )
 input 3 "[label 1]" "[init 1]" "[label 2]" "[init 2]" "[label 3]" "[init 3]"  ( 7 arguments, box output to "${dir_tmp}/${file_tmp}" and STDERR )
 menu "[item 1]" ... "[item n]"      ( [n] arguments, box output to "${dir_tmp}/${file_tmp}" and STDERR ) (5)
 list  <+|->"[item 1]" ... <+|->"[item n]" 
  ( [n] arguments
optionally prefixed with "+"(plus) or "-"(minus),
box output to "${dir_tmp}/${file_tmp}" and STDERR )
(5)
 progress

 "[text]"
 ( percent with or without '%' in STDIN, 1 argument )
 progress

 "[text]" "[elements number]"  
 ( "PROGRESS" string in STDIN, 2 arguments )
 adjust  "[text]" "[min value]" "[init value]" "[max value]"
 ( 4 arguments, box output to "${dir_tmp}/${file_tmp}" and STDERR )
( clean_temp )
  ( NO argument, NO output,
 it is used finally to remove temp files )

(1) = "0" exit status is "YES", "1" exit status is "NOT", other exit codes you should make program exit : normally in a script you have just to check exit status to know user choice ;
(2) = "text" function writes text from STDIN to file "${dir_tmp}/${file_tmp}" and (only for kdialog, zenity, and Xdialog) you can also edit it ;
(3) = "wait_for" function creates a window with a text, then returns control to main program... after the job, you would close the window throught function called "terminate_wait_for" ;
(4) = take care that if you are in "console mode" or without X, throught cdialog, selection is done by SPACE key, and not by enter key ;
(5) = "menu" function allows only one item selected; on the contrary "list" allows multiple choices and with "+" or "-" you can tell it to display them already selected or not;




Examples:


1)
question "Do you like Contry music ?"
answer="${?}"
if [ ${answer} -eq 0 ]
    then
    ok_message "You do like it :)"
elif [ ${answer} -eq 1 ]
    then
    alert_message "You don't like it :("
else
    ok_message "See you..."
    exit 0
fi


2)
echo -e "What's your name?\n\nMy name's:\nVittorio" | text


3)
wait_for "I'm sleeping 4 seconds... good night..."
sleep 4
terminate_wait_for


4)
fselect
file="$(0< "${dir_tmp}/${file_tmp}" )"


5)
input 1 "(write here IP address)" && ip_address
="$(0< "${dir_tmp}/${file_tmp}" )"

input 3 "Username" "root" "IP address" "192.168.0.1" "Destination directory" "/tmp"
IFS=$'\n' ; choices=( $(0< "${dir_tmp}/${file_tmp}" ) ) ; IFS=$' \t\n'
user="${choices[0]}"
ip="${choices[1]}"
dir="${choices[2]}"


6)

adjust "Please, set Volume level" 150 230 400
volume_to_set=
"$(0< "${dir_tmp}/${file_tmp}" )"


7)

for i in 13 27 31 35 40 53 57 63 70 82 83 96 100
    do
    echo "${i}"
    sleep 2
done | progress "This is a test progress depending on percent in StdIn..."

for char in A B C
    do
    echo "PROGRESS"
    sleep 2
done | progress "This is a test progress depending on loop \n (you need an other argument: 3)..."  "3"
# see next example...


8)
women=( Angela Carla Michelle Noemi Urma Marisa Karina Anita Josephine Rachel )
for (( index=0 ; index < ${#women[@]} ; index++ ))
    do
    today_woman="${women[${index}]}"
    kiss "${today_woman}"
    #
    # Job done !!
    # then ->
    echo "PROGRESS"
    #
done | progress "This is a _LOVE_ progress..." "${#women[@]}"

 Mmmmh... I liked last example... eh,eh... ;-)