Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into heatmap_fixes
  • Loading branch information
nyalldawson committed Mar 12, 2013
2 parents 1164c81 + a56c957 commit 7942be9
Show file tree
Hide file tree
Showing 70 changed files with 10,490 additions and 7,641 deletions.
4 changes: 2 additions & 2 deletions doc/TRANSLATORS
@@ -1,9 +1,9 @@
<style>table {font-size:80%;}th {text-align:left; }.bartodo{ background-color:red;width:100px;height:20px;}.bardone{ background-color:green;width:80px;height:20px;font-size:80%;text-align:center;padding-top:4px;height:16px;color:white;}</style><table><tr><th colspan="2" style="width:250px;">Language</th><th>Finished %</th><th>Translators</th></tr>

<tr><td><img src="qrc:/images/flags/da_DK.png"></td><td>Danish (Denmark)</td><td><div title="finished:9043 unfinished:1 untranslated:3" class="bartodo"><div class="bardone" style="width:98px">98.9</div></div></td><td>Jacob Overgaard Madsen, Preben Lisby</td></tr>
<tr><td><img src="qrc:/images/flags/de.png"></td><td>German</td><td><div title="finished:9040 unfinished:0 untranslated:0" class="bartodo"><div class="bardone" style="width:98px">98.9</div></div></td><td>Jürgen E. Fischer, Stephan Holl, Otto Dassau, Werner Macho</td></tr>
<tr><td><img src="qrc:/images/flags/gl_ES.png"></td><td>Galician (Spain)</td><td><div title="finished:8574 unfinished:219 untranslated:223" class="bartodo"><div class="bardone" style="width:94px">95.0</div></div></td><td>Xan Vieiro</td></tr>
<tr><td><img src="qrc:/images/flags/gl_ES.png"></td><td>Galician (Spain)</td><td><div title="finished:8530 unfinished:170 untranslated:347" class="bartodo"><div class="bardone" style="width:94px">94.2</div></div></td><td>Xan Vieiro</td></tr>
<tr><td><img src="qrc:/images/flags/es.png"></td><td>Spanish</td><td><div title="finished:8438 unfinished:22 untranslated:58" class="bartodo"><div class="bardone" style="width:92px">92.4</div></div></td><td>Carlos Dávila, Javier César Aldariz, Gabriela Awad, Edwin Amado, Mayeul Kauffmann, Diana Galindo</td></tr>
<tr><td><img src="qrc:/images/flags/da_DK.png"></td><td>Danish (Denmark)</td><td><div title="finished:7760 unfinished:482 untranslated:801" class="bartodo"><div class="bardone" style="width:87px">87.5</div></div></td><td>Jacob Overgaard Madsen, Preben Lisby</td></tr>
<tr><td><img src="qrc:/images/flags/it.png"></td><td>Italian</td><td><div title="finished:7975 unfinished:28 untranslated:515" class="bartodo"><div class="bardone" style="width:87px">87.4</div></div></td><td>Paolo Cavallini, Flavio Rigolon, Maurizio Napolitano, Roberto Angeletti, Alessandro Fanna, Michele Beneventi, Marco Braida, Luca Casagrande, Luca Delucchi, Anne Gishla</td></tr>
<tr><td><img src="qrc:/images/flags/sv.png"></td><td>Swedish</td><td><div title="finished:7316 unfinished:1131 untranslated:109" class="bartodo"><div class="bardone" style="width:86px">86.2</div></div></td><td>Lars Luthman, Magnus Homann, Victor Axbom</td></tr>
<tr><td><img src="qrc:/images/flags/et_EE.png"></td><td>Estonian (Estonia)</td><td><div title="finished:7549 unfinished:651 untranslated:880" class="bartodo"><div class="bardone" style="width:86px">86.1</div></div></td><td>Veiko Viil</td></tr>
Expand Down
3,573 changes: 1,854 additions & 1,719 deletions i18n/qgis_da_DK.ts

Large diffs are not rendered by default.

11,633 changes: 6,995 additions & 4,638 deletions i18n/qgis_gl_ES.ts

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion python/core/core.sip
Expand Up @@ -47,6 +47,7 @@
%Include qgsmimedatautils.sip
%Include qgsnetworkaccessmanager.sip
%Include qgsofflineediting.sip
%Include qgsogcutils.sip
%Include qgsoverlayobject.sip
%Include qgsowsconnection.sip
%Include qgspaintenginehack.sip
Expand Down Expand Up @@ -157,7 +158,7 @@
%Include raster/qgssinglebandcolordatarenderer.sip
%Include raster/qgssinglebandpseudocolorrenderer.sip
%Include raster/qgssinglebandgrayrenderer.sip
%Include raster/qgspaletterasterrenderer.sip
%Include raster/qgspalettedrasterrenderer.sip
%Include raster/qgscubicrasterresampler.sip
%Include raster/qgsmultibandcolorrenderer.sip

