diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-21 10:03:31 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-21 10:03:31 +0200 |
| commit | 6b0f67655b40fef221f9c84cfb6c0bcedf34e3bb (patch) | |
| tree | b4f66f2e0f327d9da5c40566518225606a517135 /sb_builder/repository.py | |
| parent | 8a63cde8346c6ff30dd79cf7862e28ce6dff56fc (diff) | |
| download | sb-builder-6b0f67655b40fef221f9c84cfb6c0bcedf34e3bb.tar.gz sb-builder-6b0f67655b40fef221f9c84cfb6c0bcedf34e3bb.zip | |
Repository, Packages: no stale detail pane; scan survives races
A reload or filter that drops the current row left its pane and link up,
and the link then crashed on current() being None (Packages had the same).
A .txz slackrepo replaces between glob and stat is skipped, and any
exception in the scan thread reaches the stats line instead of leaving it
at loading.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'sb_builder/repository.py')
| -rw-r--r-- | sb_builder/repository.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sb_builder/repository.py b/sb_builder/repository.py index 29f4291..38c6ecc 100644 --- a/sb_builder/repository.py +++ b/sb_builder/repository.py @@ -106,7 +106,10 @@ def scan(path): m = PKGFILE.match(os.path.basename(f)) if not m: continue - st = os.stat(f) + try: + st = os.stat(f) + except FileNotFoundError: + continue # slackrepo replaced it since the glob item = os.path.relpath(os.path.dirname(f), path) # category/pkg info = meta.get(os.path.basename(f)) rows.append({**m.groupdict(), "category": item.split("/")[0], "file": f, @@ -283,7 +286,7 @@ class RepositoryTab(QWidget): def work(): try: self.scanned.emit(gen, scan(path), "") - except OSError as e: + except Exception as e: # the thread's boundary: never stuck at loading self.scanned.emit(gen, None, str(e)) threading.Thread(target=work, daemon=True).start() @@ -292,12 +295,13 @@ class RepositoryTab(QWidget): return # an older Refresh, overtaken self.model.set_rows(data["rows"] if data else []) self.stats.setText(err or summary(data)) - self.update_count() + self.refilter() def refilter(self): on = {n for n, b in self.chips.items() if b.isChecked()} self.proxy.update(self.query.text(), on - {"unpublished"}, "unpublished" in on) self.update_count() + self.show_detail(self.table.currentIndex(), None) # a reset or filter can drop it def update_count(self): self.count.setText(f"{self.proxy.rowCount():,} shown") |
