0

I'd like to enable or disable a repository from the plugin repository with pyqgis.

Exactly like when you're clicking on this checkbox in the plugin manager interface : plugin_manager_interface_screenshot_enable_disable_repository

I only find a way to remove a repository but i'd rather just disable it if possible.

1 Answer 1

0

After some research based on this question.

I found a solution to disable a plugin repository:

from qgis.PyQt.QtCore import QSettings
from pyplugin_installer import instance
from qgis.utils import updateAvailablePlugins

plugin_repository_name = 'Dépôt officiel des extensions QGIS'

settings = QSettings()

for setting in settings.allKeys():
    if setting.find('{}/enabled'.format(plugin_repository_name)) > 0:
        settings.setValue(setting, False)
updateAvailablePlugins()
instance().reloadAndExportData()

And enable it :

from qgis.PyQt.QtCore import QSettings
from pyplugin_installer import instance
from qgis.utils import updateAvailablePlugins

plugin_repository_name = 'Dépôt officiel des extensions QGIS'

settings = QSettings()

for setting in settings.allKeys():
    if setting.find('{}/enabled'.format(plugin_repository_name)) > 0:
        settings.setValue(setting, True)
updateAvailablePlugins()
instance().reloadAndExportData()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.