Re: [QGIS-Developer] Skip loading plugin if errors

2022-12-29 Thread matteo via QGIS-Developer

Hi Germàn,

I successfully used also your code and it really works perfectly.

Thanks for sharing it!

Cheers

Matteo

On 12/28/22 10:40, Germán Carrillo wrote:

Hi Matteo,

I've added a few validations for this plugin to gently inform users of 
missing dependencies:


https://github.com/SwissTierrasColombia/Asistente-LADM-COL/blob/master/asistente_ladm_col/__init__.py
 


Hope that helps.

Regards,

Germán


El mié, 28 dic 2022 a las 9:58, matteo via QGIS-Developer 
(>) escribió:


Hi devs,

I'm developing a Processing provider plugin that needs some external
python packages. If these are not installed on the system, when
starting
QGIS and loading the plugin the error message pops up (of course).

Is there a way to have a "more friendly" message without opening the
Stacktrace? For example creating a messagebox/bar with the message
"Install the package.. else you cannot use the plugin"

I've added a simple try/except in the plugin classFactory method but
I'm
still stuck in the loop somewhere.

Thanks for any suggestion

Cheers

Matteo

___
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


Re: [QGIS-Developer] Skip loading plugin if errors

2022-12-28 Thread matteo via QGIS-Developer
Another solution, not the best one and working just because the plugin 
is a Processing provider would be to put


try:
import external_library
except ImportError:
raise QgsProcessingException(self.tr('This algorithm requires the 
Python .. library. Please install this library and try again.'))


within the processAlgorithm method. I know that if there are many 
algorithms you have to repeat the code for each one, and that if the 
algorithm has many parameters, the user fills all of them and it's not 
nice to inform after, but :)


Cheers

Matteo



On 12/28/22 10:40, Germán Carrillo wrote:

Hi Matteo,

I've added a few validations for this plugin to gently inform users of 
missing dependencies:


https://github.com/SwissTierrasColombia/Asistente-LADM-COL/blob/master/asistente_ladm_col/__init__.py
 


Hope that helps.

Regards,

Germán


El mié, 28 dic 2022 a las 9:58, matteo via QGIS-Developer 
(>) escribió:


Hi devs,

I'm developing a Processing provider plugin that needs some external
python packages. If these are not installed on the system, when
starting
QGIS and loading the plugin the error message pops up (of course).

Is there a way to have a "more friendly" message without opening the
Stacktrace? For example creating a messagebox/bar with the message
"Install the package.. else you cannot use the plugin"

I've added a simple try/except in the plugin classFactory method but
I'm
still stuck in the loop somewhere.

Thanks for any suggestion

Cheers

Matteo

___
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


Re: [QGIS-Developer] Skip loading plugin if errors

2022-12-28 Thread matteo via QGIS-Developer

Hola Germàn,

thanks for the suggestion! I'll try and let you know

Cheers

Matteo

On 12/28/22 10:40, Germán Carrillo wrote:

Hi Matteo,

I've added a few validations for this plugin to gently inform users of 
missing dependencies:


https://github.com/SwissTierrasColombia/Asistente-LADM-COL/blob/master/asistente_ladm_col/__init__.py
 


Hope that helps.

Regards,

Germán


El mié, 28 dic 2022 a las 9:58, matteo via QGIS-Developer 
(>) escribió:


Hi devs,

I'm developing a Processing provider plugin that needs some external
python packages. If these are not installed on the system, when
starting
QGIS and loading the plugin the error message pops up (of course).

Is there a way to have a "more friendly" message without opening the
Stacktrace? For example creating a messagebox/bar with the message
"Install the package.. else you cannot use the plugin"

I've added a simple try/except in the plugin classFactory method but
I'm
still stuck in the loop somewhere.

Thanks for any suggestion

Cheers

Matteo

___
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


Re: [QGIS-Developer] Skip loading plugin if errors

2022-12-28 Thread Germán Carrillo via QGIS-Developer
Hi Matteo,

I've added a few validations for this plugin to gently inform users of
missing dependencies:

https://github.com/SwissTierrasColombia/Asistente-LADM-COL/blob/master/asistente_ladm_col/__init__.py

Hope that helps.

Regards,

Germán


El mié, 28 dic 2022 a las 9:58, matteo via QGIS-Developer (<
qgis-developer@lists.osgeo.org>) escribió:

> Hi devs,
>
> I'm developing a Processing provider plugin that needs some external
> python packages. If these are not installed on the system, when starting
> QGIS and loading the plugin the error message pops up (of course).
>
> Is there a way to have a "more friendly" message without opening the
> Stacktrace? For example creating a messagebox/bar with the message
> "Install the package.. else you cannot use the plugin"
>
> I've added a simple try/except in the plugin classFactory method but I'm
> still stuck in the loop somewhere.
>
> Thanks for any suggestion
>
> Cheers
>
> Matteo
>
> ___
> 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


[QGIS-Developer] Skip loading plugin if errors

2022-12-28 Thread matteo via QGIS-Developer

Hi devs,

I'm developing a Processing provider plugin that needs some external 
python packages. If these are not installed on the system, when starting 
QGIS and loading the plugin the error message pops up (of course).


Is there a way to have a "more friendly" message without opening the 
Stacktrace? For example creating a messagebox/bar with the message 
"Install the package.. else you cannot use the plugin"


I've added a simple try/except in the plugin classFactory method but I'm 
still stuck in the loop somewhere.


Thanks for any suggestion

Cheers

Matteo

___
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