[Qgis-developer] Re: GdalTools versions

Martin Dobias wonder.sk at gmail.com
Tue Jun 8 15:32:35 EDT 2010


Hi Giuseppe

2010/6/8 Giuseppe Sucameli <brush.tyler at gmail.com>:
> Hi Martin,
>
> now the modules import is done by the following lines:
> from tools import GdalTools_utils as Utils
> from tools import ( doBuildVRT, doContour, doRasterize, doPolygonize,
> doMerge, doSieve, doProximity, doNearBlack )
> from tools import ( doWarp, doGrid, doTranslate, doClipper, doInfo,
> doProjection, doOverview, doRgbPct, doPctRgb )
> from tools import ( doSettings, doAbout )
>
> and GdalTools works fine until I reload it.
> In fact, If I reload it I get this error:
> [...]

This is an error caused by the unloader of plugins - I've found out
that it fails to record the modules that are imported with syntax
"from X import Y" and that results in some inconsistencies. I'm going
to fix that soon.

On a different note, I have a performance hint for GdalTools:
It's not necessary to import all the do* modules at the startup. They
are necessary only when they're triggered from the menu, so the import
can be postponed to the point when they're needed and some time from
the qgis startup can be saved. I see you load all the modules to check
whether there aren't any missing dependencies. This could be actually
done even easier:

try:
  import osgeo.ogr
  import osgeo.gdal
except ImportError:
  # tell user about missing python-gdal


Regards
Martin


More information about the Qgis-developer mailing list