Commit d3a3e796 authored by Benjamin Jakimow's avatar Benjamin Jakimow
Browse files

MapView.currentLayer() prefers to return a layer from the current map canvas

Signed-off-by: Benjamin Jakimow's avatarBenjamin Jakimow <>
parent 3b83fdce
......@@ -479,7 +479,9 @@ class MapView(QFrame):
cl = self.mLayerTreeView.currentLayer()
if isinstance(cl, SensorProxyLayer):
sensor = cl.sensor()
for c in [c for c in self.mapCanvases() if c.tsd().sensor() == sensor]:
canvases = [c for c in self.mapCanvases() if c.tsd().sensor() == sensor]
canvases = sorted(canvases, key=lambda c: c is not self.currentMapCanvas())
for c in canvases:
for l in c.layers():
if isinstance(l, SensorProxyLayer):
return l
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment