Skip to content

Commit

Permalink
[tui] Use variables instead, closes #54
Browse files Browse the repository at this point in the history
Use TUI_WINDOW_HEIGHT and TUI_WINDOW_WIDTH variables instead
of hardcoded values.

Height has been increased as well to 35.
  • Loading branch information
goldyfruit committed Feb 18, 2024
1 parent b3d9366 commit 1191ad9
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tui/channels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ whiptail_args=(
--cancel-button "$CANCEL_BUTTON"
--ok-button "$OK_BUTTON"
--yes-button "$OK_BUTTON"
25 80 "${#available_channels[@]}"
"$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH" "${#available_channels[@]}"
)

for channel in "${available_channels[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion tui/detection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# shellcheck source=locales/en-us/detection.sh
source "tui/locales/$LOCALE/detection.sh"

whiptail --msgbox --ok-button "$OK_BUTTON" --title "$TITLE" "$CONTENT" 25 80
whiptail --msgbox --ok-button "$OK_BUTTON" --title "$TITLE" "$CONTENT" "$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH"
2 changes: 1 addition & 1 deletion tui/features.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [[ "$RASPBERRYPI_MODEL" != *"Raspberry Pi 3"* ]] && [[ "$KERNEL" != *"microso
fi

OVOS_FEATURES=$(whiptail --separate-output --title "$TITLE" \
--checklist "$CONTENT" --cancel-button "$CANCEL_BUTTON" --ok-button "$OK_BUTTON" --yes-button "$OK_BUTTON" 25 80 "${#features[@]}" "${features[@]}" 3>&1 1>&2 2>&3)
--checklist "$CONTENT" --cancel-button "$CANCEL_BUTTON" --ok-button "$OK_BUTTON" --yes-button "$OK_BUTTON" "$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH" "${#features[@]}" "${features[@]}" 3>&1 1>&2 2>&3)

for FEATURE in $OVOS_FEATURES; do
case "$FEATURE" in
Expand Down
2 changes: 1 addition & 1 deletion tui/finish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export CONFIG_FILE
# shellcheck source=locales/en-us/finish.sh
source "tui/locales/$LOCALE/finish.sh"

whiptail --msgbox --ok-button "$OK_BUTTON" --title "$TITLE" "$CONTENT" 25 80
whiptail --msgbox --ok-button "$OK_BUTTON" --title "$TITLE" "$CONTENT" "$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH"
2 changes: 1 addition & 1 deletion tui/language.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ whiptail_args=(
--title "Open Voice OS Installation - Language"
--radiolist "$message"
--cancel-button "Exit"
25 80 "${#available_languages[@]}"
"$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH" "${#available_languages[@]}"
)

for language in "${available_languages[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion tui/methods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ whiptail_args=(
--cancel-button "$CANCEL_BUTTON"
--ok-button "$OK_BUTTON"
--yes-button "$OK_BUTTON"
25 80 "${#available_methods[@]}"
"$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH" "${#available_methods[@]}"
)

for method in "${available_methods[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion tui/profiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ whiptail_args=(
--cancel-button "$CANCEL_BUTTON"
--ok-button "$OK_BUTTON"
--yes-button "$OK_BUTTON"
25 80 "${#available_profiles[@]}"
"$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH" "${#available_profiles[@]}"
)

for method in "${available_profiles[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion tui/summary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# shellcheck source=locales/en-us/summary.sh
source "tui/locales/$LOCALE/summary.sh"

whiptail --yesno --defaultno --no-button "$NO_BUTTON" --yes-button "$YES_BUTTON" --title "$TITLE" "$CONTENT" 25 80
whiptail --yesno --defaultno --no-button "$NO_BUTTON" --yes-button "$YES_BUTTON" --title "$TITLE" "$CONTENT" "$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH"

exit_status=$?
if [ "$exit_status" -eq 1 ]; then
Expand Down
2 changes: 1 addition & 1 deletion tui/telemetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export SHARE_TELEMETRY="true"
# shellcheck source=locales/en-us/telemetry.sh
source "tui/locales/$LOCALE/telemetry.sh"

whiptail --yesno --no-button "$NO_BUTTON" --yes-button "$YES_BUTTON" --title "$TITLE" "$CONTENT" 25 80
whiptail --yesno --no-button "$NO_BUTTON" --yes-button "$YES_BUTTON" --title "$TITLE" "$CONTENT" "$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH"

exit_status=$?
if [ "$exit_status" -eq 1 ]; then
Expand Down
2 changes: 1 addition & 1 deletion tui/tuning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ whiptail_args=(
--cancel-button "$CANCEL_BUTTON"
--ok-button "$OK_BUTTON"
--yes-button "$OK_BUTTON"
25 80 "${#available_options[@]}"
"$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH" "${#available_options[@]}"
)

for option in "${available_options[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion tui/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source "tui/locales/$LOCALE/misc.sh"
# shellcheck source=locales/en-us/uninstall.sh
source "tui/locales/$LOCALE/uninstall.sh"

whiptail --yesno --defaultno --no-button "$NO_BUTTON" --yes-button "$YES_BUTTON" --title "$TITLE" "$CONTENT" 25 80
whiptail --yesno --defaultno --no-button "$NO_BUTTON" --yes-button "$YES_BUTTON" --title "$TITLE" "$CONTENT" "$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH"

exit_status=$?
if [ "$exit_status" -eq 1 ]; then
Expand Down
2 changes: 1 addition & 1 deletion tui/welcome.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# shellcheck source=locales/en-us/welcome.sh
source "tui/locales/$LOCALE/welcome.sh"

whiptail --msgbox --ok-button "$OK_BUTTON" --title "${TITLE}" "$CONTENT" 25 80
whiptail --msgbox --ok-button "$OK_BUTTON" --title "${TITLE}" "$CONTENT" "$TUI_WINDOW_HEIGHT" "$TUI_WINDOW_WIDTH"
2 changes: 2 additions & 0 deletions utils/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ declare -a SCENARIO_ALLOWED_HIVEMIND_OPTIONS=(host port key password)
export SCENARIO_ALLOWED_HIVEMIND_OPTIONS
export SCENARIO_NAME="scenario.yaml"
export SCENARIO_PATH=""
export TUI_WINDOW_HEIGHT="35"
export TUI_WINDOW_WIDTH="80"
export USER_ID="$EUID"
export WSL_FILE=/etc/wsl.conf
export YQ_BINARY_PATH=/tmp/yq
Expand Down

0 comments on commit 1191ad9

Please sign in to comment.