Re: [QGIS-Developer] parameterAsEnumStrings always return default value

2023-04-02 Thread Andrea Giudiceandrea via QGIS-Developer

Hi Nicolas,
it seems to me this https://github.com/qgis/QGIS/pull/52143 PR (which is 
awaiting for reviews) may be related to your questions.


Best regards.

Andrea Giudiceandrea
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] parameterAsEnumStrings always return default value

2023-02-24 Thread Nicolas Godet via QGIS-Developer
Hi Andrea,

Thanks for your reply.
The doc should reflect this weird (I believe) behavior.

Setting "usesStaticStrings=True" and "defaultValue="2023" and with 
parameterAsEnumString I have expected behavior but parameterAsEnum is broken...
Not easy...

I think I will fill an issue as the doc should should be more explicit or 
behavior fixed.





De : QGIS-Developer  de la part de 
Andrea Giudiceandrea via QGIS-Developer 
Envoyé : vendredi 24 février 2023 17:50
À : qgis-developer@lists.osgeo.org 
Objet : Re: [QGIS-Developer] parameterAsEnumStrings always return default value

Il 24/02/2023 17:37, Andrea Giudiceandrea ha scritto:
In addition, the parameter defaultValue should be set to a single value and not 
to a list if allowMultiple is set to False.
... and it should be populated with the index number (allowMultiple=False) or a 
list of index numbers (allowMultiple=True) when usesStaticStrings is set to 
False and with the value (allowMultiple=False) or a list of values 
(allowMultiple=True) when usesStaticStrings is set to True.

Andrea
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] parameterAsEnumStrings always return default value

2023-02-24 Thread Andrea Giudiceandrea via QGIS-Developer

Il 24/02/2023 17:37, Andrea Giudiceandrea ha scritto:
|In addition, the parameter defaultValue should be set to a single 
value and not to a list if ||allowMultiple is set to False.|
|... and it should be populated with the index number 
(|allowMultiple=False) |or a list of index numbers 
(|allowMultiple=True) when |usesStaticStrings is set to False 
and ||with the value |||(|allowMultiple=False) ||or a list of values 
|||(|allowMultiple=True) when |usesStaticStrings is set to True.


Andrea
||___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] parameterAsEnumStrings always return default value

2023-02-24 Thread Andrea Giudiceandrea via QGIS-Developer

Hi Nicolas,
I don't know if it is the intended behaviour, anyway it seems to me 
parameterAsEnumString and parameterAsEnumStrings return the correct 
value when |usesStaticStrings is set to True, while parameterAsEnum and 
parameterAsEnums when ||usesStaticStrings is set to False.


In addition, the parameter defaultValue should be set to a single value 
and not to a list if ||allowMultiple is set to False.


Best regards.

Andrea Giudiceandrea
|
Il 24/02/2023 14:11, Nicolas Godet via QGIS-Developer ha scritto:
I noticed in a custom alg that `parameterAsEnumStrings` always return 
the default value set in QgsProcessingParameterEnum.___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] parameterAsEnumStrings always return default value

2023-02-24 Thread Nicolas Godet via QGIS-Developer
I updated the snippet parameterAsEnumString return an empty value.

De : QGIS-Developer  de la part de 
Nicolas Godet via QGIS-Developer 
Envoyé : vendredi 24 février 2023 14:11
À : qgis-developer@lists.osgeo.org 
Objet : [QGIS-Developer] parameterAsEnumStrings always return default value

Dear devs,

I noticed in a custom alg that `parameterAsEnumStrings` always return the 
default value set in QgsProcessingParameterEnum.
Below a example alg to reproduce.

i prefere to start with an email before raising an issue as I could miss 
something

In alg window select any value different from 2023 (ex: 2020, index 3 in list).
Run alg
See info in log:

"""
Version de QGIS : 3.28.3-Firenze

Révision du code : c12bcb2f76c

Version de Qt : 5.15.3

Version de Python : 3.9.5

Version de GDAL : 3.6.2

Version de GEOS : 3.11.1-CAPI-1.17.1

Version de Proj : Rel. 9.1.1, December 1st, 2022

Version de PDAL : 2.4.3 (git-version: f8d673)

Algorithme commencé à: 2023-02-24T14:10:09

Démarrage de l'algorithme 'debug'…

Paramètres en entrée:

{ 'PARAMNAME' : 3 }


['2023', '2022', '2021', '2020']

[3]

2023

Execution completed in 0.02 secondes

Résultats :

{}


Chargement des couches de résultat

Algorithme 'debug' terminé

"""

Regards,

https://gitlab.nicodet.fr/-/snippets/10
[https://gitlab.nicodet.fr/assets/twitter_card-570ddb06edf56a2312253c5872489847a0f385112ddbcd71ccfa1570febab5d2.jpg]<https://gitlab.nicodet.fr/-/snippets/10>
Script debug parameterAsEnumStrings ($10) · Snippets · Snippets · 
GitLab<https://gitlab.nicodet.fr/-/snippets/10>
GitLab Community Edition
gitlab.nicodet.fr


___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] parameterAsEnumStrings always return default value

2023-02-24 Thread Nicolas Godet via QGIS-Developer
Dear devs,

I noticed in a custom alg that `parameterAsEnumStrings` always return the 
default value set in QgsProcessingParameterEnum.
Below a example alg to reproduce.

i prefere to start with an email before raising an issue as I could miss 
something

In alg window select any value different from 2023 (ex: 2020, index 3 in list).
Run alg
See info in log:

"""
Version de QGIS : 3.28.3-Firenze

Révision du code : c12bcb2f76c

Version de Qt : 5.15.3

Version de Python : 3.9.5

Version de GDAL : 3.6.2

Version de GEOS : 3.11.1-CAPI-1.17.1

Version de Proj : Rel. 9.1.1, December 1st, 2022

Version de PDAL : 2.4.3 (git-version: f8d673)

Algorithme commencé à: 2023-02-24T14:10:09

Démarrage de l'algorithme 'debug'…

Paramètres en entrée:

{ 'PARAMNAME' : 3 }


['2023', '2022', '2021', '2020']

[3]

2023

Execution completed in 0.02 secondes

Résultats :

{}


Chargement des couches de résultat

Algorithme 'debug' terminé

"""

Regards,

https://gitlab.nicodet.fr/-/snippets/10
[https://gitlab.nicodet.fr/assets/twitter_card-570ddb06edf56a2312253c5872489847a0f385112ddbcd71ccfa1570febab5d2.jpg]
Script debug parameterAsEnumStrings ($10) · Snippets · Snippets · 
GitLab
GitLab Community Edition
gitlab.nicodet.fr


___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer