[Plugin Manager] Better cope with broken plugins

This commit is contained in:
Borys Jurgiel 2013-06-06 23:35:52 +02:00
parent b005f10470
commit eda9cd3380
3 changed files with 7 additions and 4 deletions

View File

@ -193,6 +193,7 @@ def startPlugin(packageName):
global plugins, active_plugins, iface
if packageName in active_plugins: return False
if packageName not in sys.modules: return False
package = sys.modules[packageName]

View File

@ -484,8 +484,9 @@ void QgsPluginManager::pluginItemChanged( QStandardItem * item )
QgsDebugMsg( " Loading plugin: " + id );
loadPlugin( id );
}
else if ( ! item->checkState() && isPluginLoaded( id ) )
else if ( ! item->checkState() )
{
// don't test if isPluginLoaded, to allow disable also plugins taht weren't successfully loaded
QgsDebugMsg( " Unloading plugin: " + id );
unloadPlugin( id );
}

View File

@ -383,11 +383,12 @@ void QgsPluginRegistry::unloadPythonPlugin( QString packageName )
if ( isLoaded( packageName ) )
{
mPythonUtils->unloadPlugin( packageName );
// add to settings
QSettings settings;
settings.setValue( "/PythonPlugins/" + packageName, false );
QgsDebugMsg( "Python plugin successfully unloaded: " + packageName );
}
// disable the plugin no matter if successfully loaded or not
QSettings settings;
settings.setValue( "/PythonPlugins/" + packageName, false );
}