Skip to content

Commit b5819e3

Browse files
author
brushtyler
committedJun 7, 2010
Removed the unnecessary setted paths
git-svn-id: http://svn.osgeo.org/qgis/trunk@13682 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 0770f17 commit b5819e3

File tree

4 files changed

+35
-21
lines changed

4 files changed

+35
-21
lines changed
 

‎python/plugins/GdalTools/GdalTools.py

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,31 @@
2525
# Initialize Qt resources from file resources_rc.py
2626
import resources_rc
2727

28-
# Import required modules and if missing show the right name of them
28+
# Import required modules and if missing show the right module's name
2929
req_mods = { "osgeo": "osgeo [python-gdal]" }
30-
for k, v in req_mods.iteritems():
31-
try:
32-
exec( "import %s" % k )
33-
except ImportError, e:
34-
errorStr = str(e)
35-
if len(v) > 0:
36-
errorStr = errorStr.replace( k, v )
37-
raise ImportError( errorStr )
38-
39-
# Set up current path, so that we know where to look for modules
40-
import os.path, sys
41-
currentPath = os.path.dirname( __file__ )
42-
sys.path.append( os.path.abspath(os.path.dirname( __file__ ) + '/tools' ) )
43-
import doBuildVRT, doContour, doRasterize, doPolygonize, doMerge, doSieve, doProximity, doNearBlack, doWarp, doGrid, doTranslate, doClipper
44-
import doInfo, doProjection, doOverview, doRgbPct, doPctRgb, doSettings, doAbout
45-
46-
import GdalTools_utils as Utils
30+
31+
try:
32+
# Set up current path, so that we know where to look for modules
33+
import os.path, sys
34+
currentPath = os.path.dirname( __file__ )
35+
modulesPath = os.path.abspath( currentPath + '/tools' )
36+
sys.path.append( modulesPath )
37+
38+
import GdalTools_utils as Utils
39+
40+
import doBuildVRT, doContour, doRasterize, doPolygonize, doMerge, doSieve, doProximity, doNearBlack
41+
import doWarp, doGrid, doTranslate, doClipper, doInfo, doProjection, doOverview, doRgbPct, doPctRgb
42+
import doSettings, doAbout
43+
44+
sys.path.remove( modulesPath )
45+
46+
except ImportError, e:
47+
error_str = str(e)
48+
error_mod = error_str.replace( "No module named ", "" )
49+
if req_mods.has_key( error_mod ):
50+
error_str = error_str.replace( error_mod, req_mods[error_mod] )
51+
raise ImportError( error_str )
52+
4753

4854
class GdalTools:
4955

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
FILE(GLOB INIT_FILE __init__.py)
12
FILE(GLOB PY_FILES *.py)
23
FILE(GLOB UI_FILES *.ui)
34

45
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
56

67
ADD_CUSTOM_TARGET(gdaltools_tools ALL DEPENDS ${PYUI_FILES})
78

9+
INSTALL(FILES ${INIT_FILE} DESTINATION ${QGIS_DATA_DIR}/python/plugins/GdalTools/tools)
810
INSTALL(FILES ${PY_FILES} DESTINATION ${QGIS_DATA_DIR}/python/plugins/GdalTools/tools)
911
INSTALL(FILES ${PYUI_FILES} DESTINATION ${QGIS_DATA_DIR}/python/plugins/GdalTools/tools)

‎python/plugins/GdalTools/tools/__init__.py

Whitespace-only changes.

‎python/plugins/GdalTools/tools/doAbout.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
from qgis.gui import *
77

88
from ui_dialogAbout import Ui_GdalToolsAboutDialog as Ui_Dialog
9+
10+
# Set up current path, so that we know where to look for version
911
import os.path, sys
10-
# Set up current path, so that we know where to look for init file
1112
currentPath = os.path.dirname( __file__ )
12-
sys.path.append( os.path.abspath(os.path.dirname( __file__ )[:-6] ) )
13-
# prepended the dir, to avoid conflicts with other __init__ modules in search path
13+
pluginPath = os.path.abspath( currentPath + "/.." )
14+
sys.path.append( pluginPath )
15+
16+
# prepended the module name, to avoid conflicts with other __init__ modules in search path
1417
from GdalTools.__init__ import version
1518

19+
sys.path.remove( pluginPath )
20+
21+
1622
class GdalToolsAboutDialog(QDialog, Ui_Dialog):
1723

1824
def __init__(self, iface):

0 commit comments

Comments
 (0)
Please sign in to comment.