fix: UI not starting if changelog was missing

This commit is contained in:
aclist 2025-11-05 14:27:15 +09:00
parent a08c588df3
commit d7e94eab90
4 changed files with 27 additions and 19 deletions

View File

@ -1,5 +1,9 @@
# Changelog
## [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

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -o pipefail
version=6.0.0.beta-8
version=6.0.1.beta-1
#CONSTANTS
aid=221100
@ -615,10 +615,10 @@ fetch_helpers_by_sum(){
[[ -f "$config_file" ]] && source "$config_file"
declare -A sums
sums=(
["funcs"]="6ae3ead7034dc8e7543472bddee75c63"
["funcs"]="2bac12c1bff5d6ad50161f174d57d029"
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
["servers.py"]="ed442c3aecf33f777d59dcf53650d263"
["ui.py"]="8d05bbd7b8e15a97fae568e9a3dbf4d6"
["ui.py"]="8a35ac263db8b812f30e04902c4e9603"
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
["pefile.py"]="21531f2c0d9dfa5f110cf6779f9d22c0"
)

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -o pipefail
version="6.0.0-beta.8"
version="6.0.1-beta.1"
#CONSTANTS
aid=221100

View File

@ -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
@ -1016,7 +1017,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:
@ -4325,22 +4326,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 +4356,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 +4376,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()