diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fe1e6f..32fd2d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Support saving the encryption key to the settings file to avoid being prompted (off by default) * Abbreviated toolbar symbols to keep things tidier. Add tooltips * Add ability to export the database to different formats + * Add Documentation/Help menu # 0.1.2 diff --git a/bouquin/main_window.py b/bouquin/main_window.py index f364779..7fe5498 100644 --- a/bouquin/main_window.py +++ b/bouquin/main_window.py @@ -4,10 +4,11 @@ import os import sys from pathlib import Path -from PySide6.QtCore import QDate, QTimer, Qt, QSettings, Slot +from PySide6.QtCore import QDate, QTimer, Qt, QSettings, Slot, QUrl from PySide6.QtGui import ( QAction, QCursor, + QDesktopServices, QFont, QGuiApplication, QTextCharFormat, @@ -146,6 +147,15 @@ class MainWindow(QMainWindow): nav_menu.addAction(act_today) self.addAction(act_today) + # Help menu with drop-down + help_menu = mb.addMenu("&Help") + act_docs = QAction("Documentation", self) + act_docs.setShortcut("Ctrl+D") + act_docs.setShortcutContext(Qt.ApplicationShortcut) + act_docs.triggered.connect(self._open_docs) + help_menu.addAction(act_docs) + self.addAction(act_docs) + # Autosave self._dirty = False self._save_timer = QTimer(self) @@ -388,6 +398,13 @@ class MainWindow(QMainWindow): except Exception as e: QMessageBox.critical(self, "Export failed", str(e)) + def _open_docs(self): + url_str = "https://git.mig5.net/mig5/bouquin/wiki/Help" + url = QUrl.fromUserInput(url_str) + if not QDesktopServices.openUrl(url): + QMessageBox.warning(self, "Open Documentation", + f"Couldn't open:\n{url.toDisplayString()}") + def closeEvent(self, event): try: # Save window position