From e28a75cfd93e43b2c16cffe836db204b4a727bf9 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:43:03 +0900 Subject: [PATCH] fix: installed mods race condition (#167) --- CHANGELOG.md | 4 ++++ dzgui.sh | 4 ++-- helpers/ui.py | 25 +++++++++++++------------ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b979cc0..bf502c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [5.6.0-beta.6] 2024-11-28 +### Fixed +- Race condition when checking for installed mods + ## [5.6.0-beta.5] 2024-11-21 ### Added - Highlight stale mods in mods list diff --git a/dzgui.sh b/dzgui.sh index b7291d1..f5f2dd1 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=5.6.0-beta.5 +version=5.6.0-beta.6 #CONSTANTS aid=221100 @@ -569,7 +569,7 @@ fetch_helpers_by_sum(){ [[ -f "$config_file" ]] && source "$config_file" declare -A sums sums=( - ["ui.py"]="a5896c88510e8b4b2f1fec06aed0c96a" + ["ui.py"]="1c6e5b996eccd891a3e56930e28246da" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" ["funcs"]="9a0ad94df22e24fe41e93a689de7d03e" diff --git a/helpers/ui.py b/helpers/ui.py index 5753fa8..779ac15 100644 --- a/helpers/ui.py +++ b/helpers/ui.py @@ -1421,12 +1421,12 @@ class TreeView(Gtk.TreeView): # suppress button panel if store is empty if isinstance(panel_last_child, ModSelectionPanel): if total_mods == 0: - # nb. do not forcibly remove previously added widgets + # do not forcibly remove previously added widgets when reloading in-place grid.sel_panel.set_visible(False) - grid.show_all() right_panel.set_filter_visibility(False) + else: + grid.sel_panel.set_visible(True) - grid.sel_panel.set_visible(True) self.set_model(mod_store) self.grab_focus() size = locale.format_string('%.3f', total_size, grouping=True) @@ -1437,6 +1437,7 @@ class TreeView(Gtk.TreeView): toggle_signal(self, self, '_on_keypress', True) self._focus_first_row() if total_mods == 0: + logger.info("Nothing to do, spawning notice dialog") spawn_dialog(self.get_outer_window(), data.stdout, Popup.NOTIFY) widgets = relative_widget(self) @@ -1447,18 +1448,18 @@ class TreeView(Gtk.TreeView): # suppress errors if no mods available on system if data.returncode == 1: + logger.info("Failed to find mods on local system") total_mods = 0 total_size = 0 GLib.idle_add(load) - return 1 - - # show button panel missing (prevents duplication when reloading in-place) - if not isinstance(panel_last_child, ModSelectionPanel): - grid.sel_panel.set_visible(True) - result = parse_mod_rows(data) - total_size = result[0] - total_mods = result[1] - GLib.idle_add(load) + else: + # show button panel missing (prevents duplication when reloading in-place) + if not isinstance(panel_last_child, ModSelectionPanel): + grid.sel_panel.set_visible(True) + result = parse_mod_rows(data) + total_size = result[0] + total_mods = result[1] + GLib.idle_add(load) def _on_col_width_changed(self, col, width):