mirror of
https://github.com/femtofox/femtofox.git
synced 2026-10-26 19:02:00 -04:00
Add helptext support to menus
This commit is contained in:
parent
9c24f93fe2
commit
db2c49a268
2 changed files with 118 additions and 115 deletions
|
|
@ -25,3 +25,6 @@ form_text_color = (WHITE,CYAN,ON)
|
|||
|
||||
# Readonly form item color
|
||||
form_item_readonly_color = (BLUE,WHITE,ON)
|
||||
|
||||
# Item help-text color
|
||||
itemhelp_color = (BLACK,BLUE,OFF)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ wifi_config() {
|
|||
wifi_psk=$(echo "$config" | sed -n '2p')
|
||||
wifi_country=$(echo "$config" | sed -n '3p')
|
||||
|
||||
cmd="femto-network-config.sh -s \"$wifi_ssid\" -p \"$wifi_psk\""
|
||||
cmd="femto-network-config.sh -s \"$wifi_ssid\" -p \"$wifi_psk\"" # build the wifi setting command to send to the network config script
|
||||
[ -n "$wifi_country" ] && cmd="$cmd -c \"$wifi_country\""
|
||||
cmd="$cmd -r"
|
||||
if [ -z "$wifi_ssid" ]; then
|
||||
|
|
@ -113,16 +113,16 @@ networking_settings() {
|
|||
wpa_supplicant_conf="/etc/wpa_supplicant/wpa_supplicant.conf"
|
||||
choice="" # zero the choice before loading the submenu
|
||||
while true; do
|
||||
networking_choice=$(dialog --no-collapse --cancel-label "Back" --backtitle "IPv4 address: $(femto-network-config.sh -i)" --default-item "$networking_choice" --title "$title" --menu "" 16 40 4 \
|
||||
1 "Turn Wi-Fi on/off" \
|
||||
2 "View Wi-Fi settings" \
|
||||
3 "Change Wi-Fi settings" \
|
||||
4 "View ethernet settings" \
|
||||
5 "Restart networking" \
|
||||
6 "Set hostname" \
|
||||
7 "Test internet connection" \
|
||||
" " "" \
|
||||
8 "Back to main menu" 3>&1 1>&2 2>&3)
|
||||
networking_choice=$(dialog --no-collapse --cancel-label "Back" --backtitle "IPv4 address: $(femto-network-config.sh -i)" --default-item "$networking_choice" --title "$title" --item-help --menu "" 16 40 4 \
|
||||
1 "Turn Wi-Fi on/off" "" \
|
||||
2 "View Wi-Fi settings" "" \
|
||||
3 "Change Wi-Fi settings" "" \
|
||||
4 "View ethernet settings" "" \
|
||||
5 "Restart networking" "" \
|
||||
6 "Set hostname" "" \
|
||||
7 "Test internet connection" "" \
|
||||
" " "" "" \
|
||||
8 "Back to main menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $networking_choice in
|
||||
1) # Turn Wi-Fi on/off)
|
||||
|
|
@ -130,11 +130,11 @@ networking_settings() {
|
|||
dialog --no-collapse --colors --msgbox "\Z1Network adapter wlan0 does not exist.\Zn\n\nIs a Wi-Fi adapter connected?" 8 40
|
||||
else
|
||||
while true; do
|
||||
choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Enable/disable Wi-Fi" --menu "Tip: Wi-Fi can also be toggled by short-pressing the BOOT button on the Luckfox." 13 50 5 \
|
||||
1 "Turn Wi-Fi on" \
|
||||
2 "Turn Wi-Fi off" \
|
||||
" " "" \
|
||||
3 "Return to previous menu" 3>&1 1>&2 2>&3)
|
||||
choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Enable/disable Wi-Fi" --item-help --menu "Tip: Wi-Fi can also be toggled by short-pressing the BOOT button on the Luckfox." 13 50 5 \
|
||||
1 "Turn Wi-Fi on" "" \
|
||||
2 "Turn Wi-Fi off" "" \
|
||||
" " "" "" \
|
||||
3 "Return to previous menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $choice in
|
||||
1) femto-network-config.sh -x "up" && break ;;
|
||||
|
|
@ -162,7 +162,7 @@ networking_settings() {
|
|||
fi
|
||||
;;
|
||||
6) # set hostname)
|
||||
new_hostname=$(dialog --no-collapse --title "$title" --inputbox "Enter new hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3)
|
||||
new_hostname=$(dialog --no-collapse --title "$title" --max-input 253 --inputbox "Enter new hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3)
|
||||
if [ $? -eq 0 ]; then #unless cancel/no
|
||||
femto-network-config.sh -n "$new_hostname"
|
||||
dialog --no-collapse --title "$title" --msgbox "Femtofox is now reachable at\n$new_hostname.local" 8 40
|
||||
|
|
@ -183,36 +183,36 @@ networking_settings() {
|
|||
utilities() {
|
||||
local title="Utilities & Tools"
|
||||
while true; do
|
||||
utilities_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$utilities_choice" --menu "$title" 21 50 4 \
|
||||
1 "View system info" \
|
||||
2 "Set system time" \
|
||||
3 "Kernel modules" \
|
||||
4 "Re-run first-boot script" \
|
||||
5 "Run USB configuration tool" \
|
||||
6 "Run OEM luckfox-config" \
|
||||
7 "Process viewer/manager" \
|
||||
8 "Disable/enable logging" \
|
||||
9 "Disable/enable activity LED" \
|
||||
10 "Reboot" \
|
||||
11 "Shutdown" \
|
||||
" " "" \
|
||||
12 "Back to main menu" 3>&1 1>&2 2>&3)
|
||||
utilities_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$utilities_choice" --item-help --menu "$title" 21 50 4 \
|
||||
1 "View system info" "" \
|
||||
2 "Set system time" "" \
|
||||
3 "Kernel modules" "" \
|
||||
4 "Re-run first-boot script" "" \
|
||||
5 "Run USB configuration tool" "" \
|
||||
6 "Run OEM luckfox-config" "" \
|
||||
7 "Process viewer/manager" "" \
|
||||
8 "Disable/enable logging" "" \
|
||||
9 "Disable/enable activity LED" "" \
|
||||
10 "Reboot" "" \
|
||||
11 "Shutdown" "" \
|
||||
" " "" "" \
|
||||
12 "Back to main menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
|
||||
case $utilities_choice in
|
||||
1) #sysinfo)
|
||||
choice="" # zero the choice before loading the submenu
|
||||
while true; do
|
||||
choice=$(dialog --no-collapse --help-button --help-label "Help" --cancel-label "Back" --default-item "$choice" --menu "System info" 16 40 5 \
|
||||
1 "CPU" \
|
||||
2 "Operating system" \
|
||||
3 "Storage & memory" \
|
||||
4 "Peripherals & devices" \
|
||||
5 "Networking" \
|
||||
6 "Meshtastic node info" \
|
||||
7 "Complete system info" \
|
||||
" " "" \
|
||||
8 "Back to previous menu" 3>&1 1>&2 2>&3)
|
||||
choice=$(dialog --no-collapse --help-button --help-label "Help" --cancel-label "Back" --default-item "$choice" --item-help --menu "System info" 17 40 5 \
|
||||
1 "CPU" "" \
|
||||
2 "Operating system" "" \
|
||||
3 "Storage & memory" "" \
|
||||
4 "Peripherals & devices" ""\
|
||||
5 "Networking" "" \
|
||||
6 "Meshtastic node info" "" \
|
||||
7 "Complete system info" "" \
|
||||
" " "" "" \
|
||||
8 "Back to previous menu" "" 3>&1 1>&2 2>&3)
|
||||
exit_status=$? # This line checks the exit status of the dialog command
|
||||
if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
break
|
||||
|
|
@ -289,11 +289,11 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0
|
|||
8) # logging)
|
||||
choice="" # zero the choice before loading the submenu
|
||||
while true; do
|
||||
choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(replace_colors "$(femto-utils.sh -l "check")")" 14 50 2 \
|
||||
1 "Enable (default)" \
|
||||
2 "Disable" \
|
||||
" " "" \
|
||||
3 "Return to previous menu" 3>&1 1>&2 2>&3)
|
||||
choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(replace_colors "$(femto-utils.sh -l "check")")" 14 50 2 \
|
||||
1 "Enable (default)" "" \
|
||||
2 "Disable" "" \
|
||||
" " "" "" \
|
||||
3 "Return to previous menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $choice in
|
||||
1) femto-utils.sh -l "enable" ;;
|
||||
|
|
@ -305,11 +305,11 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0
|
|||
9) # logging)
|
||||
choice="" # zero the choice before loading the submenu
|
||||
while true; do
|
||||
choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(replace_colors "$(femto-utils.sh -a "check")")" 14 50 2 \
|
||||
1 "Enable (default)" \
|
||||
2 "Disable" \
|
||||
" " "" \
|
||||
3 "Return to previous menu" 3>&1 1>&2 2>&3)
|
||||
choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(replace_colors "$(femto-utils.sh -a "check")")" 14 50 2 \
|
||||
1 "Enable (default)" "" \
|
||||
2 "Disable" "" \
|
||||
" " "" "" \
|
||||
3 "Return to previous menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $choice in
|
||||
1) femto-utils.sh -a "enable" ;;
|
||||
|
|
@ -343,17 +343,17 @@ set_lora_radio() {
|
|||
while true; do
|
||||
echo "Checking LoRa radio..."
|
||||
#Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -))
|
||||
choice=$(dialog --no-collapse --colors --cancel-label "Back" --default-item "$choice" --title "Meshtastic LoRa radio" --menu "Currently configured LoRa radio:\n$(replace_colors "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 19 50 10 \
|
||||
"Ebyte e22-900m30s" "(SX1262_TCXO)" \
|
||||
"Ebyte e22-900m22s" "(SX1262_TCXO)"\
|
||||
"Ebyte e80-900m22s" "(SX1262_XTAL)"\
|
||||
"Heltec ht-ra62" "(SX1262_TCXO)"\
|
||||
"Seeed wio-sx1262" "(SX1262_TCXO)"\
|
||||
"Waveshare sx126x-xxxm" "(SX1262_XTAL)"\
|
||||
"AI Thinker ra-01sh" "(SX1262_XTAL)"\
|
||||
"None" "(simulated radio)"\
|
||||
" " "" \
|
||||
"Skip" "" 3>&1 1>&2 2>&3)
|
||||
choice=$(dialog --no-collapse --colors --cancel-label "Back" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(replace_colors "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 19 50 10 \
|
||||
"Ebyte e22-900m30s" "(SX1262_TCXO)" "" \
|
||||
"Ebyte e22-900m22s" "(SX1262_TCXO)" "" \
|
||||
"Ebyte e80-900m22s" "(SX1262_XTAL)" "" \
|
||||
"Heltec ht-ra62" "(SX1262_TCXO)" "" \
|
||||
"Seeed wio-sx1262" "(SX1262_TCXO)" "" \
|
||||
"Waveshare sx126x-xxxm" "(SX1262_XTAL)" "" \
|
||||
"AI Thinker ra-01sh" "(SX1262_XTAL)" "" \
|
||||
"None" "(simulated radio)" "" \
|
||||
" " "" "" \
|
||||
"Skip" "" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
local radio=""
|
||||
case $choice in
|
||||
|
|
@ -397,18 +397,18 @@ meshtastic_settings() {
|
|||
local title="Meshtastic Settings"
|
||||
while true; do
|
||||
echo "Checking Meshtasticd service state..."
|
||||
meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --menu "Meshtasticd service is $(replace_colors "$(femto-meshtasticd-config.sh -S)")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \
|
||||
1 "View node info" \
|
||||
2 "View configuration URL & QR code" \
|
||||
3 "Set new configuration URL" \
|
||||
4 "Set LoRa radio" \
|
||||
5 "Security settings" \
|
||||
6 "Mesh connectivity test" \
|
||||
7 "Manage Meshtasticd service" \
|
||||
8 "Upgrade/install Meshtasticd" \
|
||||
9 "Uninstall Meshtasticd" \
|
||||
" " "" \
|
||||
10 "Back to main menu" 3>&1 1>&2 2>&3)
|
||||
meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(replace_colors "$(femto-meshtasticd-config.sh -S)")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 20 50 4 \
|
||||
1 "View node info" "" \
|
||||
2 "View configuration URL & QR code" "" \
|
||||
3 "Set new configuration URL" "" \
|
||||
4 "Set LoRa radio" "" \
|
||||
5 "Security settings" "" \
|
||||
6 "Mesh connectivity test" "" \
|
||||
7 "Manage Meshtasticd service" "" \
|
||||
8 "Upgrade/install Meshtasticd" "" \
|
||||
9 "Uninstall Meshtasticd" "" \
|
||||
" " "" "" \
|
||||
10 "Back to main menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $meshtastic_choice in
|
||||
1) # view node info)
|
||||
|
|
@ -436,16 +436,16 @@ meshtastic_settings() {
|
|||
5) # remote admin)
|
||||
choice="" # zero the choice before loading the submenu
|
||||
while true; do
|
||||
choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Meshtastic Security Settings" --menu "" 16 40 5 \
|
||||
1 "View/change public key" \
|
||||
2 "View/change private key" \
|
||||
" " "" \
|
||||
3 "View admin keys" \
|
||||
4 "Set admin key" \
|
||||
5 "Clear admin keys" \
|
||||
6 "Legacy admin channel" \
|
||||
" " "" \
|
||||
7 "Return to previous menu" 3>&1 1>&2 2>&3)
|
||||
choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Meshtastic Security Settings" --item-help --menu "" 16 40 5 \
|
||||
1 "View/change public key" "" \
|
||||
2 "View/change private key" "" \
|
||||
" " "" "" \
|
||||
3 "View admin keys" "" \
|
||||
4 "Set admin key" "" \
|
||||
5 "Clear admin keys" "" \
|
||||
6 "Legacy admin channel" "" \
|
||||
" " "" "" \
|
||||
7 "Return to previous menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $choice in
|
||||
1) # view/change public key)
|
||||
|
|
@ -502,11 +502,11 @@ meshtastic_settings() {
|
|||
choice="" # zero the choice before loading the submenu
|
||||
while true; do
|
||||
loading "Getting current legacy admin state..."
|
||||
choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --menu "Current state: $(replace_colors "$(femto-meshtasticd-config.sh -p)")" 12 40 5 \
|
||||
1 "Enable" \
|
||||
2 "Disable (default)" \
|
||||
" " "" \
|
||||
3 "Return to previous menu" 3>&1 1>&2 2>&3)
|
||||
choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --item-help --menu "Current state: $(replace_colors "$(femto-meshtasticd-config.sh -p)")" 12 40 5 \
|
||||
1 "Enable" "" \
|
||||
2 "Disable (default)" "" \
|
||||
" " "" "" \
|
||||
3 "Return to previous menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $choice in
|
||||
1) # enable legacy admin)
|
||||
|
|
@ -618,16 +618,16 @@ meshtastic_settings() {
|
|||
help_menu() {
|
||||
while true; do
|
||||
local title="Help / About"
|
||||
help_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$help_choice" --menu "$title" 0 0 7 \
|
||||
1 "About Femtofox" \
|
||||
2 "Display pinout" \
|
||||
3 "Femtofox licensing info - short" \
|
||||
4 "Femtofox licensing info - long" \
|
||||
5 "Meshtastic licensing info" \
|
||||
6 "About Luckfox" \
|
||||
7 "About Ubuntu" \
|
||||
" " "" \
|
||||
8 "Back to main menu" 3>&1 1>&2 2>&3)
|
||||
help_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$help_choice" --item-help --menu "$title" 0 0 7 \
|
||||
1 "About Femtofox" "" \
|
||||
2 "Display pinout" "" \
|
||||
3 "Femtofox licensing info - short" "" \
|
||||
4 "Femtofox licensing info - long" "" \
|
||||
5 "Meshtastic licensing info" "" \
|
||||
6 "About Luckfox" "" \
|
||||
7 "About Ubuntu" "" \
|
||||
" " "" "" \
|
||||
8 "Back to main menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $help_choice in
|
||||
1) #About Femtofox)
|
||||
|
|
@ -636,13 +636,13 @@ help_menu() {
|
|||
2) #Display pinout)
|
||||
choice="" # zero the choice before loading the submenu
|
||||
while true; do
|
||||
choice=$(dialog --no-collapse --cancel-label "Back" --menu "Pinouts" 15 40 5 \
|
||||
1 "Femtofox Pro/CE" \
|
||||
2 "Femtofox Zero" \
|
||||
3 "Femtofox Tiny" \
|
||||
4 "Luckfox Pico Mini" \
|
||||
" " "" \
|
||||
5 "Back to Help Menu" 3>&1 1>&2 2>&3)
|
||||
choice=$(dialog --no-collapse --cancel-label "Back" --item-help --menu "Pinouts" 15 40 5 \
|
||||
1 "Femtofox Pro/CE" "" \
|
||||
2 "Femtofox Zero" "" \
|
||||
3 "Femtofox Tiny" "" \
|
||||
4 "Luckfox Pico Mini" "" \
|
||||
" " "" "" \
|
||||
5 "Back to Help Menu" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $choice in
|
||||
1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 43 68 ;;
|
||||
|
|
@ -704,15 +704,15 @@ done
|
|||
|
||||
# Main menu
|
||||
while true; do
|
||||
main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --default-item "$main_menu_choice" --menu "Femtofox Config" 16 40 5 \
|
||||
1 "Settings wizard" \
|
||||
2 "Networking" \
|
||||
3 "Meshtastic" \
|
||||
4 "Software manager" \
|
||||
5 "Utilities & tools" \
|
||||
6 "Help" \
|
||||
" " "" \
|
||||
7 "Exit" 3>&1 1>&2 2>&3)
|
||||
main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --default-item "$main_menu_choice" --item-help --menu "Femtofox Config" 16 40 5 \
|
||||
1 "Settings wizard" "" \
|
||||
2 "Networking" "" \
|
||||
3 "Meshtastic" "" \
|
||||
4 "Software manager" "" \
|
||||
5 "Utilities & tools" "" \
|
||||
6 "Help" "" \
|
||||
" " "" "" \
|
||||
7 "Exit" "" 3>&1 1>&2 2>&3)
|
||||
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
|
||||
case $main_menu_choice in
|
||||
1) femto-install-wizard.sh ;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue