Created
January 9, 2013 10:00
-
-
Save timlinux/4492032 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unload(self): | |
"""Gui breakdown procedure (for QGIS plugin api). | |
This method is called by QGIS and should be used to *remove* | |
any graphical user interface elements that should appear in QGIS. | |
Args: | |
None. | |
Returns: | |
None. | |
Raises: | |
no exceptions explicitly raised. | |
""" | |
# Remove the plugin menu item and icon | |
self.iface.removePluginMenu(self.tr('InaSAFE'), | |
self.actionDock) | |
self.iface.removeToolBarIcon(self.actionDock) | |
self.iface.removePluginMenu(self.tr('InaSAFE'), | |
self.actionKeywordsDialog) | |
self.iface.removeToolBarIcon(self.actionKeywordsDialog) | |
self.iface.removePluginMenu(self.tr('InaSAFE'), | |
self.actionResetDock) | |
self.iface.removeToolBarIcon(self.actionResetDock) | |
self.iface.removePluginMenu(self.tr('InaSAFE'), | |
self.actionOptions) | |
self.iface.removeToolBarIcon(self.actionOptions) | |
self.iface.removePluginMenu(self.tr('InaSAFE'), | |
self.actionImpactFunctionsDoc) | |
self.iface.removeToolBarIcon(self.actionImpactFunctionsDoc) | |
self.iface.mainWindow().removeDockWidget(self.dockWidget) | |
self.dockWidget.setVisible(False) | |
self.dockWidget.destroy() | |
QObject.disconnect(self.iface, | |
SIGNAL("currentLayerChanged(QgsMapLayer*)"), | |
self.layerChanged) | |
# Try to force unloading of all modules see issue #463 | |
# https://github.com/AIFDR/inasafe/issues/463 | |
for myKey in sys.modules.keys(): | |
if 'safe' in myKey: | |
try: | |
del sys.modules[myKey] | |
except: | |
pass | |
try: | |
myLogger = logging.getLogger('InaSAFE') | |
myLogger.handlers = [] | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment