2010-06-04 00:31:48 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2012-10-06 13:10:25 +02:00
|
|
|
"""
|
|
|
|
***************************************************************************
|
|
|
|
doSettings.py
|
|
|
|
---------------------
|
|
|
|
Date : June 2010
|
|
|
|
Copyright : (C) 2010 by Giuseppe Sucameli
|
|
|
|
Email : brush dot tyler at gmail dot com
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************
|
|
|
|
"""
|
|
|
|
|
|
|
|
__author__ = 'Giuseppe Sucameli'
|
|
|
|
__date__ = 'June 2010'
|
|
|
|
__copyright__ = '(C) 2010, Giuseppe Sucameli'
|
|
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
|
|
|
__revision__ = '$Format:%H$'
|
|
|
|
|
2010-06-04 00:31:48 +00:00
|
|
|
from PyQt4.QtCore import *
|
|
|
|
from PyQt4.QtGui import *
|
|
|
|
from qgis.core import *
|
|
|
|
from qgis.gui import *
|
|
|
|
|
|
|
|
from ui_dialogSettings import Ui_GdalToolsSettingsDialog as Ui_Dialog
|
|
|
|
import GdalTools_utils as Utils
|
|
|
|
|
2011-12-01 01:56:32 +01:00
|
|
|
from .. import resources_rc
|
|
|
|
|
2010-06-04 00:31:48 +00:00
|
|
|
class GdalToolsSettingsDialog( QDialog, Ui_Dialog ):
|
|
|
|
def __init__( self, iface ):
|
|
|
|
QDialog.__init__( self, iface.mainWindow() )
|
2011-03-14 16:01:10 +00:00
|
|
|
self.setAttribute(Qt.WA_DeleteOnClose)
|
2010-06-04 00:31:48 +00:00
|
|
|
self.iface = iface
|
|
|
|
self.setupUi( self )
|
|
|
|
|
2011-12-01 01:56:32 +01:00
|
|
|
# binaries
|
2011-12-09 17:29:23 +01:00
|
|
|
self.leGdalBinPath.setText( Utils.getGdalBinPath() )
|
2010-06-04 00:31:48 +00:00
|
|
|
QObject.connect( self.btnSetBinPath, SIGNAL( "clicked()" ), self.setBinPath )
|
2011-12-01 01:56:32 +01:00
|
|
|
self.bin_tooltip_label.setPixmap( QPixmap(':/icons/tooltip.png') )
|
|
|
|
self.bin_tooltip_label.setToolTip( self.tr( \
|
2012-12-10 00:12:07 +01:00
|
|
|
u"""A list of colon-separated (Linux and MacOS) or
|
|
|
|
semicolon-separated (Windows) paths to both binaries
|
2011-12-09 17:29:23 +01:00
|
|
|
and python executables.
|
2011-12-01 01:56:32 +01:00
|
|
|
|
|
|
|
MacOS users usually need to set it to something like
|
|
|
|
/Library/Frameworks/GDAL.framework/Versions/1.8/Programs""") )
|
|
|
|
|
2011-12-09 17:29:23 +01:00
|
|
|
# python modules
|
|
|
|
self.leGdalPymodPath.setText( Utils.getGdalPymodPath() )
|
|
|
|
QObject.connect( self.btnSetPymodPath, SIGNAL( "clicked()" ), self.setPymodPath )
|
|
|
|
self.pymod_tooltip_label.setPixmap( QPixmap(':/icons/tooltip.png') )
|
|
|
|
self.pymod_tooltip_label.setToolTip( self.tr( \
|
2012-12-10 00:12:07 +01:00
|
|
|
u"""A list of colon-separated (Linux and MacOS) or
|
2011-12-09 17:29:23 +01:00
|
|
|
semicolon-separated (Windows) paths to python modules.""") )
|
|
|
|
|
2011-12-01 01:56:32 +01:00
|
|
|
# help
|
|
|
|
self.leGdalHelpPath.setText( Utils.getHelpPath() )
|
2010-11-11 15:33:29 +00:00
|
|
|
QObject.connect( self.btnSetHelpPath, SIGNAL( "clicked()" ), self.setHelpPath )
|
2011-12-01 01:56:32 +01:00
|
|
|
self.help_tooltip_label.setPixmap( QPixmap(':/icons/tooltip.png') )
|
|
|
|
self.help_tooltip_label.setToolTip( self.tr( \
|
2012-12-10 00:12:07 +01:00
|
|
|
u"""Useful to open local GDAL documentation instead of online help
|
2011-12-01 01:56:32 +01:00
|
|
|
when pressing on the tool dialog's Help button.""") )
|
|
|
|
|
2010-06-04 00:31:48 +00:00
|
|
|
|
|
|
|
def setBinPath( self ):
|
|
|
|
inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select directory with GDAL executables" ) )
|
2013-06-17 15:27:54 +02:00
|
|
|
if not inputDir:
|
2010-06-04 00:31:48 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
self.leGdalBinPath.setText( inputDir )
|
|
|
|
|
2011-12-09 17:29:23 +01:00
|
|
|
def setPymodPath( self ):
|
|
|
|
inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select directory with GDAL python modules" ) )
|
2013-06-17 15:27:54 +02:00
|
|
|
if not inputDir:
|
2011-12-09 17:29:23 +01:00
|
|
|
return
|
|
|
|
|
|
|
|
self.leGdalPymodPath.setText( inputDir )
|
|
|
|
|
2010-11-11 15:33:29 +00:00
|
|
|
def setHelpPath( self ):
|
|
|
|
inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select directory with the GDAL documentation" ) )
|
2013-06-17 15:27:54 +02:00
|
|
|
if not inputDir:
|
2010-11-11 15:33:29 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
self.leGdalHelpPath.setText( inputDir )
|
|
|
|
|
|
|
|
|
2010-06-04 00:31:48 +00:00
|
|
|
def accept( self ):
|
2011-12-09 17:29:23 +01:00
|
|
|
Utils.setGdalBinPath( self.leGdalBinPath.text() )
|
|
|
|
Utils.setGdalPymodPath( self.leGdalPymodPath.text() )
|
2010-11-11 15:33:29 +00:00
|
|
|
Utils.setHelpPath( self.leGdalHelpPath.text() )
|
2010-06-04 00:31:48 +00:00
|
|
|
QDialog.accept( self )
|
2011-12-09 17:29:23 +01:00
|
|
|
|