Skip to content

Commit

Permalink
tuning of docs and a bugfix in adjust()
Browse files Browse the repository at this point in the history
  • Loading branch information
vaisarger committed Feb 23, 2024
1 parent be455e3 commit 28c6c6e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 48 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ transparently, based on the availability of the backends (frontends).

* Console mode:
* dialog
* cdialog
* Graphical mode:
* yad
* gtkdialog
Expand Down
31 changes: 13 additions & 18 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ transparently, based on the availability of the widget backends (frontends).

* Console mode:
* dialog
* cdialog
* whiptail (not selectable, just fall back)
* Graphical mode:
* yad
Expand All @@ -163,12 +162,12 @@ If there is no dialog/cdialog support installed. Check next section about `super
The backends for frontends (the widgets to use to display boxes) are selectable
by the `supermode` environment variable.

The `supermode` environment variable its only used to force or manually select
an specific widget , by example using `kdialog` under GTK desktop, or by example
using `zenity` under KDE environment. Also when EBG fails to detect widget usage!
The `supermode` environment variable is only used to force or manually select
a specific widget , by example using `kdialog` under GTK desktop, or by example
using `zenity` under KDE environment.

There is no `whiptail` mode because is used only as fallback! when dialog/cdialog
is missing, simply just use `supermode=dialog` for!
is missing, if whiptail is present, just use `supermode=dialog` for!

#### System wide usage vs module user usage

Expand Down Expand Up @@ -290,7 +289,7 @@ box with confirmation.
```bash
source easybashgui

question "Do you like Contry music ?"
question "Do you like Country music ?"
answer="${?}"
if [ ${answer} -eq 0 ]
then
Expand Down Expand Up @@ -385,7 +384,8 @@ You can piped the progress count to a text of a box:
```bash
source easybashgui

for i in 10 20 30 40 50 60 70 80 90 100 do
for i in 10 20 30 40 50 60 70 80 90 100
do
echo "${i}"
sleep 1
done | progress "This is a test progress..."
Expand Down Expand Up @@ -425,7 +425,7 @@ choice_list="$(0< "${dir_tmp}/${file_tmp}" )"
IFS=$'\n' ; choice_array=( $(0< "${dir_tmp}/${file_tmp}" ) ) ; IFS=$' \t\n'
```

#### A more complex example
#### A more complex example: progress bar by steps

