Removed the unnecessary setted paths

git-svn-id: http://svn.osgeo.org/qgis/trunk@13682 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
brushtyler 2010-06-07 19:52:27 +00:00
parent 0770f170d8
commit b5819e3424
4 changed files with 33 additions and 19 deletions

View File

@ -25,25 +25,31 @@ from qgis.core import *
# Initialize Qt resources from file resources_rc.py
import resources_rc
# Import required modules and if missing show the right name of them
# Import required modules and if missing show the right module's name
req_mods = { "osgeo": "osgeo [python-gdal]" }
for k, v in req_mods.iteritems():
try:
exec( "import %s" % k )
except ImportError, e:
errorStr = str(e)
if len(v) > 0:
errorStr = errorStr.replace( k, v )
raise ImportError( errorStr )
# Set up current path, so that we know where to look for modules
import os.path, sys
currentPath = os.path.dirname( __file__ )
sys.path.append( os.path.abspath(os.path.dirname( __file__ ) + '/tools' ) )
import doBuildVRT, doContour, doRasterize, doPolygonize, doMerge, doSieve, doProximity, doNearBlack, doWarp, doGrid, doTranslate, doClipper
import doInfo, doProjection, doOverview, doRgbPct, doPctRgb, doSettings, doAbout
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 )
except ImportError, e:
error_str = str(e)
error_mod = error_str.replace( "No module named ", "" )
if req_mods.has_key( error_mod ):
error_str = error_str.replace( error_mod, req_mods[error_mod] )
raise ImportError( error_str )
import GdalTools_utils as Utils
class GdalTools:

View File

@ -1,3 +1,4 @@
FILE(GLOB INIT_FILE __init__.py)
FILE(GLOB PY_FILES *.py)
FILE(GLOB UI_FILES *.ui)
@ -5,5 +6,6 @@ PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
ADD_CUSTOM_TARGET(gdaltools_tools ALL DEPENDS ${PYUI_FILES})
INSTALL(FILES ${INIT_FILE} DESTINATION ${QGIS_DATA_DIR}/python/plugins/GdalTools/tools)
INSTALL(FILES ${PY_FILES} DESTINATION ${QGIS_DATA_DIR}/python/plugins/GdalTools/tools)
INSTALL(FILES ${PYUI_FILES} DESTINATION ${QGIS_DATA_DIR}/python/plugins/GdalTools/tools)

View File

@ -6,13 +6,19 @@ from qgis.core import *
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
# Set up current path, so that we know where to look for init file
currentPath = os.path.dirname( __file__ )
sys.path.append( os.path.abspath(os.path.dirname( __file__ )[:-6] ) )
# prepended the dir, to avoid conflicts with other __init__ modules in search path
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 )
class GdalToolsAboutDialog(QDialog, Ui_Dialog):
def __init__(self, iface):