From abcea76fee60debc3d89c69bb9f0fb5ae90fb64a Mon Sep 17 00:00:00 2001 From: DazedAnon Date: Fri, 24 Jul 2026 12:51:43 -0500 Subject: [PATCH] refactor(gui): streamline SHA display logic in UpdateDialog - Remove the _available_sha_display method and directly utilize _short_sha for clarity. - Update new version label to reflect the installed SHA when no pending SHA is available. - Clean up related unit tests to align with the updated display logic. --- .git_archival.txt | 2 +- gui/main.py | 8 ++------ tests/test_bundled_updates.py | 15 --------------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.git_archival.txt b/.git_archival.txt index ff4124f..316c3f0 100644 --- a/.git_archival.txt +++ b/.git_archival.txt @@ -1 +1 @@ -node: $Format:%H$ +node: 0a2b8c77b887a097113859aba3eeec0decd006b7 diff --git a/gui/main.py b/gui/main.py index d34cf69..a0628c0 100644 --- a/gui/main.py +++ b/gui/main.py @@ -533,10 +533,6 @@ class UpdateDialog(QDialog): return "Unknown" return sha[:8] - @classmethod - def _available_sha_display(cls, sha: str | None) -> str: - return cls._short_sha(sha) if sha else "Current" - @classmethod def _installed_sha_display(cls) -> str: return cls._short_sha(UpdateThread.read_installed_sha()) @@ -592,7 +588,7 @@ class UpdateDialog(QDialog): self.cancel_btn.setText("Close") tool_sha = self._pending_tool_sha - self.new_version_label.setText(self._available_sha_display(tool_sha)) + self.new_version_label.setText(self._short_sha(tool_sha)) if not tool_sha: self.headline_label.setText("You're up to date") @@ -646,7 +642,7 @@ class UpdateDialog(QDialog): f"No newer build found on {UpdateThread.REPO_BRANCH}." ) self.subtitle_label.setText("You're running the latest version.") - self.new_version_label.setText("Current") + self.new_version_label.setText(self._installed_sha_display()) elif message.startswith("updated:"): sha = message.split(":", 1)[1] self._pending_tool_sha = None diff --git a/tests/test_bundled_updates.py b/tests/test_bundled_updates.py index 762f5d4..3d2f30d 100644 --- a/tests/test_bundled_updates.py +++ b/tests/test_bundled_updates.py @@ -300,21 +300,6 @@ class CheckToolUpdateTests(unittest.TestCase): self.assertIsNone(check_tool_update()) -class UpdateDialogDisplayTests(unittest.TestCase): - def test_available_version_says_current_when_up_to_date(self): - from gui.main import UpdateDialog - - self.assertEqual(UpdateDialog._available_sha_display(None), "Current") - - def test_available_version_shows_pending_sha(self): - from gui.main import UpdateDialog - - self.assertEqual( - UpdateDialog._available_sha_display("1234567890abcdef"), - "12345678", - ) - - class AceBundledOnlyTests(unittest.TestCase): def _ace_paths(self, base: Path) -> dict: offline = base / "offline"