Skip to content

Commit

Permalink
indentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Mar 31, 2013
1 parent b27b6a9 commit 839e5ed
Show file tree
Hide file tree
Showing 25 changed files with 168 additions and 170 deletions.
2 changes: 1 addition & 1 deletion python/plugins/sextante/SextantePlugin.py
Expand Up @@ -41,7 +41,7 @@

cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0]
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
sys.path.insert(0, cmd_folder)

class SextantePlugin:

Expand Down
14 changes: 7 additions & 7 deletions python/plugins/sextante/core/AlgorithmProvider.py
Expand Up @@ -86,21 +86,21 @@ def getDescription(self):
return "Generic algorithm provider"

def getPostProcessingErrorMessage(self, wrongLayers):
'''Returns the message to be shown to the user when after running an algorithm for this provider,
there is a problem loading the resulting layer.
This method should analyze if the problem is caused by wrong entry data, a wrong or missing
'''Returns the message to be shown to the user when after running an algorithm for this provider,
there is a problem loading the resulting layer.
This method should analyze if the problem is caused by wrong entry data, a wrong or missing
installation of a required 3rd party app, or any other cause, and create an error response accordingly.
Message is provided as an HTML code that will be displayed to the user, and which might contains
links to installation paths for missing 3rd party apps.
- wrongLayers: a list of Output objects that could not be loaded.'''
html ="<p>Oooops! SEXTANTE could not open the following output layers</p><ul>\n"
- wrongLayers: a list of Output objects that could not be loaded.'''

html ="<p>Oooops! SEXTANTE could not open the following output layers</p><ul>\n"
for layer in wrongLayers:
html += '<li>' + layer.description + ': <font size=3 face="Courier New" color="ff0000">' + layer.value + "</font></li>\n"
html +="</ul><p>The above files could not be opened, which probably indicates that they were not correctly produced by the executed algorithm</p>"
html +="<p>Checking the log information might help you see why those layers were not created as expected</p>"
return html

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png")

