diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a10103..d5065b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +### Added +- Settings → Cache: **Clear Tag Category Cache** button — wipes the per-site `tag_types` rows (including the `__batch_api_probe__` sentinel) so Gelbooru/Moebooru backends re-probe and re-populate tag categories from scratch. Useful when a stale cache from an earlier build leaves some category types mis-labelled or missing + ### Changed - Thumbnail drag-start threshold raised from 10px to 30px to match the rubber band's gate — small mouse wobbles on a thumb no longer trigger a file drag diff --git a/booru_viewer/gui/settings.py b/booru_viewer/gui/settings.py index 027917f..dd32ca4 100644 --- a/booru_viewer/gui/settings.py +++ b/booru_viewer/gui/settings.py @@ -328,6 +328,20 @@ class SettingsDialog(QDialog): actions_layout.addLayout(btn_row2) + btn_row3 = QHBoxLayout() + + clear_tags_btn = QPushButton("Clear Tag Category Cache") + clear_tags_btn.setToolTip( + "Wipe the per-site tag-type cache (Gelbooru/Moebooru sites). " + "Use this if category colors stop appearing correctly — the " + "app will re-fetch tag types on the next post view." + ) + clear_tags_btn.clicked.connect(self._clear_tag_cache) + btn_row3.addWidget(clear_tags_btn) + btn_row3.addStretch(1) + + actions_layout.addLayout(btn_row3) + layout.addWidget(actions_group) layout.addStretch() return w @@ -699,6 +713,18 @@ class SettingsDialog(QDialog): QMessageBox.information(self, "Done", f"Evicted {count} files.") self._refresh_stats() + def _clear_tag_cache(self) -> None: + reply = QMessageBox.question( + self, "Confirm", + "Wipe the tag category cache for every site? This also clears " + "the per-site batch-API probe result, so the app will re-probe " + "Gelbooru/Moebooru backends on next use.", + QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No, + ) + if reply == QMessageBox.StandardButton.Yes: + count = self._db.clear_tag_cache() + QMessageBox.information(self, "Done", f"Deleted {count} tag-type rows.") + def _bl_export(self) -> None: from .dialogs import save_file path = save_file(self, "Export Blacklist", "blacklist.txt", "Text (*.txt)")