1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-28 21:32:36 +01:00

fix: clean up leaky dialogs

This commit is contained in:
aclist 2024-01-29 18:09:48 +09:00
parent 4beb44efa7
commit e197e07e84
3 changed files with 17 additions and 12 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -o pipefail
version=5.0.0.rc-36
version=5.0.0.rc-37
#CONSTANTS
aid=221100
@ -536,10 +536,10 @@ fetch_dzq(){
fetch_helpers_by_sum(){
declare -A sums
sums=(
["ui.py"]="4cc79aacfc87ded6989e7a7e077a9b23"
["ui.py"]="26032cc056ff1ce25660a2ca58cffc81"
["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197"
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
["funcs"]="c05444b8db8cb010909eb2763100450a"
["funcs"]="4f142d4fe883a6936f94c964dbcf0710"
)
local author="aclist"
local repo="dztui"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -o pipefail
version=5.0.0.rc-36
version=5.0.0.rc-37
#CONSTANTS
aid=221100
@ -89,7 +89,6 @@ else
steam_cmd="flatpak run com.valvesoftware.Steam"
fi
#TODO: dump servers methods can be merged
declare -A funcs=(
["My servers"]="dump_servers"
["Change player name"]="update_config_val"
@ -774,8 +773,10 @@ update_favs_from_table(){
local record="$2"
if [[ $context =~ Remove ]]; then
remove_from_favs "$record"
echo "Removed $record from saved servers"
else
add_to_favs "$record"
echo "Added $record to saved servers"
fi
return 0
}
@ -837,6 +838,7 @@ update_config_val(){
declare -n nr=$key
nr="$value"
update_config
echo "Updated the key '$key' to '$value'"
return 90
}
show_log(){
@ -1163,7 +1165,7 @@ check_timestamps(){
logger INFO "No prior versions file found, creating"
update_stamps "$aligned"
#force refresh all mods if versions file was missing
printf "%s\n" "${remote_ids[$@]}"
printf "%s\n" "${remote_ids[@]}"
return 0
fi

View file

@ -16,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.36
# 5.0.0-rc.37
app_name = "DZGUI"
cache = {}
@ -134,7 +134,7 @@ status_tooltip = {
"Server browser": "Used to browse the global server list",
"My saved servers": "Browse your saved servers",
"Quick-connect to favorite server": "Connect to your favorite server",
"Recent servers": "Shows the last 10 servers you connected to",
"Recent servers": "Shows the last 10 servers you connected to (includes attempts)",
"Connect by IP": "Connect to a server by IP",
"Connect by ID": "Connect to a server by Battlemetrics ID",
"Add server by IP": "Add a server by IP",
@ -341,7 +341,8 @@ def process_tree_option(input, treeview):
def _background(subproc, args, dialog):
def _load():
wait_dialog.destroy()
msg = proc.stdout
out = proc.stdout.splitlines()
msg = out[-1]
rc = proc.returncode
logger.info("Subprocess returned code %s with message '%s'" %(rc, msg))
process_shell_return_code(transient_parent, msg, rc, input)
@ -356,7 +357,8 @@ def process_tree_option(input, treeview):
# False is used to bypass wait dialogs
proc = call_out(transient_parent, subproc, args)
rc = proc.returncode
msg = proc.stdout
out = proc.stdout.splitlines()
msg = out[-1]
process_shell_return_code(transient_parent, msg, rc, input)
@ -667,11 +669,12 @@ class TreeView(Gtk.TreeView):
match context_menu_label:
case "Add to my servers" | "Remove from favorites":
record = "%s:%s" %(self.get_column_at_index(6), self.get_column_at_index(7))
call_out(parent, context_menu_label, record)
proc = call_out(parent, context_menu_label, record)
if context == "Name (My saved servers)":
iter = self.get_current_iter()
server_store.remove(iter)
res = spawn_dialog(parent, "Added %s to favorites" %(record), "NOTIFY")
msg = proc.stdout
res = spawn_dialog(parent, msg, "NOTIFY")
case "Remove from history":
record = "%s:%s" %(self.get_column_at_index(6), self.get_column_at_index(7))
call_out(parent, context_menu_label, record)