From 7d924eda6139319e8425574f34501c0d2a0c109e Mon Sep 17 00:00:00 2001 From: brushtyler Date: Mon, 7 Jun 2010 21:55:03 +0000 Subject: [PATCH] import the modules without use the path git-svn-id: http://svn.osgeo.org/qgis/trunk@13684 c8812cc2-4d05-0410-92ff-de0c093fc19c --- python/plugins/GdalTools/GdalTools.py | 17 ++++------------- python/plugins/GdalTools/tools/doAbout.py | 13 +------------ 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/python/plugins/GdalTools/GdalTools.py b/python/plugins/GdalTools/GdalTools.py index 6784e9d9da97..86ed0b97b65f 100644 --- a/python/plugins/GdalTools/GdalTools.py +++ b/python/plugins/GdalTools/GdalTools.py @@ -29,20 +29,11 @@ req_mods = { "osgeo": "osgeo [python-gdal]" } try: - # Set up current path, so that we know where to look for modules - import os.path, sys - currentPath = os.path.dirname( __file__ ) - modulesPath = os.path.abspath( currentPath + '/tools' ) - sys.path.append( modulesPath ) - - import GdalTools_utils as Utils - - import doBuildVRT, doContour, doRasterize, doPolygonize, doMerge, doSieve, doProximity, doNearBlack - import doWarp, doGrid, doTranslate, doClipper, doInfo, doProjection, doOverview, doRgbPct, doPctRgb - import doSettings, doAbout - - sys.path.remove( modulesPath ) + 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 ) except ImportError, e: error_str = str(e) error_mod = error_str.replace( "No module named ", "" ) diff --git a/python/plugins/GdalTools/tools/doAbout.py b/python/plugins/GdalTools/tools/doAbout.py index f7cd60b8b9b7..8fefb1a18192 100644 --- a/python/plugins/GdalTools/tools/doAbout.py +++ b/python/plugins/GdalTools/tools/doAbout.py @@ -6,18 +6,7 @@ from qgis.gui import * from ui_dialogAbout import Ui_GdalToolsAboutDialog as Ui_Dialog - -# Set up current path, so that we know where to look for version -import os.path, sys -currentPath = os.path.dirname( __file__ ) -pluginPath = os.path.abspath( currentPath + "/.." ) -sys.path.append( pluginPath ) - -# prepended the module name, to avoid conflicts with other __init__ modules in search path -from GdalTools.__init__ import version - -sys.path.remove( pluginPath ) - +from GdalTools import version class GdalToolsAboutDialog(QDialog, Ui_Dialog):