Skip to content

Commit

Permalink
[Plugin Manager] Better cope with broken plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
borysiasty committed Jun 6, 2013
1 parent b005f10 commit eda9cd3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions python/utils.py
Expand Up @@ -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]

Expand Down
3 changes: 2 additions & 1 deletion src/app/pluginmanager/qgspluginmanager.cpp
Expand Up @@ -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 );
}
Expand Down
7 changes: 4 additions & 3 deletions src/app/qgspluginregistry.cpp
Expand Up @@ -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 );
}


Expand Down

0 comments on commit eda9cd3

Please sign in to comment.