Skip to content

Commit

Permalink
Added docs to Help menu in application
Browse files Browse the repository at this point in the history
Under the help menu, the hdf5view documentation can
be opened by a click. A keyboard shortcut, platform
independent for the standard help key, is also provided.
  • Loading branch information
tgwoodcock committed Nov 27, 2024
1 parent 39908bb commit d3ef243
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/hdf5view/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
QRect,
QSettings,
Qt,
QUrl,
)
from qtpy.QtGui import (
QDesktopServices,
QIcon,
QKeySequence,
)
Expand Down Expand Up @@ -115,6 +117,15 @@ def init_actions(self):
triggered=self.handle_open_about,
)

self.docs_action = QAction(
QIcon("icons:hdf5view.ico"),
"&hdf5view documentation",
self,
statusTip="hdf5view docs",
triggered=self.handle_open_docs,
shortcut=QKeySequence.HelpContents,
)

#
# Plot/image actions
#
Expand Down Expand Up @@ -165,6 +176,7 @@ def init_menus(self):

# Help menu
self.help_menu = menu.addMenu("&Help")
self.help_menu.addAction(self.docs_action)
self.help_menu.addAction(self.about_action)

def init_toolbars(self):
Expand Down Expand Up @@ -401,6 +413,12 @@ def handle_open_about(self):
),
)

def handle_open_docs(self):
"""Link to the hdf5view documentation."""
url = QUrl("https://tgwoodcock.github.io/hdf5view")
if not QDesktopServices.openUrl(url):
QMessageBox.warning(self, "Open Url", "Could not open docs")

def handle_tree_selection_changed(self):
"""
Enable/disable the plots toolbar when
Expand Down

0 comments on commit d3ef243

Please sign in to comment.