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
|
||||
|
||||
## [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
|
||||
## Added
|
||||
- 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
|
||||
set -o pipefail
|
||||
|
||||
version=6.0.0.beta-8
|
||||
src_path=$(realpath "$0")
|
||||
|
||||
version=6.0.1.beta-4
|
||||
|
||||
#CONSTANTS
|
||||
aid=221100
|
||||
@ -136,7 +138,7 @@ print_config_vals(){
|
||||
|
||||
}
|
||||
test_gobject(){
|
||||
python3 -c "import gi"
|
||||
python3.13 -c "import gi"
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
logger CRITICAL "Missing PyGObject"
|
||||
fdialog "Requires PyGObject (python-gobject)"
|
||||
@ -218,9 +220,6 @@ default_steam_path="$default_steam_path"
|
||||
|
||||
#Preferred Steam launch command (for Flatpak support)
|
||||
preferred_client="$preferred_client"
|
||||
|
||||
#DZGUI source path
|
||||
src_path="$src_path"
|
||||
END
|
||||
}
|
||||
depcheck(){
|
||||
@ -237,13 +236,10 @@ depcheck(){
|
||||
logger INFO "Initial dependencies satisfied"
|
||||
}
|
||||
check_pyver(){
|
||||
local pyver=$(python3 --version | awk '{print $2}')
|
||||
local minor=$(<<< $pyver awk -F. '{print $2}')
|
||||
if [[ -z $pyver ]] || [[ ${pyver:0:1} -lt 3 ]] || [[ $minor -lt 10 ]]; then
|
||||
local msg="Requires Python >=3.10"
|
||||
if [[ ! $(command -v python3.13) ]]; then
|
||||
local msg="Requires Python 3.13"
|
||||
raise_error_and_quit "$msg"
|
||||
fi
|
||||
logger INFO "Found Python version: $pyver"
|
||||
}
|
||||
watcher_deps(){
|
||||
if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then
|
||||
@ -317,6 +313,7 @@ check_unmerged(){
|
||||
fi
|
||||
}
|
||||
check_version(){
|
||||
[[ -n $reference_branch ]] && return
|
||||
local version_url=$(format_version_url)
|
||||
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
||||
local res=$(get_response_code "$version_url")
|
||||
@ -467,18 +464,7 @@ steam_deps(){
|
||||
local msg="Found neither Steam nor Flatpak Steam"
|
||||
raise_error_and_quit "$msg"
|
||||
exit 1
|
||||
elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then
|
||||
[[ -n $preferred_client ]] && return 0
|
||||
if [[ -z $preferred_client ]]; then
|
||||
preferred_client="steam"
|
||||
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(){
|
||||
if [[ ! -f $config_path/dztuirc.oldapi ]]; then
|
||||
@ -615,10 +601,10 @@ fetch_helpers_by_sum(){
|
||||
[[ -f "$config_file" ]] && source "$config_file"
|
||||
declare -A sums
|
||||
sums=(
|
||||
["funcs"]="6ae3ead7034dc8e7543472bddee75c63"
|
||||
["funcs"]="39fa4c302a508f63dcfe5ca3cff9bc01"
|
||||
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
||||
["servers.py"]="ed442c3aecf33f777d59dcf53650d263"
|
||||
["ui.py"]="8d05bbd7b8e15a97fae568e9a3dbf4d6"
|
||||
["ui.py"]="2276386252bd571b3505cbbc74359732"
|
||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||
["pefile.py"]="21531f2c0d9dfa5f110cf6779f9d22c0"
|
||||
)
|
||||
@ -639,6 +625,10 @@ fetch_helpers_by_sum(){
|
||||
realbranch="dzgui"
|
||||
fi
|
||||
|
||||
if [[ -n $reference_branch ]]; then
|
||||
realbranch="$reference_branch"
|
||||
fi
|
||||
|
||||
for i in "${!sums[@]}"; do
|
||||
file="$i"
|
||||
sum="${sums[$i]}"
|
||||
@ -881,7 +871,7 @@ file_picker(){
|
||||
}
|
||||
find_library_folder(){
|
||||
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')"
|
||||
if [[ ! $? -eq 0 ]] || [[ -z $steam_path ]]; then
|
||||
logger WARN "Failed to parse Steam path using '$search_path'"
|
||||
@ -895,6 +885,7 @@ create_config(){
|
||||
unset default_steam_path
|
||||
unset steam_path
|
||||
|
||||
preferred_client="steam"
|
||||
while true; do
|
||||
local player_input="$($steamsafe_zenity \
|
||||
--forms \
|
||||
@ -979,10 +970,6 @@ varcheck(){
|
||||
create_config
|
||||
return 0
|
||||
fi
|
||||
if [[ $src_path != $(realpath "$0") ]]; then
|
||||
src_path=$(realpath "$0")
|
||||
update_config
|
||||
fi
|
||||
}
|
||||
is_dzg_downloading(){
|
||||
if [[ -d $steam_path ]] && [[ -d $steam_path/downloading/$aid ]]; then
|
||||
@ -1182,7 +1169,7 @@ main(){
|
||||
initial_setup
|
||||
|
||||
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
|
||||
set -o pipefail
|
||||
version="6.0.0-beta.8"
|
||||
version="6.0.1-beta.4"
|
||||
|
||||
#CONSTANTS
|
||||
aid=221100
|
||||
@ -87,17 +87,14 @@ steam_api_url="https://steamcommunity.com/dev/apikey"
|
||||
battlemetrics_api_url="https://www.battlemetrics.com/developers"
|
||||
bm_api="https://api.battlemetrics.com/servers"
|
||||
|
||||
if [[ $preferred_client == "steam" ]]; then
|
||||
steam_cmd="steam"
|
||||
else
|
||||
steam_cmd="flatpak run com.valvesoftware.Steam"
|
||||
fi
|
||||
steam_cmd="$preferred_client"
|
||||
|
||||
declare -A funcs=(
|
||||
["Highlight stale"]="find_stale_mods"
|
||||
["Change player name"]="update_config_val"
|
||||
["Change Steam API key"]="update_config_val"
|
||||
["Change Battlemetrics API key"]="update_config_val"
|
||||
["Change client"]="update_config_val"
|
||||
["Change favorite server"]="add_record"
|
||||
["Add server by IP"]="add_record"
|
||||
["Add server by ID"]="add_record"
|
||||
@ -701,13 +698,6 @@ toggle(){
|
||||
debug=""
|
||||
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)
|
||||
if [[ $fullscreen == "true" ]]; then
|
||||
fullscreen="false"
|
||||
@ -806,6 +796,9 @@ update_config_val(){
|
||||
local context="$1"
|
||||
local value="$2"
|
||||
case $1 in
|
||||
"Change client")
|
||||
key="preferred_client"
|
||||
;;
|
||||
"Change player name")
|
||||
key="name"
|
||||
if [[ -z "${value// }" ]]; then
|
||||
@ -831,7 +824,6 @@ update_config_val(){
|
||||
declare -n nr=$key
|
||||
nr="$value"
|
||||
update_config
|
||||
echo "Updated the key '$key' to '$value'"
|
||||
return 80
|
||||
}
|
||||
show_log(){
|
||||
|
||||
@ -18,6 +18,7 @@ from enum import Enum
|
||||
from collections.abc import Callable
|
||||
from concurrent.futures import wait
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from pathlib import Path
|
||||
from typing import Literal, Self, Any
|
||||
|
||||
import servers as Servers # noqa E402
|
||||
@ -823,7 +824,6 @@ def query_history() -> list | None:
|
||||
rows = [row.rstrip("\n") for row in f]
|
||||
except OSError:
|
||||
rows = None
|
||||
finally:
|
||||
return rows
|
||||
|
||||
|
||||
@ -1016,7 +1016,7 @@ def process_tree_option(choice: RowType) -> None:
|
||||
return
|
||||
|
||||
if command == RowType.CHANGELOG:
|
||||
App.grid.notebook.set_page_by_enum(NotebookPage.CHANGELOG)
|
||||
App.grid.notebook.open_changelog()
|
||||
return
|
||||
|
||||
if command == RowType.QUICK_CONNECT:
|
||||
@ -3801,12 +3801,22 @@ class Options(Gtk.Box):
|
||||
"Always fullscreen",
|
||||
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 = [
|
||||
[LeftLabel("Steam client"), self.steam_toggle],
|
||||
[LeftLabel("Steam client"), self.client_combo],
|
||||
[LeftLabel("Window size at boot"), self.fullscreen_toggle],
|
||||
[LeftLabel("Player name"), self.player_box],
|
||||
]
|
||||
@ -3991,6 +4001,15 @@ class Options(Gtk.Box):
|
||||
show_wait_dialog = True
|
||||
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:
|
||||
# prevent triggering on initial init
|
||||
if App.treeview.subpage is not RowType.OPTIONS:
|
||||
@ -4000,11 +4019,9 @@ class Options(Gtk.Box):
|
||||
def _on_radio_toggled(
|
||||
self, button: Gtk.RadioButton, context: Preferences
|
||||
) -> None:
|
||||
if App.treeview.subpage is None:
|
||||
if App.treeview.subpage is not RowType.OPTIONS:
|
||||
return
|
||||
match context:
|
||||
case Preferences.CLIENT:
|
||||
toggle = RowType.TGL_STEAM
|
||||
case Preferences.INSTALL:
|
||||
toggle = RowType.TGL_INSTALL
|
||||
state = button.get_group()[0].get_active()
|
||||
@ -4126,11 +4143,9 @@ class Options(Gtk.Box):
|
||||
radio = 0
|
||||
self.mod_install_toggle.get_children()[radio].set_active(True)
|
||||
|
||||
if client == "flatpak":
|
||||
radio = 1
|
||||
else:
|
||||
radio = 0
|
||||
self.steam_toggle.get_children()[radio].set_active(True)
|
||||
for ind, row in enumerate(self.client_combo.get_model()):
|
||||
if row[1] == client:
|
||||
self.client_combo.set_active(ind)
|
||||
|
||||
if fullscreen == "true":
|
||||
radio = 1
|
||||
@ -4325,22 +4340,20 @@ class KeybindingsDialog(Gtk.Box):
|
||||
class Changelog(Gtk.Box):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.changelog_label = Gtk.Label()
|
||||
self.add(self.changelog_label)
|
||||
|
||||
def open_changelog(self, path: Path) -> None:
|
||||
try:
|
||||
with open(changelog_path, "r") as f:
|
||||
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
|
||||
changelog = path.read_text()
|
||||
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)
|
||||
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:
|
||||
medium = '<span size="medium"><b>'
|
||||
@ -4357,7 +4370,8 @@ class Notebook(Gtk.Notebook):
|
||||
def __init__(self):
|
||||
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.show_all()
|
||||
self.append_page(self.clog)
|
||||
@ -4376,6 +4390,10 @@ class Notebook(Gtk.Notebook):
|
||||
self.connect("switch-page", self._on_page_changed)
|
||||
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:
|
||||
INCREMENT = 50
|
||||
page = self.get_page()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user