Hi,

I have code within a plugin that I am writing that is similar to:

```
def feature_added(self, fid):
    self.vlayer.beginEditCommand('Update attributes')
    self.vlayer.changeAttributeValue(fid, 2, 17)
    self.vlayer.endEditCommand()
```

It is called in response to a featureAdded signal from the layer.  The command 
runs and the attributes are updated and the canvas refreshes to show them.  
However, when I check the undoStack for the layer, the command is not present.  
When I press 'Undo', QGIS has a hard crash.

If I use the QGIS iPython console to access the layer directly through my 
plugin (e.g. via qgis.utils.plugins['MyPlugin']) and type the equivalent 
commands directly into the console, everything works as expected, but the 
changes are not visible until the canvas is manually refreshed.

Is there something else that should / shouldn't be called by the plugin to put 
the undo command onto the stack?

I'm on QGIS 2.12.0 on Linux Mint 17 (Ubuntu 14.04).

Thanks,
John



John Stevenson
Senior Developer


[cid:[email protected]]<http://www.thinkwhere.com>


t: 01786 476060 (Office)
t: 01786 476093 (Direct Dial)
w:www.thinkwhere.com<http://www.thinkwhere.com>


Glendevon House
Castle Business Park
Stirling FK9 4TZ


[cid:[email protected]]<https://twitter.com/thinkWhere1> 
[cid:[email protected]] 
<http://www.linkedin.com/company/1509510?trk=companies_home_ycp_logo_forth-valley-gis>


This email and its attachments are private and confidential. If you believe you 
have received this email in error, please contact the sender immediately on 
01786 476060. If you are not the intended recipient, you may not rely on, use 
or disclose this email or any attachments in any way.

thinkWhere Limited does not accept any liability for any damage that may be 
caused to the recipient's system or data by this email or any attachments. 
Please note that our email system may be subject to random monitoring by us. 
This Company accepts no liability for personal emails.

thinkWhere is a limited company registered in Scotland with Registered Number 
SC315349 and having its Registered Office at Glendevon House, Castle Business 
Park, Stirling, FK9 4TZ.

_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to