Add missing defaults, log all caught exceptions
- Add prefetch_adjacent, clear_cache_on_exit, slideshow_monitor, library_dir to _DEFAULTS for fresh installs - Replace all silent except-pass with logged warnings
This commit is contained in:
parent
08c961ba80
commit
a2302e2caa
@ -90,6 +90,10 @@ _DEFAULTS = {
|
|||||||
"preload_thumbnails": "1",
|
"preload_thumbnails": "1",
|
||||||
"file_dialog_platform": "qt",
|
"file_dialog_platform": "qt",
|
||||||
"blacklist_enabled": "1",
|
"blacklist_enabled": "1",
|
||||||
|
"prefetch_adjacent": "0",
|
||||||
|
"clear_cache_on_exit": "0",
|
||||||
|
"slideshow_monitor": "",
|
||||||
|
"library_dir": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -756,8 +756,8 @@ class BooruApp(QMainWindow):
|
|||||||
try:
|
try:
|
||||||
results = await client.autocomplete(query)
|
results = await client.autocomplete(query)
|
||||||
self._signals.autocomplete_done.emit(results)
|
self._signals.autocomplete_done.emit(results)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
log.warning(f"Operation failed: {e}")
|
||||||
finally:
|
finally:
|
||||||
await client.close()
|
await client.close()
|
||||||
|
|
||||||
@ -822,8 +822,8 @@ class BooruApp(QMainWindow):
|
|||||||
if total > 0:
|
if total > 0:
|
||||||
self._signals.prefetch_progress.emit(idx, dl / total)
|
self._signals.prefetch_progress.emit(idx, dl / total)
|
||||||
await download_image(self._posts[adj].file_url, progress_callback=_progress)
|
await download_image(self._posts[adj].file_url, progress_callback=_progress)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
log.warning(f"Operation failed: {e}")
|
||||||
self._signals.prefetch_progress.emit(adj, -1)
|
self._signals.prefetch_progress.emit(adj, -1)
|
||||||
self._run_async(_prefetch_batch)
|
self._run_async(_prefetch_batch)
|
||||||
|
|
||||||
@ -1367,8 +1367,8 @@ class BooruApp(QMainWindow):
|
|||||||
source=post.source, cached_path=str(path),
|
source=post.source, cached_path=str(path),
|
||||||
)
|
)
|
||||||
self._signals.bookmark_done.emit(idx, f"Bookmarked {i+1}/{len(posts)}")
|
self._signals.bookmark_done.emit(idx, f"Bookmarked {i+1}/{len(posts)}")
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
log.warning(f"Operation failed: {e}")
|
||||||
self._signals.batch_done.emit(f"Bookmarked {len(posts)} posts")
|
self._signals.batch_done.emit(f"Bookmarked {len(posts)} posts")
|
||||||
|
|
||||||
self._run_async(_do)
|
self._run_async(_do)
|
||||||
@ -1397,8 +1397,8 @@ class BooruApp(QMainWindow):
|
|||||||
source=post.source, cached_path=str(path), folder=folder,
|
source=post.source, cached_path=str(path), folder=folder,
|
||||||
)
|
)
|
||||||
self._signals.bookmark_done.emit(idx, f"Saved {i+1}/{len(posts)} to {where}")
|
self._signals.bookmark_done.emit(idx, f"Saved {i+1}/{len(posts)} to {where}")
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
log.warning(f"Operation failed: {e}")
|
||||||
self._signals.batch_done.emit(f"Saved {len(posts)} to {where}")
|
self._signals.batch_done.emit(f"Saved {len(posts)} to {where}")
|
||||||
|
|
||||||
self._run_async(_do)
|
self._run_async(_do)
|
||||||
@ -1423,8 +1423,8 @@ class BooruApp(QMainWindow):
|
|||||||
source=post.source,
|
source=post.source,
|
||||||
cached_path=str(path),
|
cached_path=str(path),
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
log.warning(f"Operation failed: {e}")
|
||||||
|
|
||||||
self._run_async(_fav)
|
self._run_async(_fav)
|
||||||
|
|
||||||
@ -1776,8 +1776,8 @@ def _apply_windows_dark_mode(app: QApplication) -> None:
|
|||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
log.warning(f"Operation failed: {e}")
|
||||||
|
|
||||||
|
|
||||||
def run() -> None:
|
def run() -> None:
|
||||||
@ -1805,8 +1805,8 @@ def run() -> None:
|
|||||||
pal = app.palette()
|
pal = app.palette()
|
||||||
pal.setColor(QPalette.ColorRole.Highlight, QColor(m.group(1)))
|
pal.setColor(QPalette.ColorRole.Highlight, QColor(m.group(1)))
|
||||||
app.setPalette(pal)
|
app.setPalette(pal)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
log.warning(f"Operation failed: {e}")
|
||||||
|
|
||||||
# Set app icon (works in taskbar on all platforms)
|
# Set app icon (works in taskbar on all platforms)
|
||||||
from PySide6.QtGui import QIcon
|
from PySide6.QtGui import QIcon
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user