Hi Denis,

On Fri, Mar 30, 2012 at 3:57 AM, Denis Rouzaud <[email protected]> wrote:
> ...
> First, I propose to add these three lines in the code snippets. It is to
> include help link in thew plugin menu:
> def initGui(self):
>  # This initiates the action
>  self.helpAction = QAction(QIcon(":/plugins/myplugin/icons/help.png"),
> "Help", self.iface.mainWindow())
>  # This will open the website url using user's defined browser
>  QObject.connect(self.helpAction, SIGNAL("triggered()"), lambda:
> QDesktopServices.openUrl(QUrl("http://my.help.site/formyplugin";)))
>  # This will add the help link in the plugin menu, under the entry "My
> Plugin"
>  self.iface.addPluginToMenu("&My plugin", self.helpAction)
> ...

Nifty snippet.

For connecting your signal to the lambda slot, how about new style instead?

self.helpAction.triggered.connect(
    lambda: QDesktopServices.openUrl(QUrl("http://my.help.site/formyplugin";)))

Also, you may want to note adding the removal call to the 'def
unload(self)' method as well:

self.iface.removePluginMenu("&My plugin", self.helpAction)


btw: Your snippet seems to be appearing 3 times in the listing. Maybe
a glitch with the site?


Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to