Add Help menu with documentation link
This commit is contained in:
parent
c9db440c85
commit
c4091d4cee
2 changed files with 19 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue