Přidat odkaz na nápovědu do menu pluginu (#47)

* ikona amcr-help

* přidán kód pro otevření nápovědy
This commit is contained in:
david-spacil authored and GitHub committed 2026-06-05 13:27:01 +02:00
1 parent 830537f1a4
commit 4ea679ec9e
2 files changed
+17 -2

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

+17 -2
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication, QUrl
from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtGui import QIcon, QDesktopServices
from qgis.PyQt.QtWidgets import QMenu, QAction, QToolButton, QDialog from qgis.PyQt.QtWidgets import QMenu, QAction, QToolButton, QDialog
from qgis.core import Qgis from qgis.core import Qgis
@@ -91,6 +91,7 @@ class AmcrViewer:
# Define paths for action-specific icons # Define paths for action-specific icons
icon_akce_path = os.path.join(self.plugin_dir, 'akce.png') icon_akce_path = os.path.join(self.plugin_dir, 'akce.png')
icon_lokality_path = os.path.join(self.plugin_dir, 'lokality.png') icon_lokality_path = os.path.join(self.plugin_dir, 'lokality.png')
icon_amcr_help_path = os.path.join(self.plugin_dir, 'amcr-help.png')
# 1. Create a container menu for the plugin # 1. Create a container menu for the plugin
self.plugin_menu = QMenu() self.plugin_menu = QMenu()
@@ -128,6 +129,16 @@ class AmcrViewer:
) )
self.plugin_menu.addAction(self.action_login_dialog) self.plugin_menu.addAction(self.action_login_dialog)
self.action_amcr_help = self.add_action(
icon_path=icon_amcr_help_path,
text=self.tr(u'Nápověda AMČR Help | AMČR Viewer'),
callback=lambda checked=False: self.open_help(),
parent=self.iface.mainWindow(),
add_to_menu=False,
add_to_toolbar=False
)
self.plugin_menu.addAction(self.action_amcr_help)
# 3. Create the main project action and attach the menu to it # 3. Create the main project action and attach the menu to it
main_icon = QIcon(icon_akce_path) main_icon = QIcon(icon_akce_path)
self.main_action = QAction( self.main_action = QAction(
@@ -217,3 +228,7 @@ class AmcrViewer:
"v panelu Zprávy.", "v panelu Zprávy.",
level=Qgis.MessageLevel.Critical level=Qgis.MessageLevel.Critical
) )
def open_help(self):
help_url = "https://amcr-help.aiscr.cz/digiarchiv/qgis-viewer.html"
QDesktopServices.openUrl(QUrl(help_url))