Expand Down
12 changes: 0 additions & 12 deletions python/core/qgsgeometry.sip
Expand Up @@ -41,18 +41,6 @@ class QgsGeometry
/** static method that creates geometry from Wkt */
static QgsGeometry* fromWkt( QString wkt ) /Factory/;

/** static method that creates geometry from GML2
@param XML representation of the geometry. GML elements are expected to be
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
@note added in 1.9
*/
static QgsGeometry* fromGML2( const QString& xmlString ) /Factory/;

/** static method that creates geometry from GML2
@note added in 1.9
*/
static QgsGeometry* fromGML2( const QDomNode& geometryNode ) /Factory/;

/** construct geometry from a point */
static QgsGeometry* fromPoint( const QgsPoint& point ) /Factory/;
/** construct geometry from a multipoint */
Expand Down
32 changes: 32 additions & 0 deletions python/core/qgsogcutils.sip
@@ -0,0 +1,32 @@


class QgsOgcUtils
{
%TypeHeaderCode
#include <qgsogcutils.h>
%End

public:

/** static method that creates geometry from GML2
@param XML representation of the geometry. GML elements are expected to be
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
@note added in 1.9
*/
static QgsGeometry* geometryFromGML2( const QString& xmlString ) /Factory/;

/** static method that creates geometry from GML2
@note added in 1.9
*/
static QgsGeometry* geometryFromGML2( const QDomNode& geometryNode ) /Factory/;

/** Exports the geometry to mGML2
@return true in case of success and false else
*/
static QDomElement geometryToGML2( QgsGeometry* geometry, QDomDocument& doc );

/** read rectangle from GML2 Box */
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );

};

@@ -1,16 +1,18 @@
class QgsPalettedRasterRenderer: QgsRasterRenderer
class QgsPalettedRasterRenderer : QgsRasterRenderer
{
%TypeHeaderCode
#include "qgspalettedrasterrenderer.h"
%End
public:
/**Renderer owns color array*/
QgsPalettedRasterRenderer( QgsRasterDataProvider* provider, int bandNumber, QColor* colorArray /Array,Transfer/, int nColors /ArraySize/ );
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QColor* colorArray /Array,Transfer/, int nColors /ArraySize/ );
~QgsPalettedRasterRenderer();
QgsRasterInterface * clone() /Factory/;
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterDataProvider* provider ) /Factory/;
QgsRasterInterface * clone() const /Factory/;
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input ) /Factory/;

QgsRasterBlock * block( int bandNo, const QgsRectangle & extent, int width, int height ) / Factory /;
// void draw( QPainter* p, QgsRasterViewPort* viewPort, const QgsMapToPixel* theQgsMapToPixel );

QgsRasterBlock *block( int bandNo, const QgsRectangle & extent, int width, int height ) /Factory/;

/**Returns number of colors*/
int nColors() const;
Expand All @@ -20,4 +22,6 @@ class QgsPalettedRasterRenderer: QgsRasterRenderer
void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;

void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const;
};

QList<int> usesBands() const;
};
1 change: 1 addition & 0 deletions python/gui/qgisinterface.sip
Expand Up @@ -426,6 +426,7 @@ class QgisInterface : QObject
// @added in 1.6
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false ) = 0;

