Skip to content

Commit

Permalink
Delete image frames when images is None
Browse files Browse the repository at this point in the history
  • Loading branch information
fdiaz authored and fdiaz committed May 31, 2022
1 parent d83da14 commit 0d0e2f5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions certificadoCatastralVillaFloridaPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def btnGenerateCertificate_click(self, event):
geometry = feature.getDefaultGeometry()
encuadre = geometry.buffer(2).getEnvelope()
# Nos recorremos todos los elementos del mapa buscando los que hemos etiquetado
imageFrames = [None, None, None]
for elemento in context.getAllFFrames():
if elemento.getTag() == "VISTA":
# Ajustamos el encuadre de la vista al del elemento seleccionado
Expand All @@ -66,15 +67,22 @@ def btnGenerateCertificate_click(self, event):
elemento.clearText()
elemento.addText(feature.getString(name))

elif elemento.getTag() == "IMAGEN0" and len(images) > 0:
elif elemento.getTag() == "IMAGEN0":
elemento.setImage(images[0])
imageFrames[0] = elemento

elif elemento.getTag() == "IMAGEN1" and len(images) > 1:
elif elemento.getTag() == "IMAGEN1":
elemento.setImage(images[1])
imageFrames[1] = elemento

elif elemento.getTag() == "IMAGEN2" and len(images) > 2:
elif elemento.getTag() == "IMAGEN2":
elemento.setImage(images[2])
imageFrames[2] = elemento
break
for n in range(0,3):
if images[n] == None:
context.delFFrame(imageFrames[n])

context.fullRefresh()
layout.getLayoutControl().getLayoutDraw().initialize()

Expand Down

0 comments on commit 0d0e2f5

Please sign in to comment.