diff --git a/dzgui.sh b/dzgui.sh index a918538..fafdccf 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=5.0.0.rc-27 +version=5.0.0.rc-28 #CONSTANTS aid=221100 @@ -536,10 +536,10 @@ fetch_dzq(){ fetch_helpers_by_sum(){ declare -A sums sums=( - ["ui.py"]="ce3940391b9c7e80eb7af190e40fae41" + ["ui.py"]="9b6c643d096c5b2e677b4eb17ec09750" ["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" - ["funcs"]="ded1276c0555577cc03cc36e9381a373" + ["funcs"]="bd5dbe82a840a25704b899e62aab0c5b" ) local author="aclist" local repo="dztui" diff --git a/helpers/funcs b/helpers/funcs index c80a851..5f8f97c 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -o pipefail -version=5.0.0.rc-27 +version=5.0.0.rc-28 #CONSTANTS aid=221100 @@ -1071,8 +1071,8 @@ focus_beta_client(){ xdotool mousemove $dim1 $dim2 xdotool click 1 - sleep 0.5s - xdotool key Tab + $steam_cmd steam://open/library 2>/dev/null 1>&2 && + $steam_cmd steam://open/console 2>/dev/null 1>&2 } auto_mod_install(){ local ip="$1" @@ -1083,10 +1083,14 @@ auto_mod_install(){ console_dl "$diff" && $steam_cmd steam://open/downloads + local total=$(<<< "$diff" wc -l) until [[ -z $(compare $diff) ]]; do local missing=$(compare $diff | wc -l) - echo "# Downloaded $((${#modids[@]}-missing)) of ${#modids[@]} mods. ESC cancels" + echo "# Downloaded $(($total-missing)) of $total mods. ESC cancels" done | $steamsafe_zenity --pulsate --progress --title="DZG Watcher" --auto-close --no-cancel --width=500 2>/dev/null + if [[ ! $? -eq 0 ]]; then + exit 7 + fi local diff=$(compare "$sanitized_mods") @@ -1116,11 +1120,11 @@ console_dl(){ done } get_local_stamps(){ - local modlist="$1" + readarray -t modlist < <(printf "%s\n" "$@") local max="${#modlist[@]}" _concat(){ for ((i=0;i<$max;i++)); do - echo "publishedfileids[$i]=${modlist[$i]}&" + printf "publishedfileids[$i]=${modlist[$i]}&" done | awk '{print}' ORS='' } _payload(){ @@ -1135,7 +1139,7 @@ get_local_stamps(){ _post } update_stamps(){ - readarray stamps <<< "$1" + readarray -t stamps <<< "$1" for((i=0;i<${#stamps[@]};i++)); do printf "%s\n" "${stamps[$i]}" >> $versions_file done @@ -1153,8 +1157,8 @@ check_timestamps(){ local aligned=$(<<< "$local_stamps" jq -r '.response.publishedfiledetails[]|"\(.publishedfileid),\(.time_updated)"') readarray -t remote_ids < <(<<< "$aligned" awk -F, '{print $1}') readarray -t remote_times < <(<<< "$aligned" awk -F, '{print $2}') - readarray -t old_ids < <(< $version_file awk -F, '{print 1}') - readarray -t old_times < <(< $version_file awk -F, '{print 2}') + readarray -t old_ids < <(< $versions_file awk -F, '{print 1}') + readarray -t old_times < <(< $versions_file awk -F, '{print 2}') if [[ ! -f $versions_file ]]; then logger INFO "No prior versions file found, creating" diff --git a/helpers/ui.py b/helpers/ui.py index 822f6d1..832b8cd 100644 --- a/helpers/ui.py +++ b/helpers/ui.py @@ -8,6 +8,7 @@ import multiprocessing import re import subprocess import sys +import textwrap import threading import time @@ -15,7 +16,7 @@ locale.setlocale(locale.LC_ALL, '') gi.require_version("Gtk", "3.0") from gi.repository import Gtk, GLib, Gdk, GObject, Pango -# 5.0.0-rc.27 +# 5.0.0-rc.28 app_name = "DZGUI" cache = {} @@ -307,6 +308,11 @@ def process_shell_return_code(transient_parent, msg, code, original_input): case 6: # return silently pass + case 7: + # catch zenity dialog cancel and rewrite message + msg = "User canceled connect process. Steam may have mods pending for download." + spawn_dialog(transient_parent, msg, "NOTIFY") + case 90: # used to update configs and metadata in-place treeview = transient_parent.grid.scrollable_treelist.treeview @@ -1198,7 +1204,7 @@ class GenericDialog(Gtk.MessageDialog): flags=0, message_type=dialog_type, text=header_text, - secondary_text=text, + secondary_text=textwrap.fill(text, 50), buttons=button_type, title=app_name, modal=True,