<div dir="ltr"><div><div><div><div>Hi Victor,<br><br></div>Thanks a lot for this work !<br><br></div>I think this kind of script must ben called by Processing which can check if all the needed providers are well configured ( grass, otb, etc.). Menu item could then be removed (or just set inactive) if Processing finds any issue with each one.<br><br></div>Regards<br></div>Michaël<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-23 12:21 GMT+02:00 Victor Olaya <span dir="ltr"><<a href="mailto:volayaf@gmail.com" target="_blank">volayaf@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all<br>
<br>
As a first step to replace Raster and Vector menus with new menu<br>
entries that call Processing algorithms to avoid redundancy (as we<br>
have been discussing since sometime ago...), I have added a new method<br>
to Processing named addAlgorithmEntry. It adds a menu entry in the<br>
specified menu, which calls a Processign algorithm. Basically, it's an<br>
easy way of placing an entry point to a Processing algorithm outside<br>
of the Processing toolbox<br>
<br>
Usage is rather straight forward<br>
<br>
addAlgorithmEntry([name_of_algorithm], [menu_name], [submenu_name],<br>
[menuentry_text], [icon])<br>
<br>
The last two parameters can be ommited, and the original title and<br>
icon of the algorithm will be used.<br>
<br>
Here is an example, on how the Raster/Conversion menu could be<br>
replaced with this:<br>
<br>
import os<br>
from GdalTools import GdalTools<br>
from processing.gui.utils import addAlgorithmEntry<br>
from PyQt4.QtGui import *<br>
<br>
def addRasterAlgorithm(name, group, iconName):<br>
icon = QIcon(os.path.join(os.path.dirname(GdalTools.__file__),<br>
"icons", iconName + ".png"))<br>
addAlgorithmEntry(name, "Raster", group, icon = icon)<br>
<br>
addRasterAlgorithm("gdalogr:rasterize", "Conversion", "rasterize")<br>
addRasterAlgorithm("gdalogr:translate", "Conversion", "translate")<br>
addRasterAlgorithm("gdalogr:pcttorgb", "Conversion", "24-to-8-bits")<br>
addRasterAlgorithm("gdalogr:rgbtopct", "Conversion", "8-to-24-bits")<br>
addRasterAlgorithm("gdalogr:polygonize", "Conversion", "polygonize")<br>
<br>
<br>
Now it's a matter of making sure that all algorithms are replaceable<br>
with a Processing equivalent, and add more lines to the above a script<br>
for creating the full alternative menu structure.<br>
<br>
Then, that script can be called by Processing itself, or put it in a<br>
separate plugin that adds GDAL/OGR functionality based on Processing<br>
algorithms. (Paths to icons should be modified from the above example,<br>
of course)<br>
<br>
Let me know if you have questions or you want to help on this,<br>
<br>
Regards<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><br></div>