I have a working application of labels to a point array - but the size of the text is not relative to the map scale. This decreases the readability of labels when panning and zooming.
To resolve~
How would one implement a text-size based (ex: 'textSize = 7' below in code) on MapUnits?
field = str(csvGridFieldNames[index])
csvGrid = ftools_utils.getMapLayerByName(unicode('mfLayer1_Grid'))#str(activeLayer)))
textSize = 7
valLabel = QgsPalLayerSettings()
valLabel.readFromLayer(csvGrid)
valLabel.enabled = True
valLabel.fieldName = field
valLabel.placement= QgsPalLayerSettings.OverPoint
valLabel.setDataDefinedProperty(QgsPalLayerSettings.Size,True,True,'%f' %(textSize),'')
valLabel.writeToLayer(csvGrid)
iface.legendInterface().refreshLayerSymbology(csvGrid)
iface.mapCanvas().refresh()
Ergo, I'm lead to believe changes are nessecary in this statement:
valLabel.setDataDefinedProperty(QgsPalLayerSettings.Size,True,True,'%f' %(textSize),'')
This looks like the path, but continual attempts return syntax errors...
Referenced via: QgsPalLayerSettings Class Reference