@@ -295,7 +295,7 @@ def export_plugins(self):
295295 rows = table .rowCount ()
296296 cols = table .columnCount ()
297297
298- if self .dlg .chk_core_plugins .isChecked ():
298+ if self .dlg .chk_ext_repos .isChecked ():
299299 repos = repositories .allEnabled ()
300300 else :
301301 repos = None
@@ -329,6 +329,12 @@ def export_plugins(self):
329329 self .iface .messageBar ().pushSuccess ("Success" , "Selected plugins were exported successfully." )
330330 elif file_format == '.json' :
331331 with open (output_file , 'w' ) as file :
332+ if repos :
333+ for key , value in repos .items ():
334+ if key == 'QGIS Official Plugin Repository' :
335+ pass
336+ else :
337+ plugin_list .insert (0 , {'id' : '-' , 'name' : key , 'zip_repository' : value ['url' ]})
332338 json .dump (plugin_list , file )
333339 self .iface .messageBar ().pushSuccess ("Success" , "Selected plugins were exported successfully." )
334340 except IsADirectoryError :
@@ -394,7 +400,6 @@ def import_plugins(self):
394400 try :
395401 if plugin ['id' ] == '-' : # It's a third party repository
396402 self .add_repository (plugin )
397- self .iface .messageBar ().pushSuccess ("Success" , plugin ['name' ] + " was added to the repositories." )
398403 else :
399404 self .pyplugin .installPlugin (plugin ['id' ])
400405 self .iface .messageBar ().pushSuccess ("Success" , plugin ['name' ] + " was installed successfully." )
@@ -411,28 +416,31 @@ def add_repository(self, repo_info):
411416 repo_name = repo_info ['name' ]
412417 repo_url = repo_info ['zip_repository' ]
413418 if repo_name in repositories .all ():
414- repo_name = repo_name + "(2)"
415419 self .iface .messageBar ().pushInfo ("Info" ,
416- "Found a repository with the same names. Please check your repository "
417- "settings for duplicate entries, the one imported ends with (2)." )
418- # add to settings
419- settings .setValue (repo_name + "/url" , repo_url )
420- settings .setValue (repo_name + "/authcfg" , "" )
421- settings .setValue (repo_name + "/enabled" , "True" )
422- self .pyplugin .reloadAndExportData ()
420+ "Found a repository with the same name. Skipping repository " + repo_name +
421+ ". This could prevent a plugin from being installed." )
422+ else :
423+ # Adds the repo inside the settings
424+ settings .setValue (repo_name + "/url" , repo_url )
425+ settings .setValue (repo_name + "/authcfg" , "" )
426+ settings .setValue (repo_name + "/enabled" , "True" )
427+ self .pyplugin .reloadAndExportData ()
428+ self .iface .messageBar ().pushSuccess ("Success" , repo_name + " was added to the repositories." )
423429
424430 # Disables and enables widgets
425431 def toggle_widget (self ):
426432 if self .dlg .rd_import .isChecked ():
427433 self .dlg .file_output_export .setEnabled (False )
428434 self .dlg .combo_file_format .setEnabled (False )
435+ self .dlg .chk_ext_repos .setEnabled (False )
429436 self .dlg .chk_skip_installed .setEnabled (True )
430437 self .dlg .file_input_import .setEnabled (True )
431438 else :
432439 self .dlg .file_input_import .setEnabled (False )
433440 self .dlg .chk_skip_installed .setEnabled (False )
434441 self .dlg .file_output_export .setEnabled (True )
435442 self .dlg .combo_file_format .setEnabled (True )
443+ self .dlg .chk_ext_repos .setEnabled (True )
436444
437445 # Sets the file extension filter for the QgsFileWidget
438446 def set_filter (self ):
0 commit comments