Expand Down
12 changes: 6 additions & 6 deletions python/plugins/sextante/gui/CouldNotLoadResultsDialog.py
Expand Up @@ -32,20 +32,20 @@ class CouldNotLoadResultsDialog(QtGui.QDialog):
def __init__(self, wrongLayers, alg):
QtGui.QDialog.__init__(self, None, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
self.alg = alg
self.wrongLayers = wrongLayers
self.setupUi()
self.wrongLayers = wrongLayers
self.setupUi()

def setupUi(self):
self.resize(800,400)
self.setWindowTitle("Problem loading output layers")
layout = QVBoxLayout()
webView = QtWebKit.QWebView()
webView = QtWebKit.QWebView()
webView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
webView.connect(webView, SIGNAL("linkClicked(const QUrl&)"), self.linkClicked)
html = self.alg.provider.getPostProcessingErrorMessage(self.wrongLayers)
webView.setHtml(html)
closeButton = QtGui.QPushButton()
closeButton.setText("Close")
closeButton.setText("Close")
QObject.connect(closeButton, QtCore.SIGNAL("clicked()"), self.closeButtonPressed)
layout.addWidget(webView)
layout.addWidget(closeButton)
Expand All @@ -54,6 +54,6 @@ def setupUi(self):

def linkClicked(self, url):
webbrowser.open(str(url.toString()))
def closeButtonPressed(self):

def closeButtonPressed(self):
self.close()
4 changes: 2 additions & 2 deletions python/plugins/sextante/gui/SextantePostprocessing.py
Expand Up @@ -71,9 +71,9 @@ def handleAlgorithmResults(alg, progress, showResults = True):
QApplication.restoreOverrideCursor()
dlg = CouldNotLoadResultsDialog(wrongLayers, alg)
dlg.exec_()

if showResults and htmlResults and not wrongLayers:
QApplication.restoreOverrideCursor()
dlg = ResultsDialog()
dlg.exec_()

4 changes: 2 additions & 2 deletions python/plugins/sextante/modeler/ModelerAlgorithm.py
Expand Up @@ -153,7 +153,7 @@ def openModel(self, filename):
try:
dependencies.append(int(index))
except:
pass #a quick fix fwhile I figure out how to solve problems when parsing this
pass #a quick fix fwhile I figure out how to solve problems when parsing this
for param in alg.parameters:
line = lines.readline().strip("\n").strip("\r")
if line==str(None):
Expand Down Expand Up @@ -303,7 +303,7 @@ def getDependsOnAlgorithms(self, algIndex):
'''This method returns a list with the indexes of algorithms a given one depends on'''
algs = []
algs.extend(self.dependencies[algIndex])
index = -1
index = -1
for aap in self.algParameters[algIndex].values():
index += 1
if aap is not None:
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/sextante/modeler/ModelerDialog.py
Expand Up @@ -73,7 +73,7 @@ def __init__(self, alg=None):
self.openButton.setToolTip(self.tr("Open existing model"))
self.buttonBox.addButton(self.openButton, QDialogButtonBox.ActionRole)
self.saveButton = QPushButton(self.tr("Save"))
self.saveButton.setToolTip(self.tr("Save current model"))
self.saveButton.setToolTip(self.tr("Save current model"))
self.buttonBox.addButton(self.saveButton, QDialogButtonBox.ActionRole)
self.saveAsButton = QPushButton(self.tr("Save as ..."))
self.saveAsButton.setToolTip(self.tr("Save current model as"))
Expand Down Expand Up @@ -144,12 +144,12 @@ def runModel(self):
alg = self.alg.getCopy()
dlg = ParametersDialog(alg)
dlg.exec_()

def save(self):
self.saveModel(False)

def saveAs(self):
self.saveModel(True)
self.saveModel(True)

def saveModel(self, saveAs):
if unicode(self.textGroup.text()).strip() == "" or unicode(self.textName.text()).strip() == "":
Expand Down Expand Up @@ -210,7 +210,7 @@ def repaintModel(self):
self.scene = ModelerScene()
self.scene.setSceneRect(QRectF(0, 0, ModelerAlgorithm.CANVAS_SIZE, ModelerAlgorithm.CANVAS_SIZE))
self.scene.paintModel(self.alg)
self.view.setScene(self.scene)
self.view.setScene(self.scene)

def addInput(self):
item = self.inputsTree.currentItem()
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/sextante/saga/SagaAlgorithm.py
Expand Up @@ -101,7 +101,7 @@ def defineCharacteristicsFromFile(self):
self.group = SagaGroupNameDecorator.getDecoratedName(self.undecoratedGroup)
while line != "":
line = line.strip("\n").strip()
if line.startswith("Hardcoded"):
if line.startswith("Hardcoded"):
self.hardcodedStrings.append(line[len("Harcoded|")+1:])
elif line.startswith("Parameter"):
self.addParameter(ParameterFactory.getFromString(line))
Expand Down Expand Up @@ -237,11 +237,11 @@ def processAlgorithm(self, progress):
command = self.undecoratedGroup + " \"" + self.cmdname + "\""
else:
command = "lib" + self.undecoratedGroup + " \"" + self.cmdname + "\""

if self.hardcodedStrings:
for s in self.hardcodedStrings:
command += " " + s

for param in self.parameters:
if param.value is None:
continue
Expand Down Expand Up @@ -355,7 +355,7 @@ def exportRasterLayer(self, layer):
return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer + "\""


def checkBeforeOpeningParametersDialog(self):
def checkBeforeOpeningParametersDialog(self):
return SagaUtils.checkSagaIsInstalled()


Expand Down
10 changes: 5 additions & 5 deletions python/plugins/sextante/saga/SagaAlgorithmProvider.py
Expand Up @@ -91,20 +91,20 @@ def getDescription(self):

def getName(self):
return "saga"

def getPostProcessingErrorMessage(self, wrongLayers):
html = AlgorithmProvider.getPostProcessingErrorMessage(self, wrongLayers)
html = AlgorithmProvider.getPostProcessingErrorMessage(self, wrongLayers)
msg = SagaUtils.checkSagaIsInstalled(True)
html += ("<p>This algorithm requires SAGA to be run. A test to check if SAGA is correctly installed "
html += ("<p>This algorithm requires SAGA to be run. A test to check if SAGA is correctly installed "
"and configured in your system has been performed, with the following result:</p><ul><i>")
if msg is None:
html += "Saga seems to be correctly installed and configured</li></ul>"
else:
html += msg + "</i></li></ul>"
html += '<p><a href= "http://docs.qgis.org/html/en/docs/user_manual/sextante/3rdParty.html">Click here</a> to know more about how to install and configure SAGA to be used with SEXTANTE</p>'

return html

def getSupportedOutputVectorLayerExtensions(self):
return ["shp"]

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/saga/SagaUtils.py
Expand Up @@ -133,7 +133,7 @@ def checkSagaIsInstalled(ignoreRegistrySettings=False):
if settings.contains(SAGA_INSTALLED):
return

try:
try:
from sextante.core.Sextante import runalg
result = runalg("saga:thiessenpolygons", points(), None)
if not os.path.exists(result['POLYGONS']):
Expand Down
12 changes: 6 additions & 6 deletions python/plugins/sextante/tests/ModelerAlgorithmTest.py
Expand Up @@ -36,7 +36,7 @@ def testRemoveParameter(self):
self.assertTrue(2, len(model.parameters))
self.assertFalse(model.removeParameter(0))
self.assertTrue(2, len(model.parameters))

def testComputingDependecies(self):
folder = os.path.join(os.path.dirname(ModelerAlgorithmProvider.__file__), "models")
modelfile = os.path.join(folder, "watersheds.model")
Expand All @@ -54,7 +54,7 @@ def testComputingDependecies(self):
self.assertEquals([3,4], dependent)
dependent = model.getDependentAlgorithms(4)
self.assertEquals([4], dependent)

depends = model.getDependsOnAlgorithms(0)
self.assertEquals([], depends)
depends = model.getDependsOnAlgorithms(1)
Expand All @@ -65,10 +65,10 @@ def testComputingDependecies(self):
self.assertEquals([2,1,0], depends)
depends = model.getDependsOnAlgorithms(4)
self.assertEquals([3,2,1,0], depends)




'''The following tests correspond to example models'''

def test_modelersagagrass(self):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/tests/ParametersTest.py
Expand Up @@ -53,11 +53,11 @@ def testParameterExtent(self):
assert param.name == param2.name

def suite():
suite = unittest.makeSuite(ParametersTest, 'test')
suite = unittest.makeSuite(ParametersTest, 'test')
return suite

def runtests():
result = unittest.TestResult()
result = unittest.TestResult()
testsuite = suite()
testsuite.run(result)
return result

0 comments on commit 839e5ed

Please sign in to comment.