virtual QDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) = 0;
/** Return vector layers in edit mode
* @param modified whether to return only layers that have been modified
* @returns list of layers in legend order, or empty list
Expand Down
38 changes: 19 additions & 19 deletions python/plugins/CMakeLists.txt
Expand Up @@ -2,19 +2,19 @@
# will function when app is run from build directory

# When staging all plugins, use the following make targets:
# staged_plugins - stage plugins (usually after repo pull/build and project make)
# staged_plugins_pyc - stage and byte-compile all Python scripts
# clean_staged_plugins - removes the plugins directory and all contents
# staged-plugins - stage plugins (usually after repo pull/build and project make)
# staged-plugins-pyc - stage and byte-compile all Python scripts
# clean-staged-plugins - removes the plugins directory and all contents
#
# When developing on a plugin, use the following make targets:
# staged_[plugin_dir_name] - stage specific plugin, regenerating any changed resources
# clean_staged_[plugin_dir_name] - removes the plugin directory and its contents
# staged-[plugin_dir_name] - stage specific plugin, regenerating any changed resources
# clean-staged-[plugin_dir_name] - removes the plugin directory and its contents
#
# NOTE: regular project 'make install' is unaffected

ADD_CUSTOM_TARGET(staged_plugins)
ADD_CUSTOM_TARGET(staged-plugins)

ADD_CUSTOM_TARGET(staged_plugins_pyc DEPENDS staged_plugins
ADD_CUSTOM_TARGET(staged-plugins-pyc DEPENDS staged-plugins
COMMAND ${PYTHON_EXECUTABLE} -m compileall -q "${PYTHON_OUTPUT_DIRECTORY}/plugins"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Byte-compiling staged Python plugins..."
Expand All @@ -23,13 +23,13 @@ ADD_CUSTOM_TARGET(staged_plugins_pyc DEPENDS staged_plugins
# plugins can also be staged with CMake option at build time
IF(WITH_STAGED_PLUGINS)
IF(WITH_PY_COMPILE)
ADD_CUSTOM_TARGET(staged_plugins_on_build ALL DEPENDS staged_plugins_pyc)
ADD_CUSTOM_TARGET(staged-plugins-on-build ALL DEPENDS staged-plugins-pyc)
ELSE(WITH_PY_COMPILE)
ADD_CUSTOM_TARGET(staged_plugins_on_build ALL DEPENDS staged_plugins)
ADD_CUSTOM_TARGET(staged-plugins-on-build ALL DEPENDS staged-plugins)
ENDIF(WITH_PY_COMPILE)
ENDIF(WITH_STAGED_PLUGINS)

ADD_CUSTOM_TARGET(clean_staged_plugins
ADD_CUSTOM_TARGET(clean-staged-plugins
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins
)

Expand All @@ -39,33 +39,33 @@ MACRO (PLUGIN_INSTALL plugin subdir )
INSTALL(FILES ${ARGN} DESTINATION ${QGIS_DATA_DIR}/python/plugins/${plugin}/${subdir})
STRING(REPLACE "/" "_" subdir_sane "${subdir}")
IF(WITH_STAGED_PLUGINS)
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane} DEPENDS ${ARGN})
ADD_CUSTOM_TARGET(${plugin}-${subdir_sane} DEPENDS ${ARGN})
ELSE(WITH_STAGED_PLUGINS)
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane} ALL DEPENDS ${ARGN})
ADD_CUSTOM_TARGET(${plugin}-${subdir_sane} ALL DEPENDS ${ARGN})
ENDIF(WITH_STAGED_PLUGINS)

# for staged plugin install (to run from build directory)
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall DEPENDS ${ARGN})
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
ADD_CUSTOM_TARGET(${plugin}-${subdir_sane}-stageinstall DEPENDS ${ARGN})
ADD_CUSTOM_COMMAND(TARGET ${plugin}-${subdir_sane}-stageinstall
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
FOREACH(file ${ARGN})
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
ADD_CUSTOM_COMMAND(TARGET ${plugin}-${subdir_sane}-stageinstall
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${file}\" ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
#COMMENT "copying ${file} to ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}"
)
ENDFOREACH(file)
ADD_DEPENDENCIES(staged_plugins ${plugin}_${subdir_sane}_stageinstall)
ADD_DEPENDENCIES(staged-plugins ${plugin}-${subdir_sane}-stageinstall)

IF(TARGET staged_${plugin})
ADD_DEPENDENCIES(staged_${plugin} ${plugin}_${subdir_sane}_stageinstall)
ADD_DEPENDENCIES(staged_${plugin} ${plugin}-${subdir_sane}-stageinstall)
ELSE(TARGET staged_${plugin})
ADD_CUSTOM_TARGET(staged_${plugin} DEPENDS ${plugin}_${subdir_sane}_stageinstall)
ADD_CUSTOM_TARGET(clean_staged_${plugin}
ADD_CUSTOM_TARGET(staged_${plugin} DEPENDS ${plugin}-${subdir_sane}-stageinstall)
ADD_CUSTOM_TARGET(clean-staged-${plugin}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}
)
ENDIF(TARGET staged_${plugin})
Expand Down
10 changes: 9 additions & 1 deletion python/plugins/sextante/core/GeoAlgorithm.py
Expand Up @@ -319,7 +319,7 @@ def getVisibleOutputsCount(self):
if not out.hidden:
i+=1
return i;

def getVisibleParametersCount(self):
'''returns the number of non-hidden parameters'''
i = 0;
Expand All @@ -328,6 +328,14 @@ def getVisibleParametersCount(self):
i+=1
return i;

def getHTMLOutputsCount(self):
'''returns the number of HTML outputs'''
i = 0;
for out in self.outputs:
if isinstance(out, OutputHTML):
i+=1
return i;

def getOutputValuesAsDictionary(self):
d = {}
for out in self.outputs:
Expand Down
1 change: 0 additions & 1 deletion python/plugins/sextante/grass/description/r.fillnulls.txt
Expand Up @@ -2,7 +2,6 @@ r.fillnulls
r.fillnulls - Fills no-data areas in a raster layer using v.surf.rst splines interpolation or v.surf.bspline interpolation
Raster (r.*)
ParameterRaster|input|Input raster layer to fill|False
ParameterSelection|method|Method|bilinear;bicubic;rst|2
ParameterNumber|tension|Spline tension parameter|None|None|40.0
ParameterNumber|smooth|Spline smoothing parameter|None|None|0.1
OutputRaster|output|Filled layer
6 changes: 6 additions & 0 deletions python/plugins/sextante/grass/description/r.random.raster.txt
@@ -0,0 +1,6 @@
r.randon.raster
r.random.raster - Create random raster
Raster (r.*)
ParameterRaster|raster|Name of input raster map|False
ParameterNumericalValue|value|The number of points to allocate |None|None|1
OutputRaster|output|Output layer
7 changes: 7 additions & 0 deletions python/plugins/sextante/grass/description/v.split.length.txt
@@ -0,0 +1,7 @@
v.split
v.split.length - Split lines to shorter segments by length.
Vector (v.*)
ParameterVector|input|Input lines layer|1|False
ParameterNumber|length|Maximum segment length|None|None|10.0
OutputVector|output|Output layer

@@ -1,8 +1,7 @@
v.split
v.split - Split lines to shorter segments.
v.split.vert - Split lines to shorter segments by max number of vertices.
Vector (v.*)
ParameterVector|input|Input lines layer|1|False
ParameterNumber|length|Maximum segment length|None|None|10.0
ParameterNumber|vertices|Maximum number of vertices in segment|None|None|10
OutputVector|output|Output layer

4 changes: 2 additions & 2 deletions python/plugins/sextante/grass/description/v.to.points.txt
Expand Up @@ -3,7 +3,7 @@ v.to.points - Create points along input lines
Vector (v.*)
ParameterVector|input|Input lines layer|1|False
ParameterString|dmax|Maximum distance between points in map units|100
ParameterBoolean|-n|Write line nodes|True
ParameterBoolean|-v|Write line vertices|True
ParameterBoolean|-i|Interpolate points between line vertices|False
OutputVector|output|Output vector map where points will be written

OutputVector|output|Output vector map where points will be written
18 changes: 11 additions & 7 deletions python/plugins/sextante/gui/AlgorithmExecutionDialog.py
Expand Up @@ -99,8 +99,8 @@ def __init__(self, alg, mainWidget):
self.logText.readOnly = True
useThreads = SextanteConfig.getSetting(SextanteConfig.USE_THREADS)
keepOpen = SextanteConfig.getSetting(SextanteConfig.KEEP_DIALOG_OPEN)
if useThreads or keepOpen:
self.tabWidget.addTab(self.logText, "Log")
#if useThreads or keepOpen:
self.tabWidget.addTab(self.logText, "Log")
self.webView = QtWebKit.QWebView()
cssUrl = QtCore.QUrl(os.path.join(os.path.dirname(__file__), "help", "help.css"))
self.webView.settings().setUserStyleSheetUrl(cssUrl)
Expand Down Expand Up @@ -216,11 +216,13 @@ def accept(self):
return
msg = self.alg.checkParameterValuesBeforeExecuting()
if msg:
if keepOpen or useThread:
self.setInfo("Unable to execute algorithm: %s" % msg, True)
self.tabWidget.setCurrentIndex(1) # log tab
else:
QMessageBox.critical(self, "Unable to execute algorithm", msg)
#===============================================================
# if keepOpen or useThread:
# self.setInfo("Unable to execute algorithm: %s" % msg, True)
# self.tabWidget.setCurrentIndex(1) # log tab
# else:
#===============================================================
QMessageBox.critical(self, "Unable to execute algorithm", msg)
return
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
self.buttonBox.button(QtGui.QDialogButtonBox.Close).setEnabled(False)
Expand Down Expand Up @@ -303,6 +305,8 @@ def finish(self):
self.close()
else:
self.resetGUI()
if self.alg.getHTMLOutputsCount() > 0:
self.setInfo("HTML output has been generated by this algorithm.\nOpen the SEXTANTE results dialog to check it.")

@pyqtSlot(str)
def error(self, msg):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/gui/BatchProcessingDialog.py
Expand Up @@ -149,7 +149,7 @@ def accept(self):
continue
widget = self.table.cellWidget(row, col)
if not self.setParameterValueFromWidget(param, widget, alg):
QMessageBox.critical(self.dialog, "Unable to execute batch process", "Wrong or missing parameter values")
QMessageBox.critical(self, "Unable to execute batch process", "Wrong or missing parameter values")
self.algs = None
return
col+=1
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/gui/SextanteToolbox.py
Expand Up @@ -152,8 +152,8 @@ def fillTree(self):
def addRecentAlgorithms(self):
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
if showRecent:
first = self.algorithmTree.topLevelItem(0)
if first.text(0) == "Recently used algorithms":
first = self.algorithmTree.topLevelItem(0)
if first != None and first.text(0) == "Recently used algorithms":
self.algorithmTree.removeItemWidget(first, 0)
recent = SextanteLog.getRecentAlgorithms()
if len(recent) != 0:
Expand Down
18 changes: 11 additions & 7 deletions python/plugins/sextante/gui/TestTools.py
Expand Up @@ -16,13 +16,13 @@
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'February 2013'
__copyright__ = '(C) 2013, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from sextante.core.Sextante import Sextante
from sextante.outputs.OutputNumber import OutputNumber
from sextante.outputs.OutputString import OutputString
Expand All @@ -42,16 +42,20 @@ def createTest(item):
execcommand = "sextante.runalg("
i = 0
for token in tokens:
if i < alg.getVisibleParametersCount():
if i < alg.getVisibleParametersCount() + 1:
if os.path.exists(token[1:-1]):
token = '"' + os.path.basename(token[1:-1])[:-4] + '"'
execcommand+=token + ","
else:
execcommand+="None,"
i+=1
s += "\toutputs=" + execcommand[:-1] + ")\n"

i = -1 * len(alg.outputs)
for out in alg.outputs:
for out in alg.outputs:
filename = tokens[i][1:-1]
if (filename == str(None)):
raise Exception("Cannot create unit test for that algorithm.\nThe output cannot be a temporary file")
s+="\toutput=outputs['" + out.name + "']\n"
if isinstance(out, (OutputNumber, OutputString)):
s+="self.assertTrue(" + str(out) + ", output)\n"
Expand All @@ -69,8 +73,8 @@ def createTest(item):
s+="\texpectedtypes=[" + ",".join([str(f.typeName()) for f in fields]) + "]\n"
s+="\tnames=[str(f.name()) for f in fields]\n"
s+="\ttypes=[str(f.typeName()) for f in fields]\n"
s+="\tself.assertEqual(exceptednames, names)\n"
s+="\tself.assertEqual(exceptedtypes, types)\n"
s+="\tself.assertEqual(expectednames, names)\n"
s+="\tself.assertEqual(expectedtypes, types)\n"
features = QGisLayers.features(layer)
numfeat = len(features)
s+="\tfeatures=sextante.getfeatures(layer))\n"
Expand All @@ -80,9 +84,9 @@ def createTest(item):
attrs = feature.attributes()
s+="\tfeature=features.next()\n"
s+="\tattrs=feature.attributes()\n"
s+="\texpectedvalues=[" + ",".join([str(attr.toString()) for attr in attrs]) + "]\n"
s+="\texpectedvalues=[" + ",".join(['"' + str(attr.toString()) + '"' for attr in attrs]) + "]\n"
s+="\tvalues=[str(attr.toString()) for attr in attrs]\n"
s+="\tself.assertEqual(exceptedtypes, types)\n"
s+="\tself.assertEqual(expectedtypes, types)\n"

dlg = ShowTestDialog(s)
dlg.exec_()
Expand Down

0 comments on commit 7942be9

Please sign in to comment.