Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/master' into hue_saturation
  • Loading branch information
nyalldawson committed Mar 26, 2013
2 parents 4e29436 + 8bf6df2 commit 86a246a
Show file tree
Hide file tree
Showing 68 changed files with 1,187 additions and 748 deletions.
32 changes: 9 additions & 23 deletions python/core/composer/qgscomposerlegend.sip
Expand Up @@ -5,6 +5,7 @@ class QgsComposerLegend : QgsComposerItem
{
%TypeHeaderCode
#include <qgscomposerlegend.h>
#include <qgscomposerlegendstyle.h>
%End

public:
Expand All @@ -30,33 +31,18 @@ class QgsComposerLegend : QgsComposerItem
void setTitle( const QString& t );
QString title() const;

QFont titleFont() const;
void setTitleFont( const QFont& f );

QFont groupFont() const;
void setGroupFont( const QFont& f );

QFont layerFont() const;
void setLayerFont( const QFont& f );

QFont itemFont() const;
void setItemFont( const QFont& f );
/*
QgsComposerLegendStyle style(QgsComposerLegendStyle::Style s) const;
void setStyle(QgsComposerLegendStyle::Style s, const QgsComposerLegendStyle style);
QFont styleFont( QgsComposerLegendStyle::Style s ) const;
void setStyleFont( QgsComposerLegendStyle::Style s, const QFont& f );
void setStyleMargin( QgsComposerLegendStyle::Style s, double margin );
void setStyleMargin( QgsComposerLegendStyle::Style s, QgsComposerLegendStyle::Side side, double margin );
*/

double boxSpace() const;
void setBoxSpace( double s );

double groupSpace() const;
void setGroupSpace( double s );

double layerSpace() const;
void setLayerSpace( double s );

double symbolSpace() const;
void setSymbolSpace( double s );

double iconLabelSpace() const;
void setIconLabelSpace( double s );

double symbolWidth() const;
void setSymbolWidth( double w );

Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsgml.sip
@@ -1,12 +1,12 @@
class QgsGml: QObject
class QgsGml: QObject
{

%TypeHeaderCode
#include <qgsgml.h>
%End

public:

QgsGml(
const QString& typeName,
const QString& geometryAttribute,
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/algs/FieldsCalculator.py
Expand Up @@ -83,7 +83,7 @@ def processAlgorithm(self, progress):
nElement += 1
inGeom = inFeat.geometry()
outFeat.setGeometry(inGeom)
attrs = inFeat.attributes()
attrs = inFeat.attributes()
attrs.append(QVariant(result))
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/algs/ftools/Intersection.py
Expand Up @@ -66,7 +66,7 @@ def processAlgorithm(self, progress):
intersects = index.intersects( geom.boundingBox() )
for i in intersects:
request = QgsFeatureRequest().setFilterFid(i)
inFeatB = vlayerB.getFeatures(request).next()
inFeatB = vlayerB.getFeatures(request).next()
tmpGeom = QgsGeometry(inFeatB.geometry())
try:
if geom.intersects( tmpGeom ):
Expand Down
14 changes: 7 additions & 7 deletions python/plugins/sextante/algs/ftools/MeanCoords.py
Expand Up @@ -61,7 +61,7 @@ def processAlgorithm(self, progress):
uniqueField = self.getParameterValue(self.UID)

weightIndex = layer.fieldNameIndex(weightField)
uniqueIndex = layer.fieldNameIndex(uniqueField)
uniqueIndex = layer.fieldNameIndex(uniqueField)

fieldList = [QgsField("MEAN_X", QVariant.Double, "", 24, 15),
QgsField("MEAN_Y", QVariant.Double, "", 24, 15),
Expand All @@ -74,7 +74,7 @@ def processAlgorithm(self, progress):
current = 0
features = QGisLayers.features(layer)
total = 100.0 / float(len(features))

means = {}
for feat in features:
current += 1
Expand All @@ -89,7 +89,7 @@ def processAlgorithm(self, progress):
weight = 1.00
if clazz not in means:
means[clazz] = (0,0,0)

cx,cy, totalweight = means[clazz]
geom = QgsGeometry(feat.geometry())
geom = utils.extractPoints(geom)
Expand All @@ -98,13 +98,13 @@ def processAlgorithm(self, progress):
cy += i.y() * weight
totalweight += weight
means[clazz] = (cx, cy, totalweight)

for clazz, values in means.iteritems():
outFeat = QgsFeature()
outFeat = QgsFeature()
cx = values[0] / values[2]
cy = values[1] / values[2]
cy = values[1] / values[2]
meanPoint = QgsPoint(cx, cy)

outFeat.setGeometry(QgsGeometry.fromPoint(meanPoint))
outFeat.setAttributes([QVariant(cx), QVariant(cy), clazz])
writer.addFeature(outFeat)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/algs/ftools/SumLines.py
Expand Up @@ -70,7 +70,7 @@ def processAlgorithm(self, progress):
lengthFieldName = self.getParameterValue(self.LEN_FIELD)
countFieldName = self.getParameterValue(self.COUNT_FIELD)

polyProvider = polyLayer.dataProvider()
polyProvider = polyLayer.dataProvider()

idxLength, fieldList = utils.findOrCreateField(polyLayer, polyLayer.pendingFields(), lengthFieldName)
idxCount, fieldList = utils.findOrCreateField(polyLayer, fieldList, countFieldName)
Expand Down Expand Up @@ -104,7 +104,7 @@ def processAlgorithm(self, progress):
if hasIntersections:
for i in lines:
request = QgsFeatureRequest().setFilterFid(i)
ftLine = lineLayer.getFeatures(request).next()
ftLine = lineLayer.getFeatures(request).next()
tmpGeom = QgsGeometry(ftLine.geometry())
if inGeom.intersects(tmpGeom):
outGeom = inGeom.intersection(tmpGeom)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/algs/ftools/Union.py
Expand Up @@ -87,7 +87,7 @@ def processAlgorithm(self, progress):
for id in intersects:
count += 1
request = QgsFeatureRequest().setFilterFid(id)
inFeatB = vlayerB.getFeatures(request).next()
inFeatB = vlayerB.getFeatures(request).next()
atMapB = inFeatB.attributes()
tmpGeom = QgsGeometry( inFeatB.geometry() )

Expand Down Expand Up @@ -173,7 +173,7 @@ def processAlgorithm(self, progress):
else:
for id in intersects:
request = QgsFeatureRequest().setFilterFid(id)
inFeatB = vlayerA.getFeatures(request).next()
inFeatB = vlayerA.getFeatures(request).next()
atMapB = inFeatB.attributes()
tmpGeom = QgsGeometry( inFeatB.geometry() )
try:
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/core/GeoAlgorithm.py
Expand Up @@ -64,7 +64,7 @@ def __init__(self):
self.provider = None

self.defineCharacteristics()

def getCopy(self):
'''returns a new instance of this algorithm, ready to be used for being executed'''
newone = copy.copy(self)
Expand Down Expand Up @@ -320,7 +320,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 Down
8 changes: 4 additions & 4 deletions python/plugins/sextante/core/SextanteUtils.py
Expand Up @@ -78,12 +78,12 @@ def getTempFilename(ext):

@staticmethod
def getTempFilenameInTempFolder(basename):
'''returns a temporary filename for a given file, putting it into a temp folder but not changing its basename'''
path = SextanteUtils.tempFolder()
'''returns a temporary filename for a given file, putting it into a temp folder but not changing its basename'''
path = SextanteUtils.tempFolder()
tempFolder = os.path.join(path, str(uuid.uuid4()).replace("-",""))
mkdir(tempFolder)
mkdir(tempFolder)
filename = os.path.join(tempFolder, basename)
return filename
return filename

@staticmethod
def getNumExportedLayers():
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/sextante/gui/BatchInputSelectionPanel.py
Expand Up @@ -49,7 +49,7 @@ def __init__(self, param, row, col, batchDialog, parent = None):
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)

def showSelectionDialog(self):
def showSelectionDialog(self):
settings = QtCore.QSettings()
text = str(self.text.text())
if os.path.isdir(text):
Expand All @@ -60,10 +60,10 @@ def showSelectionDialog(self):
path = str(settings.value( "/SextanteQGIS/LastInputPath",QtCore.QVariant("")).toString())
else:
path = ""

ret = QtGui.QFileDialog.getOpenFileNames(self, "Open file", path, self.param.getFileFilter())
if ret:
files = list(ret)
if ret:
files = list(ret)
if len(files) == 1:
settings.setValue("/SextanteQGIS/LastInputPath", os.path.dirname(str(files[0])))
self.text.setText(str(files[0]))
Expand Down
16 changes: 8 additions & 8 deletions python/plugins/sextante/gui/BatchProcessingDialog.py
Expand Up @@ -109,16 +109,16 @@ def headerDoubleClicked(self, col):
elif isinstance(widget, FileSelectionPanel):
widgetValue = widget.getValue()
for row in range(1, self.table.rowCount()):
self.table.cellWidget(row, col).setText(widgetValue)
self.table.cellWidget(row, col).setText(widgetValue)
elif isinstance(widget, QtGui.QLineEdit):
widgetValue = widget.text()
for row in range(1, self.table.rowCount()):
self.table.cellWidget(row, col).setText(widgetValue)
self.table.cellWidget(row, col).setText(widgetValue)
elif isinstance(widget, BatchInputSelectionPanel):
widgetValue = widget.getText()
for row in range(1, self.table.rowCount()):
self.table.cellWidget(row, col).setText(widgetValue)

else:
pass

Expand Down Expand Up @@ -207,13 +207,13 @@ def loadHTMLResults(self, alg, i):
def cancel(self):
self.algs = None
if self.algEx:
self.algEx.terminate()
self.table.setEnabled(True)
self.algEx.terminate()
self.table.setEnabled(True)
#self.close()

@pyqtSlot()
def finish(self, i):
if not self.stop:
if not self.stop:
if self.load[i]:
SextantePostprocessing.handleAlgorithmResults(self.algs[i], self, False)
i += 1
Expand All @@ -230,8 +230,8 @@ def error(self, msg):
QMessageBox.critical(self, "Error", msg)
SextanteLog.addToLog(SextanteLog.LOG_ERROR, msg)
if self.algEx:
self.algEx.terminate()
self.table.setEnabled(True)
self.algEx.terminate()
self.table.setEnabled(True)
#self.close()


Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/gui/SextanteToolbox.py
Expand Up @@ -146,9 +146,9 @@ def fillTree(self):
self.fillTreeUsingCategories()
else:
self.fillTreeUsingProviders()
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
self.addRecentAlgorithms(False)

def addRecentAlgorithms(self, updating):
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
if showRecent:
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/sextante/gui/TestTools.py
Expand Up @@ -42,26 +42,26 @@ def createTest(text):
execcommand = "sextante.runalg("
i = 0
for token in tokens:
if i < alg.getVisibleParametersCount() + 1:
if i < alg.getVisibleParametersCount() + 1:
if os.path.exists(token[1:-1]):
token = os.path.basename(token[1:-1])[:-4] + "()"
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 execution.\nThe output cannot be a temporary file")
raise Exception("Cannot create unit test for that algorithm execution.\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"
if isinstance(out, OutputRaster):
dataset = gdal.Open(filename, GA_ReadOnly)
strhash = hash(str(dataset.ReadAsArray(0).tolist()))
strhash = hash(str(dataset.ReadAsArray(0).tolist()))
s+="\tself.assertTrue(os.path.isfile(output))\n"
s+="\tdataset=gdal.Open(output, GA_ReadOnly)\n"
s+="\tstrhash=hash(str(dataset.ReadAsArray(0).tolist()))\n"
Expand Down
Expand Up @@ -204,9 +204,9 @@ def setupUi(self):
self.fileFolderCombo = QtGui.QComboBox()
self.fileFolderCombo.addItem("File")
self.fileFolderCombo.addItem("Folder")
self.horizontalLayout2.addWidget(self.fileFolderCombo)
self.horizontalLayout2.addWidget(self.fileFolderCombo)
if self.param is not None:
self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0)
self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0)

self.buttonBox = QtGui.QDialogButtonBox(self)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
Expand Down Expand Up @@ -267,7 +267,7 @@ def okPressed(self):
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_EXTENT or isinstance(self.param, ParameterExtent):
self.param = ParameterExtent(name, description)
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_FILE or isinstance(self.param, ParameterFile):
self.param = ParameterFile(name, description)
self.param = ParameterFile(name, description)
self.close()

def cancelPressed(self):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/parameters/ParameterRaster.py
Expand Up @@ -75,12 +75,12 @@ def setValue(self, obj):
self.value = unicode(layer.dataProvider().dataSourceUri())
return True
return os.path.exists(self.value)

def getFileFilter(self):
exts = QGisLayers.getSupportedOutputRasterLayerExtensions()
for i in range(len(exts)):
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
return ";;".join(exts)
return ";;".join(exts)

def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/parameters/ParameterTable.py
Expand Up @@ -78,7 +78,7 @@ def getSafeExportedTable(self):
else:
self.exported = self.value
return self.exported

def getFileFilter(self,alg):
exts = ['csv', 'dbf']
for i in range(len(exts)):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/parameters/ParameterVector.py
Expand Up @@ -83,7 +83,7 @@ def getSafeExportedLayer(self):
else:
self.exported = self.value
return self.exported

def getFileFilter(self):
exts = QGisLayers.getSupportedOutputVectorLayerExtensions()
for i in range(len(exts)):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/r/EditRScriptDialog.py
Expand Up @@ -46,7 +46,7 @@ def __init__(self, alg):
self.setupUi()
self.update = False
self.help = None

def setupUi(self):
self.resize(600,400)
self.setWindowTitle("Edit script")
Expand Down Expand Up @@ -82,7 +82,7 @@ def setupUi(self):

def editHelp(self):
if self.alg is None:
alg = RAlgorithm(None, unicode(self.text.toPlainText()))
alg = RAlgorithm(None, unicode(self.text.toPlainText()))
else:
alg = self.alg
dlg = HelpEditionDialog(alg)
Expand Down

0 comments on commit 86a246a

Please sign in to comment.