Add Help menu with documentation link

This commit is contained in:
Miguel Jacq 2025-11-02 13:11:05 +11:00
parent c9db440c85
commit c4091d4cee
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
2 changed files with 19 additions and 1 deletions

View file

@ -7,6 +7,7 @@
* Support saving the encryption key to the settings file to avoid being prompted (off by default) * 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 * Abbreviated toolbar symbols to keep things tidier. Add tooltips
* Add ability to export the database to different formats * Add ability to export the database to different formats
* Add Documentation/Help menu
# 0.1.2 # 0.1.2

View file

@ -4,10 +4,11 @@ import os
import sys import sys
from pathlib import Path 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 ( from PySide6.QtGui import (
QAction, QAction,
QCursor, QCursor,
QDesktopServices,
QFont, QFont,
QGuiApplication, QGuiApplication,
QTextCharFormat, QTextCharFormat,
@ -146,6 +147,15 @@ class MainWindow(QMainWindow):
nav_menu.addAction(act_today) nav_menu.addAction(act_today)
self.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 # Autosave
self._dirty = False self._dirty = False
self._save_timer = QTimer(self) self._save_timer = QTimer(self)
@ -388,6 +398,13 @@ class MainWindow(QMainWindow):
except Exception as e: except Exception as e:
QMessageBox.critical(self, "Export failed", str(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): def closeEvent(self, event):
try: try:
# Save window position # Save window position