Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #8214 from borysiasty/plugin_manager_fixes
Plugin manager minor fixes
  • Loading branch information
borysiasty committed Oct 17, 2018
2 parents a0d46d1 + 57faed4 commit 100a14e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
2 changes: 1 addition & 1 deletion python/pyplugin_installer/installer.py
Expand Up @@ -600,7 +600,6 @@ def installFromZipFile(self, filePath):
loadPlugin(pluginName)
plugins.getAllInstalled()
plugins.rebuild()
self.exportPluginsToManager()

if settings.contains('/PythonPlugins/' + pluginName):
if settings.value('/PythonPlugins/' + pluginName, False, bool):
Expand All @@ -613,6 +612,7 @@ def installFromZipFile(self, filePath):
if startPlugin(pluginName):
settings.setValue('/PythonPlugins/' + pluginName, True)

self.exportPluginsToManager()
msg = "<b>%s</b>" % self.tr("Plugin installed successfully")
else:
msg = "<b>%s:</b> %s" % (self.tr("Plugin installation failed"), infoString)
Expand Down
27 changes: 7 additions & 20 deletions src/app/pluginmanager/qgspluginmanager.cpp
Expand Up @@ -68,7 +68,6 @@ QgsPluginManager::QgsPluginManager( QWidget *parent, bool pluginsAreEnabled, Qt:
mPythonUtils = nullptr;

setupUi( this );
connect( vwPlugins, &QListView::clicked, this, &QgsPluginManager::vwPlugins_clicked );
connect( vwPlugins, &QListView::doubleClicked, this, &QgsPluginManager::vwPlugins_doubleClicked );
connect( wvDetails, &QgsWebView::linkClicked, this, &QgsPluginManager::wvDetails_linkClicked );
connect( leFilter, &QgsFilterLineEdit::textChanged, this, &QgsPluginManager::leFilter_textChanged );
Expand Down Expand Up @@ -128,7 +127,13 @@ QgsPluginManager::QgsPluginManager( QWidget *parent, bool pluginsAreEnabled, Qt:
mPluginsDetailsSplitter->restoreState( settings.value( QStringLiteral( "Windows/PluginManager/secondSplitterState" ) ).toByteArray() );
// 2) The current mOptionsListWidget index (it will overwrite the "tab" setting of QgsOptionsDialogBase that handles the stackedWidget page
// instead of the mOptionsListWidget index). Then the signal connected above will update the relevant page as well.
mOptionsListWidget->setCurrentRow( settings.value( QStringLiteral( "Windows/PluginManager/option" ), 0 ).toInt() );
int option = settings.value( QStringLiteral( "Windows/PluginManager/option" ), 0 ).toInt();
mOptionsListWidget->setCurrentRow( option );
if ( option == 0 )
{
// The first option won't fire the currentRowChanged signal, so initialize the first tab explicitly
setCurrentTab( 0 );
}

// Hide widgets only suitable with Python support enabled (they will be uncovered back in setPythonUtils)
buttonUpgradeAll->hide();
Expand Down Expand Up @@ -1235,31 +1240,13 @@ void QgsPluginManager::setCurrentTab( int idx )


void QgsPluginManager::currentPluginChanged( const QModelIndex &index )
{
if ( index.column() == 0 )
{
// Do exactly the same as if a plugin was clicked
vwPlugins_clicked( index );
}
}



void QgsPluginManager::vwPlugins_clicked( const QModelIndex &index )
{
if ( index.column() == 0 )
{
// If the model has been filtered, the index row in the proxy won't match the index row in the underlying model
// so we need to jump through this little hoop to get the correct item
QModelIndex realIndex = mModelProxy->mapToSource( index );
QStandardItem *mypItem = mModelPlugins->itemFromIndex( realIndex );
if ( !mypItem->isEnabled() )
{
//The item is inactive (uncompatible or broken plugin), so it can't be selected. Display it's data anyway.
vwPlugins->clearSelection();
}
// Display details in any case: selection changed, inactive button clicked,
// or previously selected plugin clicked (while details view contains the welcome message for a category)
showPluginDetails( mypItem );
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/app/pluginmanager/qgspluginmanager.h
Expand Up @@ -111,9 +111,6 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
//! Load/unload plugin when checkbox state changed
void pluginItemChanged( QStandardItem *item );

//! Display details of inactive item too
void vwPlugins_clicked( const QModelIndex &index );

//! Load/unload plugin by double-click
void vwPlugins_doubleClicked( const QModelIndex &index );

Expand Down

0 comments on commit 100a14e

Please sign in to comment.