Compare commits
No commits in common. "0e5d622a4e963a2b95b1ad019b71950006950673" and "3e91f158c3ce9900c5ec6eac54e9d6ebc3354c1d" have entirely different histories.
0e5d622a4e
...
3e91f158c3
9 changed files with 25 additions and 72 deletions
|
|
@ -3,7 +3,6 @@
|
||||||
* Improve Statistics widget height
|
* Improve Statistics widget height
|
||||||
* Improve SaveDialog widget width
|
* Improve SaveDialog widget width
|
||||||
* Make Tags and TimeLog optional features that can be switched on/off in Settings (enabled by default)
|
* Make Tags and TimeLog optional features that can be switched on/off in Settings (enabled by default)
|
||||||
* Make it possible to change regular text size
|
|
||||||
|
|
||||||
# 0.4.1
|
# 0.4.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ 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)
|
||||||
|
|
||||||
|
|
@ -84,7 +88,10 @@ class BugReportDialog(QDialog):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Get current app version
|
# Get current app version
|
||||||
version = importlib.metadata.version("bouquin")
|
try:
|
||||||
|
version = importlib.metadata.version("bouquin")
|
||||||
|
except importlib.metadata.PackageNotFoundError:
|
||||||
|
version = "unknown"
|
||||||
|
|
||||||
payload: dict[str, str] = {
|
payload: dict[str, str] = {
|
||||||
"message": text,
|
"message": text,
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ class DBConfig:
|
||||||
tags: bool = True
|
tags: bool = True
|
||||||
time_log: bool = True
|
time_log: bool = True
|
||||||
locale: str = "en"
|
locale: str = "en"
|
||||||
font_size: int = 11
|
|
||||||
|
|
||||||
|
|
||||||
class DBManager:
|
class DBManager:
|
||||||
|
|
@ -737,8 +736,12 @@ class DBManager:
|
||||||
page_most_revisions_count = c
|
page_most_revisions_count = c
|
||||||
page_most_revisions = date_iso
|
page_most_revisions = date_iso
|
||||||
|
|
||||||
d = _dt.date.fromisoformat(date_iso)
|
try:
|
||||||
revisions_by_date[d] = c
|
d = _dt.date.fromisoformat(date_iso)
|
||||||
|
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()
|
||||||
|
|
@ -748,8 +751,11 @@ 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
|
||||||
d = _dt.date.fromisoformat(date_iso)
|
try:
|
||||||
words_by_date[d] = wc
|
d = _dt.date.fromisoformat(date_iso)
|
||||||
|
words_by_date[d] = wc
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
# tags + page with most tags
|
# tags + page with most tags
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,9 +99,8 @@ 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:
|
||||||
p = Path(text)
|
return Path(text)
|
||||||
return p
|
return self._db_path
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,6 @@
|
||||||
"toolbar_italic": "Italic",
|
"toolbar_italic": "Italic",
|
||||||
"toolbar_strikethrough": "Strikethrough",
|
"toolbar_strikethrough": "Strikethrough",
|
||||||
"toolbar_normal_paragraph_text": "Normal paragraph text",
|
"toolbar_normal_paragraph_text": "Normal paragraph text",
|
||||||
"toolbar_font_smaller": "Smaller text",
|
|
||||||
"toolbar_font_larger": "Larger text",
|
|
||||||
"toolbar_bulleted_list": "Bulleted list",
|
"toolbar_bulleted_list": "Bulleted list",
|
||||||
"toolbar_numbered_list": "Numbered list",
|
"toolbar_numbered_list": "Numbered list",
|
||||||
"toolbar_code_block": "Code block",
|
"toolbar_code_block": "Code block",
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,6 @@ class MainWindow(QMainWindow):
|
||||||
else:
|
else:
|
||||||
self._try_connect()
|
self._try_connect()
|
||||||
|
|
||||||
self.settings = QSettings(APP_ORG, APP_NAME)
|
|
||||||
|
|
||||||
# ---- UI: Left fixed panel (calendar) + right editor -----------------
|
# ---- UI: Left fixed panel (calendar) + right editor -----------------
|
||||||
self.calendar = QCalendarWidget()
|
self.calendar = QCalendarWidget()
|
||||||
self.calendar.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
self.calendar.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||||
|
|
@ -321,6 +319,7 @@ class MainWindow(QMainWindow):
|
||||||
self.time_log.hide()
|
self.time_log.hide()
|
||||||
|
|
||||||
# Restore window position from settings
|
# Restore window position from settings
|
||||||
|
self.settings = QSettings(APP_ORG, APP_NAME)
|
||||||
self._restore_window_position()
|
self._restore_window_position()
|
||||||
|
|
||||||
# re-apply all runtime color tweaks when theme changes
|
# re-apply all runtime color tweaks when theme changes
|
||||||
|
|
@ -486,9 +485,6 @@ class MainWindow(QMainWindow):
|
||||||
|
|
||||||
editor = MarkdownEditor(self.themes)
|
editor = MarkdownEditor(self.themes)
|
||||||
|
|
||||||
# Apply user’s preferred font size
|
|
||||||
self._apply_font_size(editor)
|
|
||||||
|
|
||||||
# Set up the editor's event connections
|
# Set up the editor's event connections
|
||||||
editor.currentCharFormatChanged.connect(lambda _f: self._sync_toolbar())
|
editor.currentCharFormatChanged.connect(lambda _f: self._sync_toolbar())
|
||||||
editor.cursorPositionChanged.connect(self._sync_toolbar)
|
editor.cursorPositionChanged.connect(self._sync_toolbar)
|
||||||
|
|
@ -916,15 +912,6 @@ class MainWindow(QMainWindow):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# ----------------- Some theme helpers -------------------#
|
# ----------------- Some theme helpers -------------------#
|
||||||
def _apply_font_size(self, editor: MarkdownEditor) -> None:
|
|
||||||
"""Apply the saved font size to a newly created editor."""
|
|
||||||
size = self.cfg.font_size
|
|
||||||
editor.qfont.setPointSize(size)
|
|
||||||
editor.setFont(editor.qfont)
|
|
||||||
# save size to settings
|
|
||||||
self.cfg.font_size = size
|
|
||||||
save_db_config(self.cfg)
|
|
||||||
|
|
||||||
def _retheme_overrides(self):
|
def _retheme_overrides(self):
|
||||||
self._apply_calendar_text_colors()
|
self._apply_calendar_text_colors()
|
||||||
self._apply_search_highlights(getattr(self, "_search_highlighted_dates", set()))
|
self._apply_search_highlights(getattr(self, "_search_highlighted_dates", set()))
|
||||||
|
|
@ -1008,8 +995,6 @@ class MainWindow(QMainWindow):
|
||||||
self._tb_numbers = lambda: self._call_editor("toggle_numbers")
|
self._tb_numbers = lambda: self._call_editor("toggle_numbers")
|
||||||
self._tb_checkboxes = lambda: self._call_editor("toggle_checkboxes")
|
self._tb_checkboxes = lambda: self._call_editor("toggle_checkboxes")
|
||||||
self._tb_alarm = self._on_alarm_requested
|
self._tb_alarm = self._on_alarm_requested
|
||||||
self._tb_font_larger = self._on_font_larger_requested
|
|
||||||
self._tb_font_smaller = self._on_font_smaller_requested
|
|
||||||
|
|
||||||
tb.boldRequested.connect(self._tb_bold)
|
tb.boldRequested.connect(self._tb_bold)
|
||||||
tb.italicRequested.connect(self._tb_italic)
|
tb.italicRequested.connect(self._tb_italic)
|
||||||
|
|
@ -1022,8 +1007,6 @@ class MainWindow(QMainWindow):
|
||||||
tb.alarmRequested.connect(self._tb_alarm)
|
tb.alarmRequested.connect(self._tb_alarm)
|
||||||
tb.insertImageRequested.connect(self._on_insert_image)
|
tb.insertImageRequested.connect(self._on_insert_image)
|
||||||
tb.historyRequested.connect(self._open_history)
|
tb.historyRequested.connect(self._open_history)
|
||||||
tb.fontSizeLargerRequested.connect(self._tb_font_larger)
|
|
||||||
tb.fontSizeSmallerRequested.connect(self._tb_font_smaller)
|
|
||||||
|
|
||||||
self._toolbar_bound = True
|
self._toolbar_bound = True
|
||||||
|
|
||||||
|
|
@ -1069,28 +1052,6 @@ class MainWindow(QMainWindow):
|
||||||
self.toolBar.actBullets.setChecked(bool(bullets_on))
|
self.toolBar.actBullets.setChecked(bool(bullets_on))
|
||||||
self.toolBar.actNumbers.setChecked(bool(numbers_on))
|
self.toolBar.actNumbers.setChecked(bool(numbers_on))
|
||||||
|
|
||||||
def _change_font_size(self, delta: int) -> None:
|
|
||||||
"""Change font size for all editor tabs and save the setting."""
|
|
||||||
old_size = self.cfg.font_size
|
|
||||||
new_size = old_size + delta
|
|
||||||
|
|
||||||
self.cfg.font_size = new_size
|
|
||||||
save_db_config(self.cfg)
|
|
||||||
|
|
||||||
# Apply font size change to all open editors
|
|
||||||
for i in range(self.tab_widget.count()):
|
|
||||||
ed = self.tab_widget.widget(i)
|
|
||||||
if not isinstance(ed, MarkdownEditor):
|
|
||||||
continue
|
|
||||||
ed.qfont.setPointSize(new_size)
|
|
||||||
ed.setFont(ed.qfont)
|
|
||||||
|
|
||||||
def _on_font_larger_requested(self) -> None:
|
|
||||||
self._change_font_size(+1)
|
|
||||||
|
|
||||||
def _on_font_smaller_requested(self) -> None:
|
|
||||||
self._change_font_size(-1)
|
|
||||||
|
|
||||||
# ----------- Alarms handler ------------#
|
# ----------- Alarms handler ------------#
|
||||||
def _on_alarm_requested(self):
|
def _on_alarm_requested(self):
|
||||||
"""Create a one-shot reminder based on the current line in the editor."""
|
"""Create a one-shot reminder based on the current line in the editor."""
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,9 @@ class MarkdownEditor(QTextEdit):
|
||||||
self.setAcceptRichText(False)
|
self.setAcceptRichText(False)
|
||||||
|
|
||||||
# Normal text
|
# Normal text
|
||||||
self.qfont = QFont()
|
font = QFont()
|
||||||
self.qfont.setPointSize(11)
|
font.setPointSize(10)
|
||||||
self.setFont(self.qfont)
|
self.setFont(font)
|
||||||
|
|
||||||
self._apply_line_spacing() # 1.25× initial spacing
|
self._apply_line_spacing() # 1.25× initial spacing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ def load_db_config() -> DBConfig:
|
||||||
tags = s.value("ui/tags", True, type=bool)
|
tags = s.value("ui/tags", True, type=bool)
|
||||||
time_log = s.value("ui/time_log", True, type=bool)
|
time_log = s.value("ui/time_log", True, type=bool)
|
||||||
locale = s.value("ui/locale", "en", type=str)
|
locale = s.value("ui/locale", "en", type=str)
|
||||||
font_size = s.value("ui/font_size", 11, type=int)
|
|
||||||
return DBConfig(
|
return DBConfig(
|
||||||
path=path,
|
path=path,
|
||||||
key=key,
|
key=key,
|
||||||
|
|
@ -54,7 +53,6 @@ def load_db_config() -> DBConfig:
|
||||||
tags=tags,
|
tags=tags,
|
||||||
time_log=time_log,
|
time_log=time_log,
|
||||||
locale=locale,
|
locale=locale,
|
||||||
font_size=font_size,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -68,4 +66,3 @@ def save_db_config(cfg: DBConfig) -> None:
|
||||||
s.setValue("ui/tags", str(cfg.tags))
|
s.setValue("ui/tags", str(cfg.tags))
|
||||||
s.setValue("ui/time_log", str(cfg.time_log))
|
s.setValue("ui/time_log", str(cfg.time_log))
|
||||||
s.setValue("ui/locale", str(cfg.locale))
|
s.setValue("ui/locale", str(cfg.locale))
|
||||||
s.setValue("ui/font_size", str(cfg.font_size))
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ class ToolBar(QToolBar):
|
||||||
historyRequested = Signal()
|
historyRequested = Signal()
|
||||||
insertImageRequested = Signal()
|
insertImageRequested = Signal()
|
||||||
alarmRequested = Signal()
|
alarmRequested = Signal()
|
||||||
fontSizeLargerRequested = Signal()
|
|
||||||
fontSizeSmallerRequested = Signal()
|
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(strings._("toolbar_format"), parent)
|
super().__init__(strings._("toolbar_format"), parent)
|
||||||
|
|
@ -75,14 +73,6 @@ class ToolBar(QToolBar):
|
||||||
self.actNormal.setShortcut("Ctrl+N")
|
self.actNormal.setShortcut("Ctrl+N")
|
||||||
self.actNormal.triggered.connect(lambda: self.headingRequested.emit(0))
|
self.actNormal.triggered.connect(lambda: self.headingRequested.emit(0))
|
||||||
|
|
||||||
self.actFontSmaller = QAction("N-", self)
|
|
||||||
self.actFontSmaller.setToolTip(strings._("toolbar_font_smaller"))
|
|
||||||
self.actFontSmaller.triggered.connect(self.fontSizeSmallerRequested)
|
|
||||||
|
|
||||||
self.actFontLarger = QAction("N+", self)
|
|
||||||
self.actFontLarger.setToolTip(strings._("toolbar_font_larger"))
|
|
||||||
self.actFontLarger.triggered.connect(self.fontSizeLargerRequested)
|
|
||||||
|
|
||||||
# Lists
|
# Lists
|
||||||
self.actBullets = QAction("•", self)
|
self.actBullets = QAction("•", self)
|
||||||
self.actBullets.setToolTip(strings._("toolbar_bulleted_list"))
|
self.actBullets.setToolTip(strings._("toolbar_bulleted_list"))
|
||||||
|
|
@ -142,8 +132,6 @@ class ToolBar(QToolBar):
|
||||||
self.actH2,
|
self.actH2,
|
||||||
self.actH3,
|
self.actH3,
|
||||||
self.actNormal,
|
self.actNormal,
|
||||||
self.actFontSmaller,
|
|
||||||
self.actFontLarger,
|
|
||||||
self.actBullets,
|
self.actBullets,
|
||||||
self.actNumbers,
|
self.actNumbers,
|
||||||
self.actCheckboxes,
|
self.actCheckboxes,
|
||||||
|
|
@ -166,8 +154,6 @@ class ToolBar(QToolBar):
|
||||||
self._style_letter_button(self.actH2, "H2")
|
self._style_letter_button(self.actH2, "H2")
|
||||||
self._style_letter_button(self.actH3, "H3")
|
self._style_letter_button(self.actH3, "H3")
|
||||||
self._style_letter_button(self.actNormal, "N")
|
self._style_letter_button(self.actNormal, "N")
|
||||||
self._style_letter_button(self.actFontSmaller, "N-")
|
|
||||||
self._style_letter_button(self.actFontLarger, "N+")
|
|
||||||
|
|
||||||
# Lists
|
# Lists
|
||||||
self._style_letter_button(self.actBullets, "•")
|
self._style_letter_button(self.actBullets, "•")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue