@@ -178,12 +178,17 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils *pythonUtils )
178
178
{
179
179
mPythonUtils = pythonUtils;
180
180
181
+ // get the QgsSettings group from the installer
182
+ QString settingsGroup;
183
+ QgsPythonRunner::eval ( QStringLiteral ( " pyplugin_installer.instance().exportSettingsGroup()" ), settingsGroup );
184
+ QgsSettings settings;
185
+
181
186
// Now enable Python support:
182
187
// Show and preset widgets only suitable when Python support active
183
188
mOptionsListWidget ->item ( PLUGMAN_TAB_INSTALL_FROM_ZIP )->setHidden ( false );
184
189
buttonUpgradeAll->show ();
185
190
buttonInstall->show ();
186
- buttonInstallExperimental->show ( );
191
+ buttonInstallExperimental->setVisible ( settings. value ( settingsGroup + " /allowExperimental " , false ). toBool () );
187
192
buttonUninstall->show ();
188
193
frameSettings->setHidden ( false );
189
194
labelNoPython->setHidden ( true );
@@ -227,11 +232,6 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils *pythonUtils )
227
232
connect ( actionSortByDateCreated, &QAction::triggered, mModelProxy , &QgsPluginSortFilterProxyModel::sortPluginsByDateCreated );
228
233
connect ( actionSortByDateUpdated, &QAction::triggered, mModelProxy , &QgsPluginSortFilterProxyModel::sortPluginsByDateUpdated );
229
234
230
- // get the QgsSettings group from the installer
231
- QString settingsGroup;
232
- QgsPythonRunner::eval ( QStringLiteral ( " pyplugin_installer.instance().exportSettingsGroup()" ), settingsGroup );
233
- QgsSettings settings;
234
-
235
235
// Initialize the "Install from ZIP" tab widgets
236
236
mZipFileWidget ->setDefaultRoot ( settings.value ( settingsGroup + " /lastZipDirectory" , " ." ).toString () );
237
237
mZipFileWidget ->setFilter ( tr ( " Plugin packages (*.zip *.ZIP)" ) );
@@ -854,7 +854,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
854
854
" </table>" ).arg ( tr ( " Installed version of this plugin is higher than any version found in repository" ) );
855
855
}
856
856
857
- if ( metadata->value ( QStringLiteral ( " experimental " ) ) == QLatin1String ( " true " ) )
857
+ if ( ! metadata->value ( QStringLiteral ( " version_available_experimental " ) ). isEmpty ( ) )
858
858
{
859
859
html += QString ( " <table bgcolor=\" #EEEEBB\" cellspacing=\" 2\" cellpadding=\" 2\" width=\" 100%\" >"
860
860
" <tr><td width=\" 100%\" style=\" color:#660000\" >"
@@ -1125,18 +1125,20 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
1125
1125
buttonInstallExperimental->setText ( tr ( " Reinstall Experimental Plugin" ) );
1126
1126
}
1127
1127
1128
- // DEBUG TODO REMOVE
1129
- // buttonInstall->setText( buttonInstall->text() + QStringLiteral(" | ") + metadata->value( QStringLiteral( "status" ) ) );
1130
- // buttonInstallExperimental->setText( buttonInstallExperimental->text() + QStringLiteral(" | ") + metadata->value( QStringLiteral( "status_exp" ) ) );
1131
-
1132
1128
// Enable/disable buttons
1133
1129
1130
+ QgsSettings settings;
1131
+ QString settingsGroup;
1132
+ QgsPythonRunner::eval ( QStringLiteral ( " pyplugin_installer.instance().exportSettingsGroup()" ), settingsGroup );
1133
+ bool expAllowed = settings.value ( settingsGroup + " /allowExperimental" , false ).toBool ();
1134
+
1134
1135
bool installEnabled = metadata->value ( QStringLiteral ( " pythonic" ) ).toUpper () == QLatin1String ( " TRUE" ) && metadata->value ( QStringLiteral ( " status" ) ) != QLatin1String ( " orphan" ) && metadata->value ( QStringLiteral ( " status" ) ) != QLatin1String ( " none available" );
1135
1136
bool installExpEnabled = metadata->value ( QStringLiteral ( " pythonic" ) ).toUpper () == QLatin1String ( " TRUE" ) && metadata->value ( QStringLiteral ( " status_exp" ) ) != QLatin1String ( " orphan" ) && metadata->value ( QStringLiteral ( " status_exp" ) ) != QLatin1String ( " none available" );
1137
+
1136
1138
buttonInstall->setEnabled ( installEnabled );
1137
1139
buttonInstall->setVisible ( installEnabled || !installExpEnabled );
1138
- buttonInstallExperimental->setEnabled ( installExpEnabled );
1139
- buttonInstallExperimental->setVisible ( installExpEnabled || !installEnabled );
1140
+ buttonInstallExperimental->setEnabled ( expAllowed && installExpEnabled );
1141
+ buttonInstallExperimental->setVisible ( expAllowed && installExpEnabled );
1140
1142
1141
1143
buttonUninstall->setEnabled ( metadata->value ( QStringLiteral ( " pythonic" ) ).toUpper () == QLatin1String ( " TRUE" ) && metadata->value ( QStringLiteral ( " readonly" ) ) != QLatin1String ( " true" ) && ! metadata->value ( QStringLiteral ( " version_installed" ) ).isEmpty () );
1142
1144
0 commit comments