<div dir="ltr">You can try<div><br></div><div>iface.layerTreeView().refreshLayerSymbology(<a href="http://layer.id">layer.id</a>())<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié, 9 nov 2022 a las 18:53, Hugh Kelley (<<a href="mailto:hghklly@gmail.com">hghklly@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I finally found time to try this and it worked very well. Thank you!<br></div><div><br></div><div>one follow up question I have is that I can make the change visible by running layer.triggerRepaint(). <br></div><div><br></div><div>That does not refresh the values in the layer styling panel. I need select a different layer and then select the original in order to see the changes I've made in pyqgis. Is there a command that will refresh that pane?</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 23, 2022 at 5:11 AM Francisco Puga <<a href="mailto:fpuga@icarto.es" target="_blank">fpuga@icarto.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This should work when working with SingleLabels<br>
<br>
layer = iface.activeLayer()<br>
settings = layer.labeling().settings()<br>
textFormat = settings.format()<br>
textFormat.setSize(20);<br>
settings.setFormat(textFormat)<br>
layer.labeling().setSettings(settings)<br>
<br>
hope it helps<br>
<br>
El vie, 21 oct 2022 a las 18:18, Hugh Kelley via QGIS-Developer<br>
(<<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>>) escribió:<br>
><br>
> Hi,<br>
><br>
> I'm hoping to make some scripts for labelling layers.<br>
><br>
> I've found the basic labelling settings in<br>
><br>
>     layer = iface.activeLayer()layer.labeling().settings().format().size()<br>
><br>
> for example, and it seems that I could be able to update that with an object like<br>
><br>
>     newsize = QgsTextFormat()<br>
>     newsize.setSize(20)<br>
> but I haven't yet found the correct way to update the layer's value.<br>
><br>
> it seems like it needs to be passed an entire new `QgsPalLayerSettings` object but I haven't found a way to build a complete object.<br>
><br>
> I've seen `readFromLayer()` but I'm guessing that was a version 2 method that's no longer available in version 3.<br>
><br>
> any pointers or a simple piece of code for updating a layer labelling property would be hugely appreciated.<br>
><br>
> it also occurs to me to ask whether there is anything like:<br>
><br>
>     print(layer.renderer().symbol().symbolLayers()[0].properties())<br>
><br>
> that returns a dict of the layer symbology properties for a label.<br>
><br>
> Another helpful thing would be code that imports a label definition from an exported xml file.<br>
><br>
> thanks,<br>
><br>
> hugh<br>
><br>
> _______________________________________________<br>
> QGIS-Developer mailing list<br>
> <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<br>
<br>
<br>
-- <br>
Francisco Puga<br>
iCarto | Innovación, Cooperación, Cartografía y Territorio S.L.<br>
<a href="https://icarto.es" rel="noreferrer" target="_blank">https://icarto.es</a><br>
<br>
c/ Rafael Alberti nº 13 – 1º D<br>
15008 A Coruña<br>
Galicia (Spain)<br>
+34 881927808<br>
<br>
Este correo electrónico contiene información estrictamente<br>
confidencial y es de uso exclusivo del destinatario, quedando<br>
prohibida a cualquier otra persona su revelación, copia, distribución,<br>
o el ejercicio de cualquier acción relativa a su contenido. Si ha<br>
recibido este mensaje por error, por favor conteste a su remitente<br>
mediante correo electrónico y proceda a borrarlo de su sistema.<br>
<br>
Sus datos personales serán tratados de forma confidencial y no serán<br>
cedidos a terceros ajenos a ICARTO. En cualquier caso, podrá ejercer<br>
los derecho de oposición, acceso, rectificación y cancelación de<br>
acuerdo con lo establecido en la Ley Orgánica 15/99, de 13 de<br>
diciembre, de Protección de Datos de Carácter Personal dirigiéndose a<br>
Innovación, Cooperación, Cartografía e Territorio, SL. (ICARTO) en la<br>
dirección postal a C/ Rafael Alberti, nº 13, 1ºD, 15.008 – (A Coruña).<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Hugh Kelley       <br><div><br></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Francisco Puga</div><div>iCarto | Innovación, Cooperación, Cartografía y Territorio S.L.</div><div><a href="https://icarto.es/" target="_blank">https://icarto.es</a></div><div><br></div><div>c/ Rafael Alberti nº 13 – 1º D</div><div>15008 A Coruña</div><div>Galicia (Spain)</div><div>+34 881927808</div><div><br></div><div>Este correo electrónico contiene información estrictamente confidencial y es de uso exclusivo del destinatario, quedando prohibida a cualquier otra persona su revelación, copia, distribución, o el ejercicio de cualquier acción relativa a su contenido. Si ha recibido este mensaje por error, por favor conteste a su remitente mediante correo electrónico y proceda a borrarlo de su sistema.</div><div><br></div><div>Sus datos personales serán tratados de forma confidencial y no serán cedidos a terceros ajenos a ICARTO. En cualquier caso, podrá ejercer los derecho de oposición, acceso, rectificación y cancelación de acuerdo con lo establecido en la Ley Orgánica 15/99, de 13 de diciembre, de Protección de Datos de Carácter Personal dirigiéndose a Innovación, Cooperación, Cartografía e Territorio, SL. (ICARTO) en la dirección postal a C/ Rafael Alberti, nº 13, 1ºD, 15.008 – (A Coruña).</div></div></div>