[QGIS-Developer] Running python file from a different environment

2023-02-24 Thread Nzikou, Michel via QGIS-Developer
Hello,

I would like to know whether you can run or execute a diferent python file
via qgis console using a different environment?
Here i mean, i want to run it on its own environment where all dependecies
are set.

Thanks



-- 
*Michel Nzikou, Ph.D.*
ASEG WA - President
*-*
___
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] Additional python modules

2023-02-24 Thread Nyall Dawson via QGIS-Developer
On Sat, 25 Feb 2023, 1:24 am Yoann Quenach de Quivillic via QGIS-Developer,
 wrote:

> Hello everyone,
>
> I'm working on a new feature targeting 3.32 to reformat code written in
> the Python Console Editor : https://github.com/qgis/QGIS/pull/51733. It
> works great, but it requires additional python packages to be installed
> (namely black / autopep8 / isort).
>
> *Is there a reliable cross platform way we can use to distribute
> additional python packages alongside QGIS? *
>
> I could rewrite my PR to enable this feature only if the required modules
> are installed, but it seems kind of a shame... An alternative would be, as
> discussed in (
> https://github.com/qgis/QGIS/pull/51733#issuecomment-1434646910) to
> provide the end user a way to dynamically install modules as needed.
>


Black is a rather heavy library to add as a mandatory dependency, and it's
not safe to assume it's always available everywhere (eg last I checked it's
not available through the Fedora repos).

I think leaving the conditional checks is needed, but its definitely it's
worth exploring if the dependencies can be added to the default windows
install...

Nyall


> Any thoughts?
> Thanks,
>
> *--*
> *Yoann Quenach de Quivillic  *
> ___
> 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 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] updating a model on the site

2023-02-24 Thread Nicolas Cadieux via QGIS-Developer
Hi,
I have a 3 models that have been improved (Fix Directional Network,
Check Geometries, model 1 of 3.)  and fixed. I presented today at the
QGIS OpenDay.

I had to remove the "Snap to anchor nodes (single layer only)" as it
was creating invalid geometries in QGIS 3.28.2-Firenze on Windows 11.

I am not sure exactly how to upload the new models? I see the upload
button but I am wondering what will happen to the old ones? Will they
be removed by someone managing the site?  Can we have multiple
versions of the model as I am using the new repair geometry tools
unavailable before 3.28? Is it possible to modify a models'
description myself or must I send and email somewhere?

Thanks
Nicolas Cadieux
___
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] PyQGIS code: setting filter expression for value relation widget

2023-02-24 Thread Andreas Neumann via QGIS-Developer
Hi Germán,

Thank you so much for these suggestions and code snippets.

I also came across the QgsEditorWidgetSetup - but had no idea how to use
it. The Python cookbook did not mention it. The cookbook is really great -
but for interactive forms, there is not so much information.

I will try it and report back.

Thank you very much Germán,
Andreas


On Sun, 19 Feb 2023 at 00:59, Germán Carrillo via QGIS-Developer <
qgis-developer@lists.osgeo.org> wrote:

> Hi Andreas,
>
>
> you can modify your Value Relation widget's filter expression using the
> QgsEditorWidgetSetup class, in this way:
>
> 1) Get the editor widget setup and get a copy of its config dictionary:
>
> ews = layer.editorWidgetSetup(3)  # *Let's assume your Value Relation
> widget is set for a field with index 3*
> new_config = ews.config()  # *We'll use the current config as a basis
> to modify only the filter expression*
>
> 2) Modify the config dict's filter expression:
>
> new_config['FilterExpression'] = 'your new expression'
>
> 3) Apply changes to your layer:
>
> new_ews = QgsEditorWidgetSetup('ValueRelation', new_config)
> layer.setEditorWidgetSetup(3, new_ews)  # *Remember that 3
> corresponds to the field index*
>
> And that's it! You should have now a different set of values in the Value
> Relation widget.
>
>
> Regards,
>
> Germán
>
>
>
> El lun, 13 feb 2023 a las 5:40, Andreas Neumann via QGIS-Developer (<
> qgis-developer@lists.osgeo.org>) escribió:
>
>> Hi,
>>
>> I am looking for a code snippet in PyQGIS: how can I change the filter
>> expression for a value relation widget?
>>
>> Technically, the widget seems to be a QComboBox. I can get access to the
>> combobox, e.g. to get the current value - but how can I access the QGIS
>> related functionality, like changing programmatically settings of the value
>> relation widget , such as the filter expression? I found the
>> QgsValueRelationFieldFormatter object, but it doesn't allow me to change
>> the filter expression. Any idea how I would change the filter expression
>> using Python?
>>
>> Thank you for any hints,
>>
>> Andreas
>> ___
>> 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
>>
>
> --
> ---
>|\__
> (:>__)(
>|/
> Soluciones Geoinformáticas Libres
> http://geotux.tuxfamily.org/
> https://twitter.com/GeoTux2 
>
> 
> ___
> 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
>


-- 

--
Andreas Neumann
QGIS.ORG board member (treasurer)
___
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] Additional python modules

2023-02-24 Thread Alessandro Pasotti via QGIS-Developer
Hi,

last time I checked there wasn't, mainly because the PIP API wasn't exposed.

The standard way to go is ask Juergen to add the packages you need to
the QGIS package recipes.


On Fri, Feb 24, 2023 at 4:24 PM Yoann Quenach de Quivillic via
QGIS-Developer  wrote:
>
> Hello everyone,
>
> I'm working on a new feature targeting 3.32 to reformat code written in the 
> Python Console Editor : https://github.com/qgis/QGIS/pull/51733. It works 
> great, but it requires additional python packages to be installed (namely 
> black / autopep8 / isort).
>
> Is there a reliable cross platform way we can use to distribute additional 
> python packages alongside QGIS?
>
> I could rewrite my PR to enable this feature only if the required modules are 
> installed, but it seems kind of a shame... An alternative would be, as 
> discussed in 
> (https://github.com/qgis/QGIS/pull/51733#issuecomment-1434646910) to provide 
> the end user a way to dynamically install modules as needed.
>
> Any thoughts?
> Thanks,
>
> --
> Yoann Quenach de Quivillic
> ___
> 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



-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it
___
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] Additional python modules

2023-02-24 Thread Yoann Quenach de Quivillic via QGIS-Developer
Hello everyone,

I'm working on a new feature targeting 3.32 to reformat code written in the
Python Console Editor : https://github.com/qgis/QGIS/pull/51733. It works
great, but it requires additional python packages to be installed (namely
black / autopep8 / isort).

*Is there a reliable cross platform way we can use to distribute additional
python packages alongside QGIS? *

I could rewrite my PR to enable this feature only if the required modules
are installed, but it seems kind of a shame... An alternative would be, as
discussed in (
https://github.com/qgis/QGIS/pull/51733#issuecomment-1434646910) to provide
the end user a way to dynamically install modules as needed.

Any thoughts?
Thanks,

*--*
*Yoann Quenach de Quivillic  *
___
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]
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


[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