Remove needless try/catch stuff
This commit is contained in:
parent
3e91f158c3
commit
0923fb4395
3 changed files with 8 additions and 21 deletions
|
|
@ -70,10 +70,6 @@ class BugReportDialog(QDialog):
|
||||||
self.text_edit.setPlainText(text[: self.MAX_CHARS])
|
self.text_edit.setPlainText(text[: self.MAX_CHARS])
|
||||||
self.text_edit.blockSignals(False)
|
self.text_edit.blockSignals(False)
|
||||||
|
|
||||||
# Clamp cursor position to end of text
|
|
||||||
if pos > self.MAX_CHARS:
|
|
||||||
pos = self.MAX_CHARS
|
|
||||||
|
|
||||||
cursor.setPosition(pos)
|
cursor.setPosition(pos)
|
||||||
self.text_edit.setTextCursor(cursor)
|
self.text_edit.setTextCursor(cursor)
|
||||||
|
|
||||||
|
|
@ -88,10 +84,7 @@ class BugReportDialog(QDialog):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Get current app version
|
# Get current app version
|
||||||
try:
|
version = importlib.metadata.version("bouquin")
|
||||||
version = importlib.metadata.version("bouquin")
|
|
||||||
except importlib.metadata.PackageNotFoundError:
|
|
||||||
version = "unknown"
|
|
||||||
|
|
||||||
payload: dict[str, str] = {
|
payload: dict[str, str] = {
|
||||||
"message": text,
|
"message": text,
|
||||||
|
|
|
||||||
|
|
@ -736,12 +736,8 @@ class DBManager:
|
||||||
page_most_revisions_count = c
|
page_most_revisions_count = c
|
||||||
page_most_revisions = date_iso
|
page_most_revisions = date_iso
|
||||||
|
|
||||||
try:
|
d = _dt.date.fromisoformat(date_iso)
|
||||||
d = _dt.date.fromisoformat(date_iso)
|
revisions_by_date[d] = c
|
||||||
revisions_by_date[d] = c
|
|
||||||
except ValueError:
|
|
||||||
# Ignore malformed dates
|
|
||||||
pass
|
|
||||||
|
|
||||||
# 4) total words + per-date words (current version only)
|
# 4) total words + per-date words (current version only)
|
||||||
entries = self.get_all_entries()
|
entries = self.get_all_entries()
|
||||||
|
|
@ -751,11 +747,8 @@ class DBManager:
|
||||||
for date_iso, content in entries:
|
for date_iso, content in entries:
|
||||||
wc = self._count_words(content or "")
|
wc = self._count_words(content or "")
|
||||||
total_words += wc
|
total_words += wc
|
||||||
try:
|
d = _dt.date.fromisoformat(date_iso)
|
||||||
d = _dt.date.fromisoformat(date_iso)
|
words_by_date[d] = wc
|
||||||
words_by_date[d] = wc
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# tags + page with most tags
|
# tags + page with most tags
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,9 @@ class KeyPrompt(QDialog):
|
||||||
|
|
||||||
def db_path(self) -> Path | None:
|
def db_path(self) -> Path | None:
|
||||||
"""Return the chosen DB path (or None if unchanged/not shown)."""
|
"""Return the chosen DB path (or None if unchanged/not shown)."""
|
||||||
|
p = self._db_path
|
||||||
if self.path_edit is not None:
|
if self.path_edit is not None:
|
||||||
text = self.path_edit.text().strip()
|
text = self.path_edit.text().strip()
|
||||||
if text:
|
if text:
|
||||||
return Path(text)
|
p = Path(text)
|
||||||
return self._db_path
|
return p
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue