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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Apr 8 20:19:51 EDT 2009


Author: borysiasty
Date: 2009-04-08 20:19:51 -0400 (Wed, 08 Apr 2009)
New Revision: 10512

Modified:
   trunk/qgis/python/plugins/plugin_installer/__init__.py
   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
   trunk/qgis/python/plugins/plugin_installer/resources_rc.py
Log:
Plugin Installer update - prepare to merge with Plugin Manager

Modified: trunk/qgis/python/plugins/plugin_installer/__init__.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/__init__.py	2009-04-08 17:18:36 UTC (rev 10511)
+++ trunk/qgis/python/plugins/plugin_installer/__init__.py	2009-04-09 00:19:51 UTC (rev 10512)
@@ -14,7 +14,7 @@
   return "Plugin Installer"
 
 def version():
-  return "Version 0.9.12"
+  return "Version 0.9.14"
 
 def description():
   return "Downloads and installs QGIS python plugins"
@@ -30,4 +30,4 @@
 
 def classFactory(iface):
   from installer_plugin import InstallerPlugin
-  return InstallerPlugin(iface)
\ No newline at end of file
+  return InstallerPlugin(iface)

Modified: trunk/qgis/python/plugins/plugin_installer/installer_data.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_data.py	2009-04-08 17:18:36 UTC (rev 10511)
+++ trunk/qgis/python/plugins/plugin_installer/installer_data.py	2009-04-09 00:19:51 UTC (rev 10512)
@@ -87,6 +87,41 @@
                 ("GIS-Lab Repository", 		"http://gis-lab.info/programs/qgis/qgis-repo.xml", "")]
 
 
+
+# --- class History  ----------------------------------------------------------------------- #
+class History(dict):
+  """ Dictionary for keeping changes made duging the session - will be used to complete the (un/re)loading """
+
+  # ----------------------------------------- #
+  def markChange(self, plugin, change):
+    """ mark the status change: A-added, D-deleted, R-reinstalled """
+    if change == "A" and self.get(plugin) == "D":   # installation right after uninstallation
+      self.__setitem__(plugin, "R")
+    elif change == "A":                             # any other installation
+      self.__setitem__(plugin, "A")
+    elif change == "D" and self.get(plugin) == "A": # uninstallation right after installation
+      self.pop(plugin)
+    elif change == "D":                             # any other uninstallation
+      self.__setitem__(plugin, "D")
+    elif change == "R" and self.get(plugin) == "A": # reinstallation right after installation
+      self.__setitem__(plugin, "A")
+    elif change == "R":                             # any other reinstallation
+      self.__setitem__(plugin, "R")
+
+  # ----------------------------------------- #
+  def toList(self, change):
+    """ return a list of plugins matching the given change """
+    result = []
+    for i in self.items():
+      if i[1] == change:
+        result += [i[0]]
+    return result
+# --- /class History  ---------------------------------------------------------------------- #
+
+
+
+
+
 # --- class QPHttp  ----------------------------------------------------------------------- #
 # --- It's a temporary workaround for broken proxy handling in Qt ------------------------- #
 class QPHttp(QHttp):
@@ -664,8 +699,7 @@
 
 
 
-
-
 # public members:
+history = History()
 repositories = Repositories()
 plugins = Plugins()

Modified: trunk/qgis/python/plugins/plugin_installer/installer_gui.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_gui.py	2009-04-08 17:18:36 UTC (rev 10511)
+++ trunk/qgis/python/plugins/plugin_installer/installer_gui.py	2009-04-09 00:19:51 UTC (rev 10512)
@@ -592,11 +592,12 @@
       plugin = plugins.all()[key]
       if not plugin["error"]:
         if previousStatus in ["not installed", "new"]:
-          infoString = (self.tr("Plugin installed successfully"),
-          self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
+          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."))
         else:
-          infoString = (self.tr("Plugin reinstalled successfully"),
-          self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
+          infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
       else:
         if plugin["error"] == "incompatible":
           message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")
@@ -634,6 +635,12 @@
               pass
             if not plugin["repository"]:
               plugins.remove(key)
+    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')
+      else:
+        history.markChange(key,'R')
+
     self.populatePluginTree()
     if infoString[0]:
       QMessageBox.information(self, infoString[0], infoString[1])
@@ -678,6 +685,7 @@
         plugins.setPluginData(key, "error_details", "")
       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')
 
 
   # ----------------------------------------- #

Modified: trunk/qgis/python/plugins/plugin_installer/installer_plugin.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_plugin.py	2009-04-08 17:18:36 UTC (rev 10511)
+++ trunk/qgis/python/plugins/plugin_installer/installer_plugin.py	2009-04-09 00:19:51 UTC (rev 10512)
@@ -41,6 +41,9 @@
   # ----------------------------------------- #
   def getThemeIcon(self, theName):
     """ get the icon from the best available theme """
+    if not QGIS_MAJOR_VER: # QGIS 0.x
+      return QIcon(":/plugins/installer/" + theName)
+
     myCurThemePath = QgsApplication.activeThemePath() + "/plugins/" + theName;
     myDefThemePath = QgsApplication.defaultThemePath() + "/plugins/" + theName;
     myQrcPath = ":/plugins/installer/" + theName;
@@ -160,3 +163,27 @@
     flags = Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMaximizeButtonHint 
     self.guiDlg = QgsPluginInstallerDialog(parent,flags)
     self.guiDlg.show()
+
+
+  # ----------------------------------------- #
+  def newlyInstalledPlugins(self):
+    """ return the list of newly installed plugins for further loading """
+    return history.toList("A")
+
+
+  # ----------------------------------------- #
+  def newlyUninstalledPlugins(self):
+    """ return the list of newly uninstalled plugins for further unloading """
+    return history.toList("D")
+
+
+  # ----------------------------------------- #
+  def newlyReinstalledPlugins(self):
+    """ return the list of newly reinstalled plugins for further reloading """
+    return history.toList("R")
+
+
+  # ----------------------------------------- #
+  def resetNewlyProcessedPlugins(self):
+    """ clear the dict of newly processed plugins """
+    history.clear()
\ No newline at end of file

Modified: trunk/qgis/python/plugins/plugin_installer/resources_rc.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/resources_rc.py	2009-04-08 17:18:36 UTC (rev 10511)
+++ trunk/qgis/python/plugins/plugin_installer/resources_rc.py	2009-04-09 00:19:51 UTC (rev 10512)
@@ -2,8 +2,8 @@
 
 # Resource object code
 #
-# Created: sob. wrz 13 00:34:16 2008
-#      by: The Resource Compiler for PyQt (Qt v4.3.2)
+# Created: wt. mar 24 00:35:11 2009
+#      by: The Resource Compiler for PyQt (Qt v4.4.3)
 #
 # WARNING! All changes made in this file will be lost!
 



More information about the QGIS-commit mailing list