if a provier is enabled then qgis reads all algorithm's during
startup. This involves reading descriptor files and doing all parsing
required to make gui when user actually open algorithm (click on
treeitem).
So If I have like three provider enabled it takes more time to start qgis than
usual. Even though, I might open one or two later at some point. 

It is not necessary here to parse "all" data during startup.  name and
group name is only needed to fill provider-algorithm tree. This is
true for any provider which uses descriptor files (OTB, GRASS, SAGA etc..).

Issue is more about calling defineDescriptorFile() in Algorithm's
__init__ method. And ofcourse, one cannot avoid init when adding
algorithm and tree need to add an instance of algorithm. what can be
done?

There is canExecute() method in baseclass that providers can
override. so init method can read first two line or (single line?) to
fill algorithms tree. And canExecute() can do full parsing of
descriptor files.
I had tried this in OTB code and it seems to work!.

I don't know if there is a better way to implement this or it is
intentional to parse all descriptor files of all providers during
every startup.

I appreciate your comments and feedback on this improvement.

https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin/blob/master/otb/OTBAlgorithm.py#L48

-- 
Take care,
Rashad
_______________________________________________
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

Reply via email to