I am writing a python plugin for QGIS 1.7 (started it on QGIS 1.6 but switched to 1.7 recently). Since I switched to 1.7 my unload function doesn't seem to be working anymore. Whenever I implemented changes to the code I use the "Plugin Reloader" plugin to load the newest version of my code.
In the MenuBar this causes an additional, new instanec of the plugin to load while it doesn't unload the old ones. After doing this a couple of time I end up having a list of endless outdated outdated references to my plugin. For the menu bar icon the same does NOT happen...
The code worked fine in 1.6 and I seem to be correctly following all the online examples. It shouldn't be a problem, that I'm creating two actions, at least the PluginReloader plugin seems to do the same.
def initGui(self):
[...]
# GemEB Tool
self.action_tool = QAction(QIcon(iconpath), u"GemEBTool", self.iface.mainWindow())
self.action_tool.setWhatsThis(u"GemEBTool")
self.iface.addPluginToMenu("&GemeindeEnergieBeratung 1.5", self.action_tool)
self.iface.addToolBarIcon(self.action_tool)
QObject.connect(self.action_tool, SIGNAL("triggered()"), self.run_tool)
# Solarrechner
self.action_solarrechner = QAction(QIcon(iconpath), u"GemEB Solarrechner", self.iface.mainWindow())
self.action_solarrechner.setWhatsThis(u"GemEB Solarrechner")
self.iface.addToolBarIcon(self.action_solarrechner)
self.iface.addPluginToMenu("&GemeindeEnergieBeratung 1.5", self.action_solarrechner)
QObject.connect(self.action_solarrechner, SIGNAL("triggered()"), self.run_solarrechner)
def unload(self):
# GemEB Tool
self.iface.removePluginMenu("&GemEBTool",self.action_tool)
self.iface.removeToolBarIcon(self.action_tool)
# Solarrechner
self.iface.removePluginMenu("&GemEB Solarrechner",self.action_solarrechner)
self.iface.removeToolBarIcon(self.action_solarrechner)