Hopefully improve progressbars and update messages with yad.
This commit is contained in:
@@ -226,20 +226,67 @@ agm_progressbox() {
|
||||
local text="$2"
|
||||
|
||||
if [[ "$dialogType" == "yad" ]]; then
|
||||
# More accessible approach: Use a log window instead of pulsating progress
|
||||
# This shows actual command output which is more informative for screen readers
|
||||
yad --progress \
|
||||
--title="$title" \
|
||||
--text="$text" \
|
||||
--pulsate \
|
||||
--enable-log="Operation Details" \
|
||||
--log-expanded \
|
||||
--auto-close \
|
||||
--no-buttons \
|
||||
--show-cursor \
|
||||
--width=400
|
||||
--width=500 \
|
||||
--height=300
|
||||
else
|
||||
dialog --title "$title" \
|
||||
--progressbox "$text" 20 70
|
||||
fi
|
||||
}
|
||||
|
||||
# Alternative status box for simple operations without meaningful progress
|
||||
# Usage: agm_statusbox "title" "text" & statusPid=$!; command; kill $statusPid 2>/dev/null
|
||||
agm_statusbox() {
|
||||
local title="$1"
|
||||
local text="$2"
|
||||
|
||||
if [[ "$dialogType" == "yad" ]]; then
|
||||
# Show a simple status message that screen readers can access
|
||||
yad --form \
|
||||
--title="$title" \
|
||||
--field="$text:LBL" \
|
||||
--selectable-labels \
|
||||
--no-buttons \
|
||||
--timeout=0 \
|
||||
--width=400 \
|
||||
--height=100
|
||||
else
|
||||
# Use infobox for console
|
||||
dialog --title "$title" \
|
||||
--infobox "$text" 5 50
|
||||
fi
|
||||
}
|
||||
|
||||
# Real progress bar with percentage updates (for operations that can report progress)
|
||||
# Usage: agm_progress_with_percent "title" "text"
|
||||
# Then send "percentage" or "#status text" to the returned file descriptor
|
||||
agm_progress_with_percent() {
|
||||
local title="$1"
|
||||
local text="$2"
|
||||
|
||||
if [[ "$dialogType" == "yad" ]]; then
|
||||
# Create a true progress dialog that accepts percentage updates
|
||||
yad --progress \
|
||||
--title="$title" \
|
||||
--text="$text" \
|
||||
--auto-close \
|
||||
--width=400 \
|
||||
--height=150
|
||||
else
|
||||
# For dialog, we'll simulate with a gauge
|
||||
dialog --title "$title" \
|
||||
--gauge "$text" 6 50 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Wrapper function for file selection
|
||||
# Usage: agm_fselect "title" "backtitle" "default_path"
|
||||
agm_fselect() {
|
||||
|
@@ -53,9 +53,19 @@ download() {
|
||||
fi
|
||||
# Skip if the item is in cache.
|
||||
[[ -e "${cache}/${dest}" ]] && continue
|
||||
if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" 2>&1 | agm_progressbox "Audio Game Manager" "Downloading \"$dest\"..."; then
|
||||
agm_infobox "Audio Game Manager" "Audio Game Manager" "Could not download \"$dest\". Installation cannot continue."
|
||||
exit 1
|
||||
if [[ "$dialogType" == "yad" ]]; then
|
||||
# Use curl's progress bar with better accessibility for yad
|
||||
if ! curl -L4 -C - --retry 10 --progress-bar --output "${cache}/${dest}" "${i}" 2>&1 | \
|
||||
sed -u 's/.*\r\([0-9]*\)%.*/\1/' | agm_progress_with_percent "Audio Game Manager" "Downloading \"$dest\"..."; then
|
||||
agm_infobox "Audio Game Manager" "Audio Game Manager" "Could not download \"$dest\". Installation cannot continue."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Use the original method for dialog (console)
|
||||
if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" 2>&1 | agm_progressbox "Audio Game Manager" "Downloading \"$dest\"..."; then
|
||||
agm_infobox "Audio Game Manager" "Audio Game Manager" "Could not download \"$dest\". Installation cannot continue."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
local downloadError=1
|
||||
case "${dest##*.}" in
|
||||
|
Reference in New Issue
Block a user