Skip to content

Commit 65a397b

Browse files
authored
Merge pull request #736 from mind84/group_popup_by_layers
[Feature] Option to enable group popup by layers mode
2 parents 46a121a + e0136f5 commit 65a397b

5 files changed

Lines changed: 46 additions & 0 deletions

File tree

lizmap/config/global_options.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class GlobalOptionsDefinitions(TypedDict):
6565
automatic_permalink: ModelItem
6666
wms_single_request_for_all_layers: ModelItem
6767
exclude_basemaps_from_single_wms: ModelItem
68+
group_popup_by_layer: ModelItem
6869
tmTimeFrameSize: ModelItem
6970
tmTimeFrameType: ModelItem
7071
tmAnimationFrameLength: ModelItem
@@ -228,6 +229,15 @@ class GlobalOptionsDefinitions(TypedDict):
228229
"preserving their native format instead of converting to PNG."
229230
),
230231
},
232+
'group_popup_by_layer': {
233+
'wType': 'checkbox',
234+
'type': 'boolean',
235+
'default': False,
236+
'use_proper_boolean': True,
237+
'tooltip': tr(
238+
"When enabled, results will be displayed grouped by layer, and can be viewed individually."
239+
),
240+
},
231241
"tmTimeFrameSize": {"wType": "spinbox", "type": "integer", "default": 10},
232242
"tmTimeFrameType": {
233243
"wType": "list",

lizmap/plugin/lwc_versions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def configure_lwc_versions(dlg: LizmapDialog) -> OrderedDict:
222222
dlg.text_dxf_allowed_groups,
223223
dlg.button_dxf_wizard_group,
224224
dlg.label_dxf_layers_info,
225+
dlg.checkbox_group_popup_by_layer
225226
]
226227
lwc_versions[LwcVersions.Lizmap_3_11] = []
227228

lizmap/plugin/options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ def global_options(dlg: "LizmapDialog", lizmap_config: LizmapConfig) -> GlobalOp
7777
global_options["exclude_basemaps_from_single_wms"]["widget"] = (
7878
dlg.checkbox_exclude_basemaps_from_single_wms
7979
)
80+
global_options["group_popup_by_layer"]["widget"] = (
81+
dlg.checkbox_group_popup_by_layer
82+
)
8083

8184
global_options["tmTimeFrameSize"]["widget"] = dlg.inTimeFrameSize
8285
global_options["tmTimeFrameType"]["widget"] = dlg.liTimeFrameType

lizmap/resources/ui/ui_lizmap.ui

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,16 @@ This is different to the map maximum extent (defined in QGIS project properties,
14471447
</item>
14481448
</widget>
14491449
</item>
1450+
<item>
1451+
<widget class="QCheckBox" name="checkbox_group_popup_by_layer">
1452+
<property name="toolTip">
1453+
<string>Group popup results by layer</string>
1454+
</property>
1455+
<property name="text">
1456+
<string>Group popup by layer</string>
1457+
</property>
1458+
</widget>
1459+
</item>
14501460
<item>
14511461
<spacer name="horizontalSpacer">
14521462
<property name="orientation">
@@ -5948,6 +5958,7 @@ This is different to the map maximum extent (defined in QGIS project properties,
59485958
<tabstop>cbHideOverview</tabstop>
59495959
<tabstop>cbHideNavbar</tabstop>
59505960
<tabstop>liPopupContainer</tabstop>
5961+
<tabstop>checkbox_group_popup_by_layer</tabstop>
59515962
<tabstop>checkbox_scale_overview_map</tabstop>
59525963
<tabstop>repository_combo</tabstop>
59535964
<tabstop>scrollArea_7</tabstop>

tests/test_ui.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,3 +830,24 @@ def test_exclude_basemaps_from_single_wms_values(self, data: Path):
830830
# Disable single WMS - exclude basemaps checkbox should become disabled
831831
lizmap.dlg.checkbox_wms_single_request_all_layers.setChecked(False)
832832
self.assertFalse(lizmap.dlg.checkbox_exclude_basemaps_from_single_wms.isEnabled())
833+
834+
def test_group_popup_by_layer(self, data: Path):
835+
"""Test group popup by layer UI settings."""
836+
lizmap = self._setup_empty_project(data)
837+
838+
# Default checkbox states
839+
self.assertFalse(lizmap.dlg.checkbox_group_popup_by_layer.isChecked())
840+
841+
# Enable group popup by layer
842+
lizmap.dlg.checkbox_group_popup_by_layer.setChecked(True)
843+
self.assertTrue(lizmap.dlg.checkbox_group_popup_by_layer.isEnabled())
844+
845+
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False, ignore_error=True)
846+
# Group popup by layers option should be checked in output config file
847+
self.assertTrue(output["options"].get("group_popup_by_layer"))
848+
849+
# Disable group popup by layer
850+
lizmap.dlg.checkbox_group_popup_by_layer.setChecked(False)
851+
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False, ignore_error=True)
852+
# Group popup by layers option should be unchecked in output config file
853+
self.assertFalse(output["options"].get("group_popup_by_layer"))

0 commit comments

Comments
 (0)