```bash
source easybashgui
Expand Down Expand Up @@ -626,9 +626,7 @@ percent position is read from STDIN, the number can be piped or parsed from:
* exit code: 0 unless its canceled externally, will be anything

``` bash
progress "[text]" <<< 20
progress "[text]" <<< 60
progress "[text]" <<< 90
(echo "10" ; sleep 1 ; echo "50" ; sleep 1 ; echo "100" ; sleep 1 ) | progress "Percent..."
```

* To create a progress sequence you must have several statements with different
Expand All @@ -652,12 +650,7 @@ from the STDIN to the function to indicate to fil the progress bar in the box:
* exit code: 0 unless its canceled externally, will be anything

``` bash
progress "<text>" n <<< PROGRESS
progress "<text>" n-1 <<< PROGRESS
...
progress "<text>" 3 <<< PROGRESS
progress "<text>" 2 <<< PROGRESS
progress "<text>" 1 <<< PROGRESS
(echo "PROGRESS" ; sleep 1 ; echo "PROGRESS" ; sleep 1 ) | progress "Steps..." 2
```

#### wait_for
Expand Down Expand Up @@ -917,7 +910,9 @@ notify_message [-i "<icon>"] "[text]"

#### notify_change

Like "message" but now as desktop systray notification to display:
This function is used to change the desktop systray notification from a state (say "good" )
to the other state (say: "bad" ) set previously by notify() function (see below );
moreover, you can optionally change on-the-fly even the systray icon and tooltip:

* ARGUMENTS:
* icon : optional , picture to show in the box aside
Expand Down
37 changes: 12 additions & 25 deletions lib/easybashgui.lib
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#####################################
#####################################
#
LIB_VERSION="12.0.5"
LIB_VERSION="12.0.6"
LIB_NAME="easybashgui.lib"
LIB_URL="https://github.com/BashGui/easybashgui"
LIB_AUTHOR="Vittorio Cagnetta"
Expand Down Expand Up @@ -7922,7 +7922,6 @@ elif [ "${mode}" = "dialog" ]
init_value_percent_float=$(echo "scale=2; $(( ${init_value} - ${start_value} )) / ${step}" | bc -l )
init_value_percent=$(arrotonda "${init_value_percent_float}" )
#
#
dim=10
#
{
Expand All @@ -7934,18 +7933,16 @@ elif [ "${mode}" = "dialog" ]
#
exit_success=0
value_percent=${init_value_percent} && echo ${value_percent}
#echo "INIZIO" 1> /home/cagnettav/Desktop/prova-adj.txt
#
while :
do
read -n 3 -s key
#
#echo "---${key}---" 1>> /home/cagnettav/Desktop/prova-adj.txt
#
case ${exit_success} in
"$(echo -n "${key}" | grep -E "(${up_with_X}|${up_without_X}|${right_with_X}|${right_without_X})" &> /dev/null; echo ${?} )" )
value_percent=$(( ${value_percent} + 1 )) ;;
[ ${value_percent} -lt 100 ] && ((value_percent+=1)) ;;
"$(echo -n "${key}" | grep -E "(${down_with_X}|${down_without_X}|${left_with_X}|${left_without_X})" &> /dev/null; echo ${?} )" )
value_percent=$(( ${value_percent} - 1 )) ;;
[ ${value_percent} -gt 0 ] && ((value_percent-=1)) ;;
* )
if [[ ${key} =~ .*A.* ]]
then
Expand All @@ -7959,7 +7956,6 @@ elif [ "${mode}" = "dialog" ]
elif [[ ${key} =~ .*D.* ]]
then
value_percent=$(( ${value_percent} - 1 ))
#
elif [[ ${key} =~ .*O.* ]]
then
continue 1
Expand All @@ -7980,11 +7976,11 @@ elif [ "${mode}" = "dialog" ]
} | \
\
${dialogo} --title "${supertitle:-EasyBashGUI}: adjust (use arrow keys)" ${progress} "${testo}" "${dim}" "${dimensione_finestra_2}" $(if [ "${dialogo}" = "whiptail --fb" ] ; then echo "${init_value_percent}"; fi )
#exit_if_user_closes_window
#
exit_code="${?}"
uscita="${exit_code}"
#
reset
reset -Q
#
if [ ${uscita} -eq 0 ]
then
Expand Down Expand Up @@ -8023,20 +8019,11 @@ elif [ "${mode}" = "dialog" ]
exit 255
#
else
if [ "${dialogo}" = "zenity" -a ${uscita} -eq 5 ]
then
# Non far niente: sembra un codice di uscita di zenity legato ai temi...
:
#
else
#
#
alert_message ":( ...Something went wrong..."
echo -e "\n:( ...Something went wrong..." 1>&2
#
exit 1
#
fi
#
alert_message ":( ...Something went wrong..."
echo -e "\n:( ...Something went wrong..." 1>&2
#
exit 1
#
fi
#
Expand All @@ -8053,4 +8040,4 @@ fi
##
#
[ "${easybashgui_debug_mode}" = "YES" ] && echo "[lib SOURCED]"
[ "${easybashgui_debug_mode}" = "NO" ] && : #This is user for getting exit code = 0 :-)
[ "${easybashgui_debug_mode}" = "NO" ] && : #This is used to get exit code = 0 :-)
2 changes: 1 addition & 1 deletion lib/easybashlib
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# prevent repeated inclusion
if [ "${eb_incl_easybashlib__imported+defined}" = "defined" ]
then
echo "easybashlib: ERR: easybashlib not sourced (already sourced)."
echo "easybashlib: INFO: easybashlib not sourced (already sourced)."
return 0
fi
#
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#EBGlib=$(wildcard easybashgui_[0-9].[0-9].[0-9])
VERSION=12.0.5
VERSION=12.0.6

#cartelle di destinazione
DESTDIR ?= ""
Expand Down
2 changes: 1 addition & 1 deletion src/easybashgui
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#
#
###################################################################
MODULE_VERSION="12.0.5"
MODULE_VERSION="12.0.6"
MODULE_NAME="easybashgui"
libexec_dir="/usr/lib/easybashgui"
###################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/easybashgui-debug
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#
#
###################################################################
MODULE_VERSION="12.0.5"
MODULE_VERSION="12.0.6"
MODULE_NAME="easybashgui-debug"
###################################################################
#
Expand Down

0 comments on commit 28c6c6e

Please sign in to comment.