[Qgis-developer] Load an editable layer as a read-only one

Giuseppe Sucameli brush.tyler at gmail.com
Mon Oct 4 19:12:13 EDT 2010


Hi devs,

there is a way to load an editable layer without editing capabilities?
I searched for a setCapabilities() method, but nothing.
Reducing the layer capabilities would be useful, especially for plugins,
obviously
without adding new capabilities.

In a C++ plugin I can extend the concrete DataProvider class.
There is a way to do the same thing in a python plugin? Maybe creating a
wrapper
to the layer dataProvider?

Something like:

class ReadOnlyProvider:
    def __init__(self, dataProvider):
        self.dataProvider = dataProvider

    def select():
        return self.dataProvider.select()

    ...

    def capabilities():
        return newCapabilites

should work, but the QgsVectorLayer.setDataProvider method is private...

Do you know other ways? Help is appreciated.
Thanks.

Cheers.

-- 
Giuseppe Sucameli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20101005/26203b80/attachment.html


More information about the Qgis-developer mailing list