I've just installed QGIS 2.14.3 (Essen) on a Windows 7 machine, so I've got the default configuration on everything. This means that under "Settings -> Options -> Digitizing", I've got "Default snap mode = Off", and "Default snapping tolerance = 0,00000 map units".
When I create a new project, and then create a new multipolygon temporary scratch layer, snapping mode is off as expected according to the general digitizing options previosly described. This can be verified under "Settings -> Snapping options", or just by creating a new feature and checking that its vertex don't snap.
After that, from the Python console I type the following:
>>> proj=QgsProject.instance() >>> proj.readEntry('Digitizing','DefaultSnapType') (u'off', True)
So, until now, everything seems to be OK because Python shows the same information that the GUI.
But, if I type:
>>> proj.writeEntry('Digitizing','DefaultSnapType', 'to vertex and segment') True >>> proj.writeEntry('Digitizing','DefaultSnapTolerance', 10.0) True
It looks like I've changed the snapping mode, but actually QGIS hasn't changed it at all. In fact, if I go to "Settings -> Snapping options" it shows "Snap to = Off", and "Tolerance = 0". But, If I type:
>>> proj.readEntry('Digitizing','DefaultSnapType') (u'to vertex and segment', True) >>> proj.readNumEntry('Digitizing','DefaultSnapTolerance') 10
So the GUI and the Python console show different information, but only the GUI's options are the real ones.
Then, if I change the "Snap to" option on the GUI to "To segment and vertex", "Tolerance = 10", and click OK, then QGIS has really activated the snapping mode. I mean, if I create a new feature its vertex will snap properly.
It would seem at first sight that you cannot change snapping option from the console, but this is not totally true, because if I type:
>>> proj.writeEntry('Digitizing', 'TopologicalEditing', 1) True >>> proj.writeEntry('Digitizing', 'IntersectionSnapping', True) True
The GUI options "Enable topological editing" and "Enable snapping on intersection" get activated. And in the same way, I can really deactivate both options (I mean, showing properly deactivated on "Settings -> Snapping options") by typing:
>>> proj.writeEntry('Digitizing', 'TopologicalEditing', 0) True >>> proj.writeEntry('Digitizing', 'IntersectionSnapping', False) True
In conclusion, it looks like QGIS doesn't really update all snapping settings from Python, but only some of them, so you've got to use the GUI if you want to change them all.
Does anybody know a workaround?
If not, can somebody try to reproduce the situation and tell me their results? I'd like to know if someone else is suffering this issue before I report it like a bug.