diff --git a/lizmap/dialogs/main.py b/lizmap/dialogs/main.py
index 03148b87..a418d95e 100755
--- a/lizmap/dialogs/main.py
+++ b/lizmap/dialogs/main.py
@@ -8,7 +8,7 @@
from typing import Optional
from qgis.core import Qgis, QgsApplication, QgsProject, QgsSettings
-from qgis.PyQt.QtCore import Qt
+from qgis.PyQt.QtCore import QSize, Qt
from qgis.PyQt.QtGui import QIcon, QImageReader, QPixmap
from qgis.PyQt.QtWidgets import (
QDialog,
@@ -121,6 +121,26 @@ def __init__(self, parent=None):
"HTML maptip which is the more powerful. This popup will be removed later for vector layer."
))
+ text = tr(
+ "Actions in Lizmap Web Client are similar to Actions in QGIS but it's using it's own "
+ "format. For now, creating a action requires manual editing of the action configuration file named below. "
+ "Please check the Lizmap documentation. There is the 'Feature' scope."
+ ).format(
+ "https://docs.qgis.org/latest/en/docs/user_manual/working_with_vector/vector_properties.html#"
+ "actions-properties",
+ online_lwc_help('publish/configuration/action_popup.html').url()
+ )
+ self.label_help_action.setText(text)
+ self.label_demo_action.setText(tr(
+ "See the online demo for an example, using actions in the 'Feature' scope."
+ ).format(
+ "https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=fire_hydrant_actions"))
+ self.label_file_action.setText(
+ tr("Configuration file") + " : ".format(self.action_file().parent)
+ + self.action_file().name + ""
+ )
+ self.label_file_action.setOpenExternalLinks(True)
+
def check_api_key_address(self):
""" Check the API key is provided for the address search bar. """
provider = self.liExternalSearch.currentData()
@@ -421,6 +441,7 @@ def display_message_bar(
def setup_icons(self):
""" Setup icons in the left menu. """
+ self.mOptionsListWidget.setIconSize(QSize(20, 20))
i = 0
# Information
@@ -494,6 +515,14 @@ def setup_icons(self):
self.mOptionsListWidget.item(i).setIcon(icon)
i += 1
+ # Actions
+ icon = QIcon()
+ icon.addFile(resources_path('icons', 'actions-white.svg'), mode=QIcon.Normal)
+ icon.addFile(resources_path('icons', 'actions-dark.svg'), mode=QIcon.Selected)
+ self.mOptionsListWidget.item(i).setIcon(icon)
+
+ i += 1
+
# Time manager
icon = QIcon()
icon.addFile(resources_path('icons', '13-timemanager-white.png'), mode=QIcon.Normal)
@@ -594,6 +623,19 @@ def check_cfg_file_exists(self) -> bool:
""" Return boolean if a CFG file exists for the given project. """
return self.cfg_file().exists()
+ def action_file(self) -> Path:
+ """ Return the path to the current action file. """
+ return Path(self.project.fileName() + '.action')
+
+ def check_action_file_exists(self) -> bool:
+ """ Return boolean if an action file exists for the given project. """
+ if self.action_file().is_file():
+ self.label_file_action_found.setText('✔')
+ return True
+
+ self.label_file_action_found.setText("" + tr('Not found') + "")
+ return False
+
def allow_navigation(self, allow_navigation: bool, message: str = ''):
""" Allow the navigation or not in the UI. """
for i in range(1, self.mOptionsListWidget.count()):
@@ -613,5 +655,6 @@ def allow_navigation(self, allow_navigation: bool, message: str = ''):
def activateWindow(self):
""" When the dialog displayed, to trigger functions in the plugin when the dialog is opening. """
self.check_project_thumbnail()
+ self.check_action_file_exists()
LOGGER.info("Opening the Lizmap dialog.")
super().activateWindow()
diff --git a/lizmap/plugin.py b/lizmap/plugin.py
index 5e2b0f5b..7ee6c51c 100755
--- a/lizmap/plugin.py
+++ b/lizmap/plugin.py
@@ -300,6 +300,8 @@ def write_log_message(message, tag, level):
self.dlg.list_group_visibility,
self.dlg.activate_first_map_theme,
self.dlg.activate_drawing_tools,
+ # Actions
+ self.dlg.label_help_action,
]
self.lwc_versions[LwcVersions.Lizmap_3_5] = [
self.dlg.liPopupSource.model().item(
@@ -333,10 +335,12 @@ def write_log_message(message, tag, level):
self.dlg.button_edit_dd_dataviz,
self.dlg.button_add_plot,
self.dlg.combo_plots,
- # Baselayers
+ # Base-layers
self.dlg.add_group_empty,
self.dlg.add_group_baselayers,
self.dlg.predefined_baselayers,
+ # New scopes in actions
+ self.dlg.label_action_scope_layer_project,
]
self.lizmap_dot_com = [
@@ -3828,6 +3832,9 @@ def on_project_read(self):
def run(self) -> bool:
"""Plugin run method : launch the GUI."""
+ self.dlg.check_action_file_exists()
+ self.dlg.check_project_thumbnail()
+
if self.dlg.isVisible():
# show dialog in front of QGIS
self.dlg.raise_()
diff --git a/lizmap/resources/icons/actions-dark.svg b/lizmap/resources/icons/actions-dark.svg
new file mode 100644
index 00000000..0c9c41fc
--- /dev/null
+++ b/lizmap/resources/icons/actions-dark.svg
@@ -0,0 +1 @@
+
diff --git a/lizmap/resources/icons/actions-white.svg b/lizmap/resources/icons/actions-white.svg
new file mode 100644
index 00000000..1199fc9b
--- /dev/null
+++ b/lizmap/resources/icons/actions-white.svg
@@ -0,0 +1,38 @@
+
+
diff --git a/lizmap/resources/ui/ui_lizmap.ui b/lizmap/resources/ui/ui_lizmap.ui
index 1c809147..0c67dcd7 100755
--- a/lizmap/resources/ui/ui_lizmap.ui
+++ b/lizmap/resources/ui/ui_lizmap.ui
@@ -148,6 +148,11 @@ QListWidget::item::selected {
Filter by user
+ -
+
+ Actions
+
+
-
Time manager
@@ -3872,6 +3877,68 @@ This is different to the map maximum extent (defined in QGIS project properties,
+
+
+ -
+
+
+ Help, set in Python
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Help demo action
+
+
+
+ -
+
+
+ Actions can have different scopes : 'Feature', 'Layer' or 'Project'.
+
+
+
+ -
+
+
-
+
+
+ PROJECT NAME, set in Python
+
+
+
+ -
+
+
+ Action found, set in Python
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+