Skip to content

Commit af6275c

Browse files
author
borysiasty
committed
Plugin Installer update - prepare to merge with Plugin Manager
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10512 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d2e4498 commit af6275c

File tree

5 files changed

+79
-10
lines changed

5 files changed

+79
-10
lines changed

python/plugins/plugin_installer/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def name():
1414
return "Plugin Installer"
1515

1616
def version():
17-
return "Version 0.9.12"
17+
return "Version 0.9.14"
1818

1919
def description():
2020
return "Downloads and installs QGIS python plugins"
@@ -30,4 +30,4 @@ def homepage():
3030

3131
def classFactory(iface):
3232
from installer_plugin import InstallerPlugin
33-
return InstallerPlugin(iface)
33+
return InstallerPlugin(iface)

python/plugins/plugin_installer/installer_data.py

+36-2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,41 @@ def setIface(qgisIface):
8787
("GIS-Lab Repository", "http://gis-lab.info/programs/qgis/qgis-repo.xml", "")]
8888

8989

90+
91+
# --- class History ----------------------------------------------------------------------- #
92+
class History(dict):
93+
""" Dictionary for keeping changes made duging the session - will be used to complete the (un/re)loading """
94+
95+
# ----------------------------------------- #
96+
def markChange(self, plugin, change):
97+
""" mark the status change: A-added, D-deleted, R-reinstalled """
98+
if change == "A" and self.get(plugin) == "D": # installation right after uninstallation
99+
self.__setitem__(plugin, "R")
100+
elif change == "A": # any other installation
101+
self.__setitem__(plugin, "A")
102+
elif change == "D" and self.get(plugin) == "A": # uninstallation right after installation
103+
self.pop(plugin)
104+
elif change == "D": # any other uninstallation
105+
self.__setitem__(plugin, "D")
106+
elif change == "R" and self.get(plugin) == "A": # reinstallation right after installation
107+
self.__setitem__(plugin, "A")
108+
elif change == "R": # any other reinstallation
109+
self.__setitem__(plugin, "R")
110+
111+
# ----------------------------------------- #
112+
def toList(self, change):
113+
""" return a list of plugins matching the given change """
114+
result = []
115+
for i in self.items():
116+
if i[1] == change:
117+
result += [i[0]]
118+
return result
119+
# --- /class History ---------------------------------------------------------------------- #
120+
121+
122+
123+
124+
90125
# --- class QPHttp ----------------------------------------------------------------------- #
91126
# --- It's a temporary workaround for broken proxy handling in Qt ------------------------- #
92127
class QPHttp(QHttp):
@@ -664,8 +699,7 @@ def workarounds(self):
664699

665700

666701

667-
668-
669702
# public members:
703+
history = History()
670704
repositories = Repositories()
671705
plugins = Plugins()

python/plugins/plugin_installer/installer_gui.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -592,11 +592,12 @@ def installPlugin(self):
592592
plugin = plugins.all()[key]
593593
if not plugin["error"]:
594594
if previousStatus in ["not installed", "new"]:
595-
infoString = (self.tr("Plugin installed successfully"),
596-
self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
595+
if QGIS_VER[0:3] == "1.1":
596+
infoString = (self.tr("QGIS Python Plugin Installer"), self.tr("Plugin installed successfully"))
597+
else:
598+
infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
597599
else:
598-
infoString = (self.tr("Plugin reinstalled successfully"),
599-
self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
600+
infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
600601
else:
601602
if plugin["error"] == "incompatible":
602603
message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")
@@ -634,6 +635,12 @@ def installPlugin(self):
634635
pass
635636
if not plugin["repository"]:
636637
plugins.remove(key)
638+
if plugins.all().has_key(key) and not plugins.all()[key]["status"] in ["not installed", "new"]:
639+
if previousStatus in ["not installed", "new"]:
640+
history.markChange(key,'A')
641+
else:
642+
history.markChange(key,'R')
643+
637644
self.populatePluginTree()
638645
if infoString[0]:
639646
QMessageBox.information(self, infoString[0], infoString[1])
@@ -678,6 +685,7 @@ def uninstallPlugin(self):
678685
plugins.setPluginData(key, "error_details", "")
679686
self.populatePluginTree()
680687
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."))
688+
history.markChange(key,'D')
681689

682690

683691
# ----------------------------------------- #

python/plugins/plugin_installer/installer_plugin.py

+27
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def setCurrentTheme(self, theThemeName):
4141
# ----------------------------------------- #
4242
def getThemeIcon(self, theName):
4343
""" get the icon from the best available theme """
44+
if not QGIS_MAJOR_VER: # QGIS 0.x
45+
return QIcon(":/plugins/installer/" + theName)
46+
4447
myCurThemePath = QgsApplication.activeThemePath() + "/plugins/" + theName;
4548
myDefThemePath = QgsApplication.defaultThemePath() + "/plugins/" + theName;
4649
myQrcPath = ":/plugins/installer/" + theName;
@@ -160,3 +163,27 @@ def run(self, parent = None):
160163
flags = Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMaximizeButtonHint
161164
self.guiDlg = QgsPluginInstallerDialog(parent,flags)
162165
self.guiDlg.show()
166+
167+
168+
# ----------------------------------------- #
169+
def newlyInstalledPlugins(self):
170+
""" return the list of newly installed plugins for further loading """
171+
return history.toList("A")
172+
173+
174+
# ----------------------------------------- #
175+
def newlyUninstalledPlugins(self):
176+
""" return the list of newly uninstalled plugins for further unloading """
177+
return history.toList("D")
178+
179+
180+
# ----------------------------------------- #
181+
def newlyReinstalledPlugins(self):
182+
""" return the list of newly reinstalled plugins for further reloading """
183+
return history.toList("R")
184+
185+
186+
# ----------------------------------------- #
187+
def resetNewlyProcessedPlugins(self):
188+
""" clear the dict of newly processed plugins """
189+
history.clear()

python/plugins/plugin_installer/resources_rc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# Resource object code
44
#
5-
# Created: sob. wrz 13 00:34:16 2008
6-
# by: The Resource Compiler for PyQt (Qt v4.3.2)
5+
# Created: wt. mar 24 00:35:11 2009
6+
# by: The Resource Compiler for PyQt (Qt v4.4.3)
77
#
88
# WARNING! All changes made in this file will be lost!
99

0 commit comments

Comments
 (0)