[Qgis-developer] Re: show grid on map canvas (similiar to grid used in composer) - strategy?

John Donovan mersey.viking at gmail.com
Mon May 14 12:36:00 PDT 2012


Hi Larry and Etienne,
Thanks for being brave!

On 14 May 2012 18:48, Larry Shaffer <larrys at dakotacarto.com> wrote:
>
> I tried your Grid Overlay plugin and this is what I found.
>
> Same error as Etienne reported:
>
>
> Traceback (most recent call last):
>  File "/home/tourigny/.qgis/python/
> plugins/grid_overlay/gridpluginlayer.py",
> line 63, in draw
>    self.symbol.renderPolyline(polyline, renderContext)
> ...

That's odd, I'm using 1.7.4 and Python 2.7.2, but I can't imagine the
API to have changed. It runs fine on both my Linux and Windows boxes.
Looking at the C++ docs, indeed RenderPolyline() takes a QgsFeature as
the second parameter, so I'm not sure why it should work for me!

>
> it also occurs when I cancel the dialog. The plugin layer is made regardless
> of cancelling dialog on initial plugin launch.

Mea culpa.

> When I click the 'Set Style...' button I get this error:
>
> Traceback (most recent call last):
>   File
> "/Users/larrys/.qgis/python/plugins/grid_overlay/gridpropertiesdialog.py",
> line 42, in chooseStyle
>     self, False)
> TypeError: QgsSymbolV2SelectorDialog(QgsSymbolV2, QgsStyleV2,
> QgsVectorLayer, QWidget parent=None, bool embedded=False): argument 3 has
> unexpected type 'GridPropertiesDialog'
>
>
> Is that not implemented yet?

Another odd one. GridPropertiesDialog, the class in which this
function is defined, is inherited from QtGui.QDialog, so should make a
valid parent to the symbol selector dialog. I've set it to None on my
machine with no ill effects.

>
>
> I noticed in your metadata.txt and __init__.py you assigned the Layers
> category, but the action doesn't show up there. Does it need to use the
> following to be added to/removed from the Layer menu? (worked when I edited
> gridoverlay.py):
>
> self.iface.insertAddLayerAction(self.action_newGrid)
> self.iface.removeAddLayerAction(self.action_newGrid)

Ah yes, a copy-and-paste code bug. Ahem...

>
>
> Tested with QGIS 1.8 rev.69ef4de on Mac 10.6.8.
>
> Looking forward to using your plugin on the current map I am working with.

I'm glad to hear others will be using it, when it works.


Regards,
John


-- 
One of the advantages of being disorderly is that one is constantly
making exciting discoveries. - AA Milne


More information about the Qgis-developer mailing list