settings: add Clear Tag Category Cache button
behavior change: Settings > Cache now has a 'Clear Tag Category Cache' action that wipes the per-site tag_types table via the existing db.clear_tag_cache() hook. This also drops the __batch_api_probe__ sentinel so Gelbooru/Moebooru sites re-probe the batch tag API on next use and repopulate the cache from a fresh response. Use case: category types like Character/Copyright/Meta appear missing when the local tag cache was populated by an older build that didn't map all of Gelbooru's type codes. Clearing lets the current _GELBOORU_TYPE_MAP re-label tags cleanly instead of inheriting whatever the old rows said.
This commit is contained in:
parent
0f26475f52
commit
730b2a7b7e
@ -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
|
||||
|
||||
|
||||
@ -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)")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user