Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed the unnecessary setted paths
git-svn-id: http://svn.osgeo.org/qgis/trunk@13682 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
brushtyler committed Jun 7, 2010
1 parent 0770f17 commit b5819e3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
42 changes: 24 additions & 18 deletions python/plugins/GdalTools/GdalTools.py
Expand Up @@ -25,25 +25,31 @@
# 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

import GdalTools_utils as Utils

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 )


class GdalTools:

Expand Down
2 changes: 2 additions & 0 deletions python/plugins/GdalTools/tools/CMakeLists.txt
@@ -1,9 +1,11 @@
FILE(GLOB INIT_FILE __init__.py)
FILE(GLOB PY_FILES *.py)
FILE(GLOB UI_FILES *.ui)

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)
Empty file.
12 changes: 9 additions & 3 deletions python/plugins/GdalTools/tools/doAbout.py
Expand Up @@ -6,13 +6,19 @@
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):
Expand Down

0 comments on commit b5819e3

Please sign in to comment.