mirror of
https://github.com/aclist/dztui.git
synced 2024-12-28 21:32:36 +01:00
feat: backports
This commit is contained in:
parent
678f1143c5
commit
e11b743cdf
4 changed files with 90 additions and 14 deletions
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -1,10 +1,22 @@
|
|||
# Changelog
|
||||
|
||||
## [5.1.0]
|
||||
## [5.2.0] 2024-03-21
|
||||
### Added
|
||||
- Refresh player count for active row: invoke via right-click context meu or directly with the Ctrl-r hotkey. This feature has a 30 second global cooldown to prevent throttling.
|
||||
|
||||
### Fixed
|
||||
- Improve case-insensitive keyword search to be portable across awk versions (previous version required gawk)
|
||||
- Fixed a dialog string from being shown twice when adding a server to favorites via context menus
|
||||
|
||||
## [5.1.1] 2024-03-18
|
||||
### Fixed
|
||||
- Hotfix for remote helper files not being fetched correctly
|
||||
|
||||
## [5.1.0] 2024-03-18
|
||||
### Added
|
||||
- Make columns in the server browser user-resizable (affects Server Browser, My Servers, and Recent Servers)
|
||||
- Save dragged position of user-resized columns
|
||||
- Display ping to server in statusbar
|
||||
- Display ping to server in statusbar: by popular request, added the ability to visualize both distance to server and round-trip latency (ping), at the cost of a small calculation delay. Please leave feedback regarding whether this feature feels fast/responsive enough.
|
||||
|
||||
### Fixed
|
||||
- Fixed a rare scenario in Auto Mod Install Mode where defunct mods (mods no longer available on Steam) would try to be downloaded if the user had previously downloaded the mod
|
||||
|
|
9
dzgui.sh
9
dzgui.sh
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
|
||||
version=5.1.0-rc.4
|
||||
version=5.2.1.rc.1
|
||||
|
||||
#CONSTANTS
|
||||
aid=221100
|
||||
|
@ -537,10 +537,10 @@ fetch_helpers_by_sum(){
|
|||
source "$config_file"
|
||||
declare -A sums
|
||||
sums=(
|
||||
["ui.py"]="9b7fddbb8d40818b74c23b0f038ac613"
|
||||
["ui.py"]="d2e78f73933ac945d745a3d822ca89e7"
|
||||
["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197"
|
||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||
["funcs"]="a03224d2085767d8531cacb2dfb21f03"
|
||||
["funcs"]="3701877b85bc853be3f89d59fe1a6bbe"
|
||||
)
|
||||
local author="aclist"
|
||||
local repo="dztui"
|
||||
|
@ -555,6 +555,9 @@ fetch_helpers_by_sum(){
|
|||
else
|
||||
realbranch="$branch"
|
||||
fi
|
||||
if [[ $realbranch == "stable" ]]; then
|
||||
realbranch="dzgui"
|
||||
fi
|
||||
|
||||
for i in "${!sums[@]}"; do
|
||||
file="$i"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
version=5.1.0-rc.4
|
||||
version=5.2.1.rc-1
|
||||
|
||||
#CONSTANTS
|
||||
aid=221100
|
||||
|
@ -121,8 +121,20 @@ declare -A funcs=(
|
|||
["Remove from history"]="remove_from_history"
|
||||
["force_update"]="force_update"
|
||||
["Handshake"]="final_handshake"
|
||||
["get_player_count"]="get_player_count"
|
||||
)
|
||||
|
||||
get_player_count(){
|
||||
shift
|
||||
local res
|
||||
local ip="$1"
|
||||
local qport="$2"
|
||||
res=$(a2s $ip $qport info)
|
||||
[[ ! $? -eq 0 ]] && return 1
|
||||
local players="$(<<< $res jq -r '.[].players')"
|
||||
printf "%s" "$players"
|
||||
}
|
||||
|
||||
validate_and_connect(){
|
||||
local context="$1"
|
||||
local addr="$2"
|
||||
|
@ -447,7 +459,7 @@ filter_servers(){
|
|||
}
|
||||
filter_keyword(){
|
||||
keyword=$(sanitize "$keyword")
|
||||
<<< "$filtered" KEYWORD="$keyword" awk -F$separator 'BEGIN{IGNORECASE=1} $0 ~ ENVIRON["KEYWORD"] {print $0}'
|
||||
<<< "$filtered" awk -F$separator -v keyword="$keyword" 'tolower($0) ~ tolower(keyword)'
|
||||
}
|
||||
filter_duplicates(){
|
||||
if [[ ${filters[*]} =~ Duplicate ]]; then
|
||||
|
@ -787,7 +799,6 @@ update_favs_from_table(){
|
|||
echo "Removed $record from saved servers"
|
||||
else
|
||||
add_to_favs "$record"
|
||||
echo "Added $record to saved servers"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -3,10 +3,11 @@ import gi
|
|||
import json
|
||||
import locale
|
||||
import logging
|
||||
import os
|
||||
import signal
|
||||
import math
|
||||
import multiprocessing
|
||||
import os
|
||||
import re
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
|
@ -17,9 +18,11 @@ locale.setlocale(locale.LC_ALL, '')
|
|||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango
|
||||
|
||||
# 5.1.0.rc-4
|
||||
# 5.2.1.rc-1
|
||||
app_name = "DZGUI"
|
||||
|
||||
start_time = 0
|
||||
|
||||
cache = {}
|
||||
config_vals = []
|
||||
stored_keys = []
|
||||
|
@ -691,6 +694,8 @@ class TreeView(Gtk.TreeView):
|
|||
ip = addr.split(':')[0]
|
||||
record = "%s:%s" %(ip, qport)
|
||||
self.clipboard.set_text(record, -1)
|
||||
case "Refresh player count":
|
||||
self.refresh_player_count()
|
||||
case "Show server-side mods":
|
||||
record = "%s:%s" %(self.get_column_at_index(6), self.get_column_at_index(7))
|
||||
dialog = ModDialog(parent, "Enter/double click a row to open in Steam Workshop. ESC exits this dialog", "Modlist", record)
|
||||
|
@ -729,9 +734,9 @@ class TreeView(Gtk.TreeView):
|
|||
self.menu = Gtk.Menu()
|
||||
|
||||
mod_context_items = ["Open in Steam Workshop", "Delete mod"]
|
||||
subcontext_items = {"Server browser": ["Add to my servers", "Copy IP to clipboard", "Show server-side mods"],
|
||||
"My saved servers": ["Remove from my servers", "Copy IP to clipboard", "Show server-side mods"],
|
||||
"Recent servers": ["Remove from history", "Copy IP to clipboard", "Show server-side mods"],
|
||||
subcontext_items = {"Server browser": ["Add to my servers", "Copy IP to clipboard", "Show server-side mods", "Refresh player count"],
|
||||
"My saved servers": ["Remove from my servers", "Copy IP to clipboard", "Show server-side mods", "Refresh player count"],
|
||||
"Recent servers": ["Remove from history", "Copy IP to clipboard", "Show server-side mods", "Refresh player count"],
|
||||
}
|
||||
# submenu hierarchy https://stackoverflow.com/questions/52847909/how-to-add-a-sub-menu-to-a-gtk-menu
|
||||
if context == "Mod":
|
||||
|
@ -760,6 +765,22 @@ class TreeView(Gtk.TreeView):
|
|||
else:
|
||||
self.menu.popup_at_pointer(event)
|
||||
|
||||
def refresh_player_count(self):
|
||||
parent = self.get_outer_window()
|
||||
|
||||
global start_time
|
||||
then = start_time
|
||||
now = time.monotonic()
|
||||
diff = now - then
|
||||
cooldown = 30 - math.floor(diff)
|
||||
if ((start_time > 0) and (now - then) < 30):
|
||||
spawn_dialog(parent, "Global refresh cooldown not met. Wait %s second(s)." %(str(cooldown)), "NOTIFY")
|
||||
return
|
||||
start_time = now
|
||||
|
||||
thread = threading.Thread(target=self._background_player_count, args=())
|
||||
thread.start()
|
||||
|
||||
def get_outer_window(self):
|
||||
win = self.get_parent().get_parent().get_parent()
|
||||
return win
|
||||
|
@ -844,6 +865,8 @@ class TreeView(Gtk.TreeView):
|
|||
debug.set_active(True)
|
||||
case Gdk.KEY_l:
|
||||
self._on_button_release(self, event)
|
||||
case Gdk.KEY_r:
|
||||
self.refresh_player_count()
|
||||
case Gdk.KEY_f:
|
||||
if self.get_first_col() == "Mod":
|
||||
return
|
||||
|
@ -874,6 +897,32 @@ class TreeView(Gtk.TreeView):
|
|||
value = model.get_value(tree_iter, index)
|
||||
return value
|
||||
|
||||
def _background_player_count(self):
|
||||
def _load():
|
||||
server_store[path][4] = int(data.stdout)
|
||||
wait_dialog.destroy()
|
||||
|
||||
parent = self.get_outer_window()
|
||||
wait_dialog = GenericDialog(parent, "Refreshing player count", "WAIT")
|
||||
wait_dialog.show_all()
|
||||
select = self.get_selection()
|
||||
sels = select.get_selected_rows()
|
||||
(model, pathlist) = sels
|
||||
if len(pathlist) < 1:
|
||||
return
|
||||
path = pathlist[0]
|
||||
tree_iter = model.get_iter(path)
|
||||
addr = server_store[path][6]
|
||||
qport = server_store[path][7]
|
||||
ip = addr.split(':')[0]
|
||||
qport = str(qport)
|
||||
|
||||
data = call_out(self, "get_player_count", ip, qport)
|
||||
if data.returncode == 1:
|
||||
wait_dialog.destroy()
|
||||
return
|
||||
GLib.idle_add(_load)
|
||||
|
||||
def _background(self, dialog, mode):
|
||||
def loadTable():
|
||||
for map in maps:
|
||||
|
@ -1330,6 +1379,7 @@ def KeysDialog(parent, text, mode):
|
|||
Ctrl-f: jump to keyword field
|
||||
Ctrl-m: jump to maps dropdown
|
||||
Ctrl-d: toggle dry run (debug) mode
|
||||
Ctrl-r: refresh player count for active row
|
||||
1-9: toggle filter ON/OFF
|
||||
ESC: jump back to main view from keyword/maps
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue