@@ -194,7 +194,8 @@ def run(self):
194
194
if self .first_start :
195
195
self .first_start = False
196
196
self .dlg = PluginExporterDialog ()
197
- pyplugin_installer .instance ().reloadAndExportData () # Generate metadata cache
197
+ self .pyplugin = pyplugin_installer .instance ()
198
+ self .pyplugin .reloadAndExportData () # Generate metadata cache
198
199
self .get_plugins ()
199
200
self .dlg .btn_select_all .clicked .connect (self .select_all )
200
201
self .dlg .btn_deselect_all .clicked .connect (self .deselect_all )
@@ -389,9 +390,10 @@ def import_plugins(self):
389
390
try :
390
391
if plugin ['id' ] == '-' : # It's a third party repository
391
392
self .add_repository (plugin )
392
- pyplugin_installer .instance ().fetchAvailablePlugins (True )
393
- pyplugin_installer .instance ().installPlugin (plugin ['id' ])
394
- self .iface .messageBar ().pushSuccess ("Success" , plugin ['name' ] + " was installed successfully." )
393
+ self .iface .messageBar ().pushSuccess ("Success" , plugin ['name' ] + " was added to the repositories." )
394
+ else :
395
+ self .pyplugin .installPlugin (plugin ['id' ])
396
+ self .iface .messageBar ().pushSuccess ("Success" , plugin ['name' ] + " was installed successfully." )
395
397
except KeyError :
396
398
self .iface .messageBar ().pushMessage ("Error" ,
397
399
"Could not install " + plugin ['name' ] + "." ,
@@ -402,17 +404,18 @@ def import_plugins(self):
402
404
def add_repository (self , repo_info ):
403
405
settings = QgsSettings ()
404
406
settings .beginGroup ("app/plugin_repositories" )
405
- reposName = repo_info ['name' ]
406
- reposURL = repo_info ['zip_repository' ]
407
- if reposName in repositories .all ():
408
- reposName = reposName + "(2)"
407
+ repo_name = repo_info ['name' ]
408
+ repo_url = repo_info ['zip_repository' ]
409
+ if repo_name in repositories .all ():
410
+ repo_name = repo_name + "(2)"
411
+ self .iface .messageBar ().pushInfo ("Info" ,
412
+ "Found a repository with the same names. Please check your repository "
413
+ "settings for duplicate entries, the one imported ends with (2)." )
409
414
# add to settings
410
- settings .setValue (reposName + "/url" , reposURL )
411
- settings .setValue (reposName + "/authcfg" , "" ) #dlg.editAuthCfg.text().strip())
412
- settings .setValue (reposName + "/enabled" , "True" ) #bool(dlg.checkBoxEnabled.checkState()))
413
- # refresh lists and populate widgets
414
- #plugins.removeRepository(reposName)
415
- pyplugin_installer .instance ().reloadAndExportData ()
415
+ settings .setValue (repo_name + "/url" , repo_url )
416
+ settings .setValue (repo_name + "/authcfg" , "" )
417
+ settings .setValue (repo_name + "/enabled" , "True" )
418
+ self .pyplugin .reloadAndExportData ()
416
419
417
420
# Disables and enables widgets
418
421
def toggle_widget (self ):
0 commit comments