mirror of
https://github.com/aclist/dztui.git
synced 2026-08-25 17:32:36 +02:00
Merge pull request #239 from aclist/prerelease/6.0.1-beta.1
fix: UI not starting if changelog was missing
This commit is contained in:
commit
a3092b1bf3
23
CHANGELOG.md
23
CHANGELOG.md
@ -1,5 +1,28 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [6.0.1-beta.4] 2025-11-14
|
||||||
|
## Changed
|
||||||
|
- Require Python 3.13
|
||||||
|
|
||||||
|
## [6.0.1-beta.3] 2025-11-13
|
||||||
|
## Added
|
||||||
|
- Support sandboxed flatpak
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- Preferred client from radio toggle to combobox
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Config file erroneously getting updated when populating settings menu
|
||||||
|
|
||||||
|
## [6.0.1-beta.2] 2025-11-10
|
||||||
|
## Fixed
|
||||||
|
- Python 3.14 error in finally block
|
||||||
|
- Require Python version between 3.11 and 3.12
|
||||||
|
|
||||||
|
## [6.0.1-beta.1] 2025-11-05
|
||||||
|
## Fixed
|
||||||
|
- UI not being constructed correctly if CHANGELOG.md was missing
|
||||||
|
|
||||||
## [6.0.0-beta.8] 2025-11-04
|
## [6.0.0-beta.8] 2025-11-04
|
||||||
## Added
|
## Added
|
||||||
- Internal flag to allow distribution packaged releases to disable in-app updates
|
- Internal flag to allow distribution packaged releases to disable in-app updates
|
||||||
|
|||||||
45
dzgui.sh
45
dzgui.sh
@ -1,7 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
version=6.0.0.beta-8
|
src_path=$(realpath "$0")
|
||||||
|
|
||||||
|
version=6.0.1.beta-4
|
||||||
|
|
||||||
#CONSTANTS
|
#CONSTANTS
|
||||||
aid=221100
|
aid=221100
|
||||||
@ -136,7 +138,7 @@ print_config_vals(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
test_gobject(){
|
test_gobject(){
|
||||||
python3 -c "import gi"
|
python3.13 -c "import gi"
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
logger CRITICAL "Missing PyGObject"
|
logger CRITICAL "Missing PyGObject"
|
||||||
fdialog "Requires PyGObject (python-gobject)"
|
fdialog "Requires PyGObject (python-gobject)"
|
||||||
@ -218,9 +220,6 @@ default_steam_path="$default_steam_path"
|
|||||||
|
|
||||||
#Preferred Steam launch command (for Flatpak support)
|
#Preferred Steam launch command (for Flatpak support)
|
||||||
preferred_client="$preferred_client"
|
preferred_client="$preferred_client"
|
||||||
|
|
||||||
#DZGUI source path
|
|
||||||
src_path="$src_path"
|
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
depcheck(){
|
depcheck(){
|
||||||
@ -237,13 +236,10 @@ depcheck(){
|
|||||||
logger INFO "Initial dependencies satisfied"
|
logger INFO "Initial dependencies satisfied"
|
||||||
}
|
}
|
||||||
check_pyver(){
|
check_pyver(){
|
||||||
local pyver=$(python3 --version | awk '{print $2}')
|
if [[ ! $(command -v python3.13) ]]; then
|
||||||
local minor=$(<<< $pyver awk -F. '{print $2}')
|
local msg="Requires Python 3.13"
|
||||||
if [[ -z $pyver ]] || [[ ${pyver:0:1} -lt 3 ]] || [[ $minor -lt 10 ]]; then
|
|
||||||
local msg="Requires Python >=3.10"
|
|
||||||
raise_error_and_quit "$msg"
|
raise_error_and_quit "$msg"
|
||||||
fi
|
fi
|
||||||
logger INFO "Found Python version: $pyver"
|
|
||||||
}
|
}
|
||||||
watcher_deps(){
|
watcher_deps(){
|
||||||
if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then
|
if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then
|
||||||
@ -317,6 +313,7 @@ check_unmerged(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_version(){
|
check_version(){
|
||||||
|
[[ -n $reference_branch ]] && return
|
||||||
local version_url=$(format_version_url)
|
local version_url=$(format_version_url)
|
||||||
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
||||||
local res=$(get_response_code "$version_url")
|
local res=$(get_response_code "$version_url")
|
||||||
@ -467,18 +464,7 @@ steam_deps(){
|
|||||||
local msg="Found neither Steam nor Flatpak Steam"
|
local msg="Found neither Steam nor Flatpak Steam"
|
||||||
raise_error_and_quit "$msg"
|
raise_error_and_quit "$msg"
|
||||||
exit 1
|
exit 1
|
||||||
elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then
|
|
||||||
[[ -n $preferred_client ]] && return 0
|
|
||||||
if [[ -z $preferred_client ]]; then
|
|
||||||
preferred_client="steam"
|
|
||||||
fi
|
fi
|
||||||
elif [[ -n "$steam" ]]; then
|
|
||||||
preferred_client="steam"
|
|
||||||
else
|
|
||||||
preferred_client="flatpak"
|
|
||||||
fi
|
|
||||||
update_config
|
|
||||||
logger INFO "Preferred client set to '$preferred_client'"
|
|
||||||
}
|
}
|
||||||
migrate_files(){
|
migrate_files(){
|
||||||
if [[ ! -f $config_path/dztuirc.oldapi ]]; then
|
if [[ ! -f $config_path/dztuirc.oldapi ]]; then
|
||||||
@ -615,10 +601,10 @@ fetch_helpers_by_sum(){
|
|||||||
[[ -f "$config_file" ]] && source "$config_file"
|
[[ -f "$config_file" ]] && source "$config_file"
|
||||||
declare -A sums
|
declare -A sums
|
||||||
sums=(
|
sums=(
|
||||||
["funcs"]="6ae3ead7034dc8e7543472bddee75c63"
|
["funcs"]="39fa4c302a508f63dcfe5ca3cff9bc01"
|
||||||
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
||||||
["servers.py"]="ed442c3aecf33f777d59dcf53650d263"
|
["servers.py"]="ed442c3aecf33f777d59dcf53650d263"
|
||||||
["ui.py"]="8d05bbd7b8e15a97fae568e9a3dbf4d6"
|
["ui.py"]="2276386252bd571b3505cbbc74359732"
|
||||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||||
["pefile.py"]="21531f2c0d9dfa5f110cf6779f9d22c0"
|
["pefile.py"]="21531f2c0d9dfa5f110cf6779f9d22c0"
|
||||||
)
|
)
|
||||||
@ -639,6 +625,10 @@ fetch_helpers_by_sum(){
|
|||||||
realbranch="dzgui"
|
realbranch="dzgui"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n $reference_branch ]]; then
|
||||||
|
realbranch="$reference_branch"
|
||||||
|
fi
|
||||||
|
|
||||||
for i in "${!sums[@]}"; do
|
for i in "${!sums[@]}"; do
|
||||||
file="$i"
|
file="$i"
|
||||||
sum="${sums[$i]}"
|
sum="${sums[$i]}"
|
||||||
@ -881,7 +871,7 @@ file_picker(){
|
|||||||
}
|
}
|
||||||
find_library_folder(){
|
find_library_folder(){
|
||||||
local search_path="$1"
|
local search_path="$1"
|
||||||
steam_path="$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" \
|
steam_path="$(python3.13 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" \
|
||||||
| jq -r '.libraryfolders[]|select(.apps|has("221100")).path')"
|
| jq -r '.libraryfolders[]|select(.apps|has("221100")).path')"
|
||||||
if [[ ! $? -eq 0 ]] || [[ -z $steam_path ]]; then
|
if [[ ! $? -eq 0 ]] || [[ -z $steam_path ]]; then
|
||||||
logger WARN "Failed to parse Steam path using '$search_path'"
|
logger WARN "Failed to parse Steam path using '$search_path'"
|
||||||
@ -895,6 +885,7 @@ create_config(){
|
|||||||
unset default_steam_path
|
unset default_steam_path
|
||||||
unset steam_path
|
unset steam_path
|
||||||
|
|
||||||
|
preferred_client="steam"
|
||||||
while true; do
|
while true; do
|
||||||
local player_input="$($steamsafe_zenity \
|
local player_input="$($steamsafe_zenity \
|
||||||
--forms \
|
--forms \
|
||||||
@ -979,10 +970,6 @@ varcheck(){
|
|||||||
create_config
|
create_config
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [[ $src_path != $(realpath "$0") ]]; then
|
|
||||||
src_path=$(realpath "$0")
|
|
||||||
update_config
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
is_dzg_downloading(){
|
is_dzg_downloading(){
|
||||||
if [[ -d $steam_path ]] && [[ -d $steam_path/downloading/$aid ]]; then
|
if [[ -d $steam_path ]] && [[ -d $steam_path/downloading/$aid ]]; then
|
||||||
@ -1182,7 +1169,7 @@ main(){
|
|||||||
initial_setup
|
initial_setup
|
||||||
|
|
||||||
printf "All OK. Kicking off UI...\n"
|
printf "All OK. Kicking off UI...\n"
|
||||||
python3 "$ui_helper" "--init-ui" "$version" "$is_steam_deck"
|
python3.13 "$ui_helper" "--init-ui" "$version" "$is_steam_deck"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
version="6.0.0-beta.8"
|
version="6.0.1-beta.4"
|
||||||
|
|
||||||
#CONSTANTS
|
#CONSTANTS
|
||||||
aid=221100
|
aid=221100
|
||||||
@ -87,17 +87,14 @@ steam_api_url="https://steamcommunity.com/dev/apikey"
|
|||||||
battlemetrics_api_url="https://www.battlemetrics.com/developers"
|
battlemetrics_api_url="https://www.battlemetrics.com/developers"
|
||||||
bm_api="https://api.battlemetrics.com/servers"
|
bm_api="https://api.battlemetrics.com/servers"
|
||||||
|
|
||||||
if [[ $preferred_client == "steam" ]]; then
|
steam_cmd="$preferred_client"
|
||||||
steam_cmd="steam"
|
|
||||||
else
|
|
||||||
steam_cmd="flatpak run com.valvesoftware.Steam"
|
|
||||||
fi
|
|
||||||
|
|
||||||
declare -A funcs=(
|
declare -A funcs=(
|
||||||
["Highlight stale"]="find_stale_mods"
|
["Highlight stale"]="find_stale_mods"
|
||||||
["Change player name"]="update_config_val"
|
["Change player name"]="update_config_val"
|
||||||
["Change Steam API key"]="update_config_val"
|
["Change Steam API key"]="update_config_val"
|
||||||
["Change Battlemetrics API key"]="update_config_val"
|
["Change Battlemetrics API key"]="update_config_val"
|
||||||
|
["Change client"]="update_config_val"
|
||||||
["Change favorite server"]="add_record"
|
["Change favorite server"]="add_record"
|
||||||
["Add server by IP"]="add_record"
|
["Add server by IP"]="add_record"
|
||||||
["Add server by ID"]="add_record"
|
["Add server by ID"]="add_record"
|
||||||
@ -701,13 +698,6 @@ toggle(){
|
|||||||
debug=""
|
debug=""
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
Toggle[[:space:]]Steam/Flatpak)
|
|
||||||
if [[ $preferred_client == "steam" ]]; then
|
|
||||||
preferred_client="flatpak"
|
|
||||||
else
|
|
||||||
preferred_client="steam"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
Toggle[[:space:]]DZGUI[[:space:]]fullscreen[[:space:]]boot)
|
Toggle[[:space:]]DZGUI[[:space:]]fullscreen[[:space:]]boot)
|
||||||
if [[ $fullscreen == "true" ]]; then
|
if [[ $fullscreen == "true" ]]; then
|
||||||
fullscreen="false"
|
fullscreen="false"
|
||||||
@ -806,6 +796,9 @@ update_config_val(){
|
|||||||
local context="$1"
|
local context="$1"
|
||||||
local value="$2"
|
local value="$2"
|
||||||
case $1 in
|
case $1 in
|
||||||
|
"Change client")
|
||||||
|
key="preferred_client"
|
||||||
|
;;
|
||||||
"Change player name")
|
"Change player name")
|
||||||
key="name"
|
key="name"
|
||||||
if [[ -z "${value// }" ]]; then
|
if [[ -z "${value// }" ]]; then
|
||||||
@ -831,7 +824,6 @@ update_config_val(){
|
|||||||
declare -n nr=$key
|
declare -n nr=$key
|
||||||
nr="$value"
|
nr="$value"
|
||||||
update_config
|
update_config
|
||||||
echo "Updated the key '$key' to '$value'"
|
|
||||||
return 80
|
return 80
|
||||||
}
|
}
|
||||||
show_log(){
|
show_log(){
|
||||||
|
|||||||
@ -18,6 +18,7 @@ from enum import Enum
|
|||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from concurrent.futures import wait
|
from concurrent.futures import wait
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
from pathlib import Path
|
||||||
from typing import Literal, Self, Any
|
from typing import Literal, Self, Any
|
||||||
|
|
||||||
import servers as Servers # noqa E402
|
import servers as Servers # noqa E402
|
||||||
@ -823,7 +824,6 @@ def query_history() -> list | None:
|
|||||||
rows = [row.rstrip("\n") for row in f]
|
rows = [row.rstrip("\n") for row in f]
|
||||||
except OSError:
|
except OSError:
|
||||||
rows = None
|
rows = None
|
||||||
finally:
|
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
|
|
||||||
@ -1016,7 +1016,7 @@ def process_tree_option(choice: RowType) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if command == RowType.CHANGELOG:
|
if command == RowType.CHANGELOG:
|
||||||
App.grid.notebook.set_page_by_enum(NotebookPage.CHANGELOG)
|
App.grid.notebook.open_changelog()
|
||||||
return
|
return
|
||||||
|
|
||||||
if command == RowType.QUICK_CONNECT:
|
if command == RowType.QUICK_CONNECT:
|
||||||
@ -3801,12 +3801,22 @@ class Options(Gtk.Box):
|
|||||||
"Always fullscreen",
|
"Always fullscreen",
|
||||||
Preferences.WINDOW,
|
Preferences.WINDOW,
|
||||||
)
|
)
|
||||||
self.steam_toggle = self.make_binary_radio(
|
|
||||||
"Steam", "Flatpak (experimental)", Preferences.CLIENT
|
# TODO: gray out options if not available on system
|
||||||
)
|
client_store = Gtk.ListStore(str, str)
|
||||||
|
client_store.append(["steam", "steam"])
|
||||||
|
client_store.append(["flatpak", "flatpak run com.valvesoftware.Steam"])
|
||||||
|
client_store.append(["flatpak (container)", "flatpak-spawn --host flatpak run com.valvesoftware.Steam"])
|
||||||
|
|
||||||
|
renderer_text = Gtk.CellRendererText(ellipsize=Pango.EllipsizeMode.END)
|
||||||
|
self.client_combo = Gtk.ComboBox.new_with_model(client_store)
|
||||||
|
self.client_combo.set_halign(Gtk.Align.START)
|
||||||
|
self.client_combo.pack_start(renderer_text, True)
|
||||||
|
self.client_combo.connect("changed", self._on_client_changed)
|
||||||
|
self.client_combo.add_attribute(renderer_text, "text", 0)
|
||||||
|
|
||||||
pref_rows = [
|
pref_rows = [
|
||||||
[LeftLabel("Steam client"), self.steam_toggle],
|
[LeftLabel("Steam client"), self.client_combo],
|
||||||
[LeftLabel("Window size at boot"), self.fullscreen_toggle],
|
[LeftLabel("Window size at boot"), self.fullscreen_toggle],
|
||||||
[LeftLabel("Player name"), self.player_box],
|
[LeftLabel("Player name"), self.player_box],
|
||||||
]
|
]
|
||||||
@ -3991,6 +4001,15 @@ class Options(Gtk.Box):
|
|||||||
show_wait_dialog = True
|
show_wait_dialog = True
|
||||||
call_on_thread(show_wait_dialog, cmd, wait_msg, "")
|
call_on_thread(show_wait_dialog, cmd, wait_msg, "")
|
||||||
|
|
||||||
|
def _on_client_changed(self, combo: Gtk.ComboBox) -> None:
|
||||||
|
# prevent triggering on initial init
|
||||||
|
if App.treeview.subpage is not RowType.OPTIONS:
|
||||||
|
return
|
||||||
|
ind = combo.get_active()
|
||||||
|
mod = combo.get_model()
|
||||||
|
client = mod[ind][1]
|
||||||
|
call_bash_func("Change client", client)
|
||||||
|
|
||||||
def _on_branch_changed(self, combo: Gtk.ComboBoxText) -> None:
|
def _on_branch_changed(self, combo: Gtk.ComboBoxText) -> None:
|
||||||
# prevent triggering on initial init
|
# prevent triggering on initial init
|
||||||
if App.treeview.subpage is not RowType.OPTIONS:
|
if App.treeview.subpage is not RowType.OPTIONS:
|
||||||
@ -4000,11 +4019,9 @@ class Options(Gtk.Box):
|
|||||||
def _on_radio_toggled(
|
def _on_radio_toggled(
|
||||||
self, button: Gtk.RadioButton, context: Preferences
|
self, button: Gtk.RadioButton, context: Preferences
|
||||||
) -> None:
|
) -> None:
|
||||||
if App.treeview.subpage is None:
|
if App.treeview.subpage is not RowType.OPTIONS:
|
||||||
return
|
return
|
||||||
match context:
|
match context:
|
||||||
case Preferences.CLIENT:
|
|
||||||
toggle = RowType.TGL_STEAM
|
|
||||||
case Preferences.INSTALL:
|
case Preferences.INSTALL:
|
||||||
toggle = RowType.TGL_INSTALL
|
toggle = RowType.TGL_INSTALL
|
||||||
state = button.get_group()[0].get_active()
|
state = button.get_group()[0].get_active()
|
||||||
@ -4126,11 +4143,9 @@ class Options(Gtk.Box):
|
|||||||
radio = 0
|
radio = 0
|
||||||
self.mod_install_toggle.get_children()[radio].set_active(True)
|
self.mod_install_toggle.get_children()[radio].set_active(True)
|
||||||
|
|
||||||
if client == "flatpak":
|
for ind, row in enumerate(self.client_combo.get_model()):
|
||||||
radio = 1
|
if row[1] == client:
|
||||||
else:
|
self.client_combo.set_active(ind)
|
||||||
radio = 0
|
|
||||||
self.steam_toggle.get_children()[radio].set_active(True)
|
|
||||||
|
|
||||||
if fullscreen == "true":
|
if fullscreen == "true":
|
||||||
radio = 1
|
radio = 1
|
||||||
@ -4325,22 +4340,20 @@ class KeybindingsDialog(Gtk.Box):
|
|||||||
class Changelog(Gtk.Box):
|
class Changelog(Gtk.Box):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
self.changelog_label = Gtk.Label()
|
||||||
|
self.add(self.changelog_label)
|
||||||
|
|
||||||
|
def open_changelog(self, path: Path) -> None:
|
||||||
try:
|
try:
|
||||||
with open(changelog_path, "r") as f:
|
changelog = path.read_text()
|
||||||
changelog = f.read()
|
|
||||||
changelog_label = Gtk.Label()
|
|
||||||
changelog = self.format_pango(changelog)
|
|
||||||
changelog_label.set_markup(changelog)
|
|
||||||
self.add(changelog_label)
|
|
||||||
except FileNotFoundError:
|
|
||||||
msg = f"Failed to find CHANGELOG.md at {changelog_path}"
|
|
||||||
logger.critical(msg)
|
|
||||||
spawn_dialog(msg, Popup.WARN)
|
|
||||||
return
|
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
spawn_dialog(f"Something went wrong: {e}", Popup.WARN)
|
spawn_dialog(f"Something went wrong: {e}", Popup.NOTIFY)
|
||||||
logger.critical(e)
|
logger.critical(e)
|
||||||
return
|
return Exception
|
||||||
|
formatted = self.format_pango(changelog)
|
||||||
|
self.changelog_label.set_markup(formatted)
|
||||||
|
App.grid.notebook.set_page_by_enum(NotebookPage.CHANGELOG)
|
||||||
|
|
||||||
def format_pango(self, text: str) -> str:
|
def format_pango(self, text: str) -> str:
|
||||||
medium = '<span size="medium"><b>'
|
medium = '<span size="medium"><b>'
|
||||||
@ -4357,7 +4370,8 @@ class Notebook(Gtk.Notebook):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(show_tabs=False, show_border=False)
|
super().__init__(show_tabs=False, show_border=False)
|
||||||
|
|
||||||
self.clog = ScrollableNote(Changelog())
|
self.changelog = Changelog()
|
||||||
|
self.clog = ScrollableNote(self.changelog)
|
||||||
self.clog.type = RowType.CHANGELOG
|
self.clog.type = RowType.CHANGELOG
|
||||||
self.clog.show_all()
|
self.clog.show_all()
|
||||||
self.append_page(self.clog)
|
self.append_page(self.clog)
|
||||||
@ -4376,6 +4390,10 @@ class Notebook(Gtk.Notebook):
|
|||||||
self.connect("switch-page", self._on_page_changed)
|
self.connect("switch-page", self._on_page_changed)
|
||||||
self.connect("key-press-event", self._on_keypress)
|
self.connect("key-press-event", self._on_keypress)
|
||||||
|
|
||||||
|
def open_changelog(self) -> None:
|
||||||
|
path = Path(changelog_path)
|
||||||
|
self.changelog.open_changelog(path)
|
||||||
|
|
||||||
def _set_adjustment(self, adjustment: VAdjustment) -> None:
|
def _set_adjustment(self, adjustment: VAdjustment) -> None:
|
||||||
INCREMENT = 50
|
INCREMENT = 50
|
||||||
page = self.get_page()
|
page = self.get_page()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user