[QGIS Commit] r10587 - trunk/qgis/python/plugins/plugin_installer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Apr 17 19:41:14 EDT 2009


Author: borysiasty
Date: 2009-04-17 19:41:14 -0400 (Fri, 17 Apr 2009)
New Revision: 10587

Modified:
   trunk/qgis/python/plugins/plugin_installer/__init__.py
   trunk/qgis/python/plugins/plugin_installer/i18n.cpp
   trunk/qgis/python/plugins/plugin_installer/installer_data.py
   trunk/qgis/python/plugins/plugin_installer/installer_gui.py
   trunk/qgis/python/plugins/plugin_installer/installer_plugin.py
Log:
Plugin Installer update - cleaning and refactoring

Modified: trunk/qgis/python/plugins/plugin_installer/__init__.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/__init__.py	2009-04-17 16:34:14 UTC (rev 10586)
+++ trunk/qgis/python/plugins/plugin_installer/__init__.py	2009-04-17 23:41:14 UTC (rev 10587)
@@ -1,6 +1,6 @@
 """
 Copyright (C) 2007-2008 Matthew Perry
-Copyright (C) 2008 Borys Jurgiel
+Copyright (C) 2008-2009 Borys Jurgiel
 /***************************************************************************
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -14,7 +14,7 @@
   return "Plugin Installer"
 
 def version():
-  return "Version 0.9.14"
+  return "Version 1.0"
 
 def description():
   return "Downloads and installs QGIS python plugins"

Modified: trunk/qgis/python/plugins/plugin_installer/i18n.cpp
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/i18n.cpp	2009-04-17 16:34:14 UTC (rev 10586)
+++ trunk/qgis/python/plugins/plugin_installer/i18n.cpp	2009-04-17 23:41:14 UTC (rev 10587)
@@ -43,9 +43,11 @@
 // InstallerPlugin::initGui
 translate( "QgsPluginInstaller", "Fetch Python Plugins..." )
 translate( "QgsPluginInstaller", "Install more plugins from remote repositories" )
-translate( "QgsPluginInstaller", "Install more plugins from remote repositories" )
 translate( "QgsPluginInstaller", "Looking for new plugins..." )
+translate( "QgsPluginInstaller", "QGIS Plugin Conflict:" )
+translate( "QgsPluginInstaller", "The Plugin Installer has detected an obsolete plugin which masks a newer version shipped with this QGIS version. Probably it is a remainder of an older QGIS installation. Please use the Plugin Installer to remove it in order to unmask the instance shipped with this version of QGIS." )
 
+
 // InstallerPlugin::checkingDone
 translate( "QgsPluginInstaller", "There is a new plugin available" )
 translate( "QgsPluginInstaller", "There is a plugin update available" )

Modified: trunk/qgis/python/plugins/plugin_installer/installer_data.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_data.py	2009-04-17 16:34:14 UTC (rev 10586)
+++ trunk/qgis/python/plugins/plugin_installer/installer_data.py	2009-04-17 23:41:14 UTC (rev 10587)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """
 Copyright (C) 2007-2008 Matthew Perry
-Copyright (C) 2008 Borys Jurgiel
+Copyright (C) 2008-2009 Borys Jurgiel
 
 /***************************************************************************
  *                                                                         *
@@ -20,8 +20,8 @@
 from qgis.core import *
 from unzip import unzip
 from version_compare import compareVersions, normalizeVersion
+import sys
 
-
 """
 Data structure:
 mRepositories = dict of dicts: {repoName : {"url" QString,
@@ -84,7 +84,7 @@
                 ("Martin Dobias' Sandbox",     "http://mapserver.sk/~wonder/qgis/plugins-sandbox.xml", ""),
                 ("Aaron Racicot's Repository", "http://qgisplugins.z-pulley.com", ""),
                 ("Barry Rowlingson's Repository", "http://www.maths.lancs.ac.uk/~rowlings/Qgis/Plugins/plugins.xml", ""),
-                ("GIS-Lab Repository", 		"http://gis-lab.info/programs/qgis/qgis-repo.xml", "")]
+                ("GIS-Lab Repository",         "http://gis-lab.info/programs/qgis/qgis-repo.xml", "")]
 
 
 
@@ -245,12 +245,18 @@
 
 
   # ----------------------------------------- #
-  def setRepositoryData(self,reposName, key, value):
+  def setRepositoryData(self, reposName, key, value):
     """ write data to the mRepositories dict """
     self.mRepositories[reposName][key] = value
 
 
   # ----------------------------------------- #
+  def remove(self, reposName):
+    """ remove given item from the mRepositories dict """
+    del self.mRepositories[reposName]
+
+
+  # ----------------------------------------- #
   def rename(self, oldName, newName):
     """ rename repository key """
     if oldName == newName:
@@ -284,7 +290,7 @@
     interval = 0
     for j in [1,3,7,14,30]:
       if i >= j:
-	interval = j
+        interval = j
     return interval
 
 
@@ -414,8 +420,7 @@
           experimental = False
           if pluginNodes.item(i).firstChildElement("experimental").text().simplified().toUpper() in ["TRUE","YES"]:
             experimental = True
-          plugin = {}
-          plugin[name] = {
+          plugin = {
             "name"          : pluginNodes.item(i).toElement().attribute("name"),
             "version_avail" : pluginNodes.item(i).toElement().attribute("version"),
             "desc_repo"     : pluginNodes.item(i).firstChildElement("description").text().simplified(),
@@ -440,8 +445,8 @@
           #if compatible, add the plugin to the list
           if compareVersions(QGIS_VER, qgisMinimumVersion) < 2 and compareVersions(qgisMaximumVersion, QGIS_VER) < 2:
             if QGIS_VER[0]==qgisMinimumVersion[0] or name=="plugin_installer" or (qgisMinimumVersion!="0" and qgisMaximumVersion!="2"):
-              plugins.addPlugin(plugin)
-        plugins.workarounds()
+              #add the plugin to the cache
+              plugins.addFromRepository(plugin)
         self.mRepositories[reposName]["state"] = 2
       else:
         #print "Repository parsing error"
@@ -452,7 +457,7 @@
 
     # is the checking done?
     if not self.fetchingInProgress():
-      plugins.getAllInstalled()
+      plugins.rebuild()
       self.saveCheckingOnStartLastDate()
       self.emit(SIGNAL("checkingDone()"))
 # --- /class Repositories ---------------------------------------------------------------- #
@@ -467,7 +472,10 @@
   # ----------------------------------------- #
   def __init__(self):
     QObject.__init__(self)
-    self.mPlugins = {}
+    self.mPlugins = {}   # the dict of plugins (dicts)
+    self.repoCache = {}  # the dict of lists of plugins (dicts)
+    self.localCache = {} # the dict of plugins (dicts)
+    self.obsoletePlugins = [] # the list of outdated 'user' plugins masking newer 'system' ones
 
 
   # ----------------------------------------- #
@@ -486,37 +494,39 @@
 
 
   # ----------------------------------------- #
-  def setPluginData(self, pluginName, key, value):
-    """ write data to the mPlugins dict """
-    self.mPlugins[pluginName][key] = value
+  def addInstalled(self, plugin):
+    """ add given plugin to the localCache """
+    key = plugin["localdir"]
+    self.localCache[key] = plugin
 
 
   # ----------------------------------------- #
-  def clear(self):
-    """ clear the plugins dict"""
-    self.mPlugins = {}
+  def addFromRepository(self, plugin):
+    """ add given plugin to the repoCache """
+    repo = plugin["repository"]
+    try:
+      self.repoCache[repo] += [plugin]
+    except:
+      self.repoCache[repo] = [plugin]
 
 
   # ----------------------------------------- #
-  def addPlugin(self, plugins):
-    """ add a plugin (first from given) to the mPlugins dict """
-    key = plugins.keys()[0]
-    plugin = plugins[key]
-    plugin["version_avail"] = normalizeVersion(plugin["version_avail"])
-    plugin["version_inst"] = normalizeVersion(plugin["version_inst"])
-    if not self.mPlugins.has_key(key) or compareVersions(self.mPlugins[key]["version_avail"],plugin["version_avail"]) == 2:
-      self.mPlugins[key] = plugin # add the plugin if not present yet or if is newer than existing one
+  def removeInstalledPlugin(self, key):
+    """ remove given plugin from the localCache """
+    if self.localCache.has_key(key):
+      del self.localCache[key]
 
 
   # ----------------------------------------- #
-  def remove(self, key):
-    """ remove given plugin from the mPlugins dict """
-    del self.mPlugins[key]
+  def removeRepository(self, repo):
+    """ remove whole repository from the repoCache """
+    if self.repoCache.has_key(repo):
+      del self.repoCache[repo]
 
 
   # ----------------------------------------- #
-  def updatePlugin(self, key, readOnly):
-    """ The mPlugins should contain available plugins first. Now, add installed one (add when not present, update if present) """
+  def getInstalledPlugin(self, key, readOnly):
+    """ get the metadata of an installed plugin """
     if readOnly:
       path = QgsApplication.pkgDataPath()
     else:
@@ -532,7 +542,8 @@
     error = ""
     errorDetails = ""
     try:
-      exec("import "+ key)
+      exec("import %s" % key)
+      exec("reload (%s)" % key)
       try:
         exec("nam = %s.name()" % key)
       except:
@@ -589,65 +600,38 @@
         "url"           : path,
         "experimental"  : False,
         "filename"      : "",
-        "status"        : "",
+        "status"        : "orphan",
         "error"         : error,
         "error_details" : errorDetails,
         "repository"    : "",
         "localdir"      : key,
         "read-only"     : readOnly}
+    return plugin
 
-    if not self.mPlugins.has_key(key):
-      self.mPlugins[key] = plugin   # just add a new plugin
-    else:
-      self.mPlugins[key]["localdir"] = plugin["localdir"]
-      self.mPlugins[key]["read-only"] = plugin["read-only"]
-      self.mPlugins[key]["error"] = plugin["error"]
-      self.mPlugins[key]["error_details"] = plugin["error_details"]
-      if plugin["name"] and plugin["name"] != key:
-        self.mPlugins[key]["name"] = plugin["name"] # local name has higher priority
-      self.mPlugins[key]["version_inst"] = plugin["version_inst"]
-      self.mPlugins[key]["desc_local"] = plugin["desc_local"]
-    # set status
-    #
-    # installed   available   status
-    # ---------------------------------------
-    # none        any         "not installed" (will be later checked if is "new")
-    # any         none        "orphan"
-    # same        same        "installed"
-    # less        greater     "upgradeable"
-    # greater     less        "newer"
-    if not self.mPlugins[key]["version_avail"]:
-      self.mPlugins[key]["status"] = "orphan"
-    elif self.mPlugins[key]["error"] in ["broken","dependent"]:
-      self.mPlugins[key]["status"] = "installed"
-    elif not self.mPlugins[key]["version_inst"]:
-      self.mPlugins[key]["status"] = "not installed"
-    elif compareVersions(self.mPlugins[key]["version_avail"],self.mPlugins[key]["version_inst"]) == 0:
-      self.mPlugins[key]["status"] = "installed"
-    elif compareVersions(self.mPlugins[key]["version_avail"],self.mPlugins[key]["version_inst"]) == 1:
-      self.mPlugins[key]["status"] = "upgradeable"
-    else:
-      self.mPlugins[key]["status"] = "newer"
 
-
   # ----------------------------------------- #
   def getAllInstalled(self):
-    """ update the mPlugins dict with alredy installed plugins """
+    """ Build the localCache """
+    self.localCache = {}
     # first, try to add the read-only plugins...
+    pluginsPath = unicode(QDir.convertSeparators(QDir.cleanPath(QgsApplication.pkgDataPath() + "/python/plugins")))
+    #  temporarily add the system path as the first element to force loading the read-only plugins, even if masked by user ones.
+    sys.path = [pluginsPath] + sys.path
     try:
-      pluginDir = QDir.cleanPath(unicode(QgsApplication.pkgDataPath()) + "/python/plugins")
-      pluginDir = QDir(pluginDir)
+      pluginDir = QDir(pluginsPath)
       pluginDir.setFilter(QDir.AllDirs)
       for key in pluginDir.entryList():
         key = unicode(key)
         if not key in [".",".."]:
-          self.updatePlugin(key, True)
+          self.localCache[key] = self.getInstalledPlugin(key, True)
     except:
       # return QCoreApplication.translate("QgsPluginInstaller","Couldn't open the system plugin directory")
       pass # it's not necessary to stop due to this error
+    # remove the temporarily added path
+    sys.path.remove(pluginsPath)
     # ...then try to add locally installed ones
     try:
-      pluginDir = QDir.cleanPath(unicode(QgsApplication.qgisSettingsDirPath()) + "/python/plugins")
+      pluginDir = QDir.convertSeparators(QDir.cleanPath(QgsApplication.qgisSettingsDirPath() + "/python/plugins"))
       pluginDir = QDir(pluginDir)
       pluginDir.setFilter(QDir.AllDirs)
     except:
@@ -655,10 +639,71 @@
     for key in pluginDir.entryList():
       key = unicode(key)
       if not key in [".",".."]:
-        self.updatePlugin(key, False)
+        plugin = self.getInstalledPlugin(key, False)
+        if key in self.localCache.keys() and compareVersions(self.localCache[key]["version_inst"],plugin["version_inst"]) == 1:
+          # An obsolete plugin in the "user" location is masking a newer one in the "system" location!
+          self.obsoletePlugins += [key]
+        self.localCache[key] = plugin
 
 
   # ----------------------------------------- #
+  def rebuild(self):
+    """ build or rebuild the mPlugins from the caches """
+    self.mPlugins = {}
+    for i in self.localCache.keys():
+      self.mPlugins[i] = self.localCache[i].copy()
+    settings = QSettings()
+    (allowed, ok) = settings.value(settingsGroup+"/allowedPluginType", QVariant(2)).toInt()
+    for i in self.repoCache.values():
+      for plugin in i:
+        key = plugin["localdir"]
+        # check if the plugin is allowed and if there isn't any better one added already.
+        if (allowed != 1 or plugin["repository"] == officialRepo[0]) and (allowed == 3 or not plugin["experimental"]) \
+        and not (self.mPlugins.has_key(key) and self.mPlugins[key]["version_avail"] and compareVersions(self.mPlugins[key]["version_avail"], plugin["version_avail"]) < 2):
+          # The mPlugins doct contains now locally installed plugins. 
+          # Now, add the available one if not present yet or update it if present already.
+          if not self.mPlugins.has_key(key):
+            self.mPlugins[key] = plugin   # just add a new plugin
+          else:
+            self.mPlugins[key]["version_avail"] = plugin["version_avail"]
+            self.mPlugins[key]["desc_repo"] = plugin["desc_repo"]
+            self.mPlugins[key]["filename"] = plugin["filename"]
+            self.mPlugins[key]["repository"] = plugin["repository"]
+            self.mPlugins[key]["experimental"] = plugin["experimental"]
+            # use remote name if local one is not available
+            if self.mPlugins[key]["name"] == key and plugin["name"]:
+              self.mPlugins[key]["name"] = plugin["name"]
+            # those metadata has higher priority for their remote instances:
+            if plugin["author"]:
+              self.mPlugins[key]["author"] = plugin["author"]
+            if plugin["homepage"]:
+              self.mPlugins[key]["homepage"] = plugin["homepage"]
+            if plugin["url"]:
+              self.mPlugins[key]["url"] = plugin["url"]
+          # set status
+          #
+          # installed   available   status
+          # ---------------------------------------
+          # none        any         "not installed" (will be later checked if is "new")
+          # any         none        "orphan"
+          # same        same        "installed"
+          # less        greater     "upgradeable"
+          # greater     less        "newer"
+          if not self.mPlugins[key]["version_avail"]:
+            self.mPlugins[key]["status"] = "orphan"
+          elif self.mPlugins[key]["error"] in ["broken","dependent"]:
+            self.mPlugins[key]["status"] = "installed"
+          elif not self.mPlugins[key]["version_inst"]:
+            self.mPlugins[key]["status"] = "not installed"
+          elif compareVersions(self.mPlugins[key]["version_avail"],self.mPlugins[key]["version_inst"]) == 0:
+            self.mPlugins[key]["status"] = "installed"
+          elif compareVersions(self.mPlugins[key]["version_avail"],self.mPlugins[key]["version_inst"]) == 1:
+            self.mPlugins[key]["status"] = "upgradeable"
+          else:
+            self.mPlugins[key]["status"] = "newer"
+
+
+  # ----------------------------------------- #
   def markNews(self):
     """ mark all new plugins as new """
     settings = QSettings()
@@ -689,12 +734,6 @@
     return False
 
 
-  # ----------------------------------------- #
-  def workarounds(self):
-    """ workarounds for particular plugins with wrong metadata """
-    if self.mPlugins.has_key("select") and self.mPlugins["select"]["version_avail"] == "0.1":
-      self.mPlugins["select"]["version_avail"] = "0.2"
-
 # --- /class Plugins --------------------------------------------------------------------- #
 
 

Modified: trunk/qgis/python/plugins/plugin_installer/installer_gui.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_gui.py	2009-04-17 16:34:14 UTC (rev 10586)
+++ trunk/qgis/python/plugins/plugin_installer/installer_gui.py	2009-04-17 23:41:14 UTC (rev 10587)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """
 Copyright (C) 2007-2008 Matthew Perry
-Copyright (C) 2008 Borys Jurgiel
+Copyright (C) 2008-2009 Borys Jurgiel
 
 /***************************************************************************
  *                                                                         *
@@ -288,9 +288,10 @@
 
   # ----------------------------------------- #
   def getAllAvailablePlugins(self):
-    """ repopulate the mPlugins dict """
+    """ fetch plugins from all repositories """
     repositories.load()
-    plugins.clear()
+    plugins.getAllInstalled()
+
     for key in repositories.allEnabled():
       repositories.requestFetching(key)
 
@@ -306,9 +307,7 @@
       for key in repositories.allUnavailable():
         QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), self.tr("Error reading repository:") + " " + key + "\n" + repositories.all()[key]["error"])
 
-    plugins.getAllInstalled()
 
-
   # ----------------------------------------- #
   def populateMostWidgets(self):
     self.comboFilter1.clear()
@@ -389,10 +388,6 @@
       return False
     if self.comboFilter2.currentIndex() == 3 and not plugin["status"] in ["upgradeable","new"]:
       return False
-    if self.radioPluginType0.isChecked() and plugin["repository"] != officialRepo[0] and plugin["status"] in ["not installed","new"]:
-      return False
-    if self.radioPluginType1.isChecked() and plugin["experimental"] and plugin["status"] in ["not installed","new"]:
-      return False
     if self.lineFilter.text() == "":
       return True
     else:
@@ -579,7 +574,8 @@
     elif not QDir(QDir.cleanPath(QgsApplication.qgisSettingsDirPath() + "/python/plugins/" + key)).exists():
       infoString = (self.tr("Plugin has disappeared"), self.tr("The plugin seems to have been installed but I don't know where. Probably the plugin package contained a wrong named directory.\nPlease search the list of installed plugins. I'm nearly sure you'll find the plugin there, but I just can't determine which of them it is. It also means that I won't be able to determine if this plugin is installed and inform you about available updates. However the plugin may work. Please contact the plugin author and submit this issue."))
       QApplication.setOverrideCursor(Qt.WaitCursor)
-      self.getAllAvailablePlugins()
+      plugins.getAllInstalled()
+      plugins.rebuild()
       QApplication.restoreOverrideCursor()
     else:
       try:
@@ -588,14 +584,12 @@
         exec ("reload (%s)" % plugin["localdir"])
       except:
         pass
-      plugins.updatePlugin(key, False)
+      plugins.getAllInstalled()
+      plugins.rebuild()
       plugin = plugins.all()[key]
       if not plugin["error"]:
         if previousStatus in ["not installed", "new"]:
-          if QGIS_VER[0:3] == "1.1":
-            infoString = (self.tr("QGIS Python Plugin Installer"), self.tr("Plugin installed successfully"))
-          else:
-            infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
+          infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
         else:
           infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
       else:
@@ -612,11 +606,8 @@
         dlg.exec_()
         if dlg.result():
           # revert installation
-          plugins.setPluginData(key, "status", "not installed")
-          plugins.setPluginData(key, "version_inst", "")
-          plugins.setPluginData(key, "desc_local", "")
-          plugins.setPluginData(key, "error", "")
-          plugins.setPluginData(key, "error_details", "")
+          plugins.getAllInstalled()
+          plugins.rebuild()
           pluginDir = QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + "/python/plugins/" + plugin["localdir"]
           removeDir(pluginDir)
           if QDir(pluginDir).exists():
@@ -627,14 +618,13 @@
               exec ("reload (%s)" % plugin["localdir"])
             except:
               pass
-            plugins.updatePlugin(key, False)
           else:
             try:
               exec ("del sys.modules[%s]" % plugin["localdir"])
             except:
               pass
-            if not plugin["repository"]:
-              plugins.remove(key)
+          plugins.getAllInstalled()
+          plugins.rebuild()
     if plugins.all().has_key(key) and not plugins.all()[key]["status"] in ["not installed", "new"]:
       if previousStatus in ["not installed", "new"]:
         history.markChange(key,'A')
@@ -675,14 +665,8 @@
         exec ("del sys.modules[%s]" % plugin["localdir"])
       except:
         pass
-      if not plugin["repository"]:
-        plugins.remove(key)
-      else:
-        plugins.setPluginData(key, "status", "not installed")
-        plugins.setPluginData(key, "version_inst", "")
-        plugins.setPluginData(key, "desc_local", "")
-        plugins.setPluginData(key, "error", "")
-        plugins.setPluginData(key, "error_details", "")
+      plugins.getAllInstalled()
+      plugins.rebuild()
       self.populatePluginTree()
       QMessageBox.information(self, self.tr("Plugin uninstalled successfully"), self.tr("Python plugin uninstalled. Note that you may need to restart Quantum GIS in order to remove it completely."))
       history.markChange(key,'D')
@@ -728,6 +712,7 @@
       i = 3
     settings = QSettings()
     settings.setValue(settingsGroup+"/allowedPluginType", QVariant(i))
+    plugins.rebuild()
     self.populatePluginTree()
 
 
@@ -740,6 +725,7 @@
       # refresh lists and populate widgets
       QApplication.setOverrideCursor(Qt.WaitCursor)
       self.getAllAvailablePlugins()
+      plugins.rebuild()
       self.populateMostWidgets()
       self.populatePluginTree()
       QApplication.restoreOverrideCursor()
@@ -767,7 +753,9 @@
     settings.setValue(reposName+"/enabled", QVariant(bool(dlg.checkBoxEnabled.checkState())))
     # refresh lists and populate widgets
     QApplication.setOverrideCursor(Qt.WaitCursor)
+    plugins.removeRepository(reposName)
     self.getAllAvailablePlugins()
+    plugins.rebuild()
     self.populateMostWidgets()
     self.populatePluginTree()
     QApplication.restoreOverrideCursor()
@@ -813,7 +801,9 @@
       return # nothing else to do if only repository name was changed
     # refresh lists and populate widgets
     QApplication.setOverrideCursor(Qt.WaitCursor)
+    plugins.removeRepository(reposName)
     self.getAllAvailablePlugins()
+    plugins.rebuild()
     self.populateMostWidgets()
     self.populatePluginTree()
     QApplication.restoreOverrideCursor()
@@ -829,16 +819,15 @@
     if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), warning , QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
       return
     reposName = current.text(1)
+    # delete from the settings, refresh data and repopulate all the widgets
     settings = QSettings()
     settings.beginGroup(self.reposGroup)
-    # delete from settings
     settings.remove(reposName)
-    # refresh lists and populate widgets
-    QApplication.setOverrideCursor(Qt.WaitCursor)
-    self.getAllAvailablePlugins()
+    repositories.remove(reposName)
+    plugins.removeRepository(reposName)
+    plugins.rebuild()
     self.populateMostWidgets()
     self.populatePluginTree()
-    QApplication.restoreOverrideCursor()
 
 
   # ----------------------------------------- #

Modified: trunk/qgis/python/plugins/plugin_installer/installer_plugin.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_plugin.py	2009-04-17 16:34:14 UTC (rev 10586)
+++ trunk/qgis/python/plugins/plugin_installer/installer_plugin.py	2009-04-17 23:41:14 UTC (rev 10587)
@@ -1,6 +1,6 @@
 """
 Copyright (C) 2007-2008 Matthew Perry
-Copyright (C) 2008 Borys Jurgiel
+Copyright (C) 2008-2009 Borys Jurgiel
 
 /***************************************************************************
  *                                                                         *
@@ -74,7 +74,7 @@
     self.statusLabel = None
 
     repositories.load()
-    plugins.clear()
+    plugins.getAllInstalled()
 
     if repositories.checkingOnStart() and repositories.timeForChecking() and repositories.allEnabled():
       self.statusLabel = QLabel(QCoreApplication.translate("QgsPluginInstaller","Looking for new plugins..."), self.mainWindow().statusBar())
@@ -87,7 +87,10 @@
       for key in repositories.allEnabled():
         repositories.setRepositoryData(key,"state",3)
 
+    for i in plugins.obsoletePlugins:
+      QMessageBox.warning(self.mainWindow(), QCoreApplication.translate("QgsPluginInstaller","QGIS Plugin Conflict:")+" "+plugins.localCache[i]["name"], QCoreApplication.translate("QgsPluginInstaller","The Plugin Installer has detected an obsolete plugin which masks a newer version shipped with this QGIS version. Probably it is a remainder of an older QGIS installation. Please use the Plugin Installer to remove it in order to unmask the instance shipped with this version of QGIS."))
 
+
   # ----------------------------------------- #
   def checkingDone(self):
     """ display the notify label if any updates or news available """
@@ -158,8 +161,6 @@
       for key in repositories.allUnavailable():
         QMessageBox.warning(parent, QCoreApplication.translate("QgsPluginInstaller","QGIS Python Plugin Installer"), QCoreApplication.translate("QgsPluginInstaller","Error reading repository:") + u' %s\n%s' % (key,repositories.all()[key]["error"]))
 
-    plugins.getAllInstalled()
-
     flags = Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMaximizeButtonHint 
     self.guiDlg = QgsPluginInstallerDialog(parent,flags)
     self.guiDlg.show()



More information about the QGIS-commit mailing list