Skip to content

Commit

Permalink
Plugin Installer update. New features: Upgrade All button, plugin cou…
Browse files Browse the repository at this point in the history
…nt in the window title and Horst's repository

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14577 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
borysiasty committed Nov 12, 2010
1 parent ca556eb commit d400fa0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/plugins/plugin_installer/__init__.py
Expand Up @@ -15,7 +15,7 @@ def name():
return "Plugin Installer"

def version():
return "Version 1.1"
return "Version 1.2"

def description():
return "Downloads and installs QGIS python plugins"
Expand Down
1 change: 1 addition & 0 deletions python/plugins/plugin_installer/installer_data.py
Expand Up @@ -79,6 +79,7 @@ def setIface(qgisIface):
("CatAIS Repository", "http://www.catais.org/qgis/plugins.xml", ""),
("Faunalia Repository", "http://www.faunalia.it/qgis/plugins.xml", "http://faunalia.it/qgis/plugins.xml"),
("GIS-Lab Repository", "http://gis-lab.info/programs/qgis/qgis-repo.xml", ""),
("Kappasys Repositoty", "http://www.kappasys.org/qgis/plugins.xml", ""),
("Martin Dobias' Sandbox", "http://mapserver.sk/~wonder/qgis/plugins-sandbox.xml", ""),
("Marco Hugentobler's Repository","http://karlinapp.ethz.ch/python_plugins/python_plugins.xml", ""),
("Sourcepole Repository", "http://build.sourcepole.ch/qgis/plugins.xml", ""),
Expand Down
21 changes: 19 additions & 2 deletions python/plugins/plugin_installer/installer_gui.py
Expand Up @@ -260,6 +260,7 @@ def __init__(self, parent, fl):
self.connect(self.treePlugins, SIGNAL("itemSelectionChanged()"), self.pluginTreeClicked)
self.connect(self.treeRepositories, SIGNAL("itemSelectionChanged()"), self.repositoryTreeClicked)
# buttons
self.connect(self.buttonUpgradeAll, SIGNAL("clicked()"), self.upgradeAllClicked)
self.connect(self.buttonInstall, SIGNAL("clicked()"), self.installPluginClicked)
self.connect(self.buttonUninstall, SIGNAL("clicked()"), self.uninstallPluginClicked)
self.buttonInstall.setEnabled(False)
Expand Down Expand Up @@ -517,10 +518,17 @@ def addItem(p):
for p in plugins.all().values():
if p["error"] == i:
addItem(p)
n = 0 # displayed plugins count
self.upgradeablePlugins = [] # list of plugins able to update
for i in orderValid:
for p in plugins.all().values():
if p["status"] == i and not p["error"]:
addItem(p)
if p["status"] == "upgradeable": self.upgradeablePlugins += [p["localdir"]]
n +=1
self.setWindowTitle(self.tr("QGIS Python Plugin Installer") + self.tr(" - %d plugins available" % len(plugins.all())))
self.buttonUpgradeAll.setEnabled( len(self.upgradeablePlugins) )

# resize the columns
for i in [0,1,2,3,4,5]:
self.treePlugins.resizeColumnToContents(i)
Expand Down Expand Up @@ -563,6 +571,12 @@ def pluginTreeClicked(self):
self.buttonUninstall.setEnabled(False)


# ----------------------------------------- #
def upgradeAllClicked(self):
for key in self.upgradeablePlugins:
self.installPlugin(key, quiet=True)


# ----------------------------------------- #
def installPluginClicked(self):
if not self.treePlugins.currentItem():
Expand All @@ -579,8 +593,8 @@ def uninstallPluginClicked(self):
self.uninstallPlugin(key)


# ----------------------------------------- #
def installPlugin(self, key):
# ----------------------------------------- #
def installPlugin(self, key, quiet=False):
""" install currently selected plugin """
infoString = ('','')
plugin = plugins.all()[key]
Expand All @@ -590,6 +604,7 @@ def installPlugin(self, key):
if plugin["status"] == "newer" and not plugin["error"]: # ask for confirmation if user downgrades an usable plugin
if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), self.tr("Are you sure you want to downgrade the plugin to the latest available version? The installed one is newer!"), QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
return

dlg = QgsPluginInstallerInstallingDialog(self,plugin)
dlg.exec_()

Expand Down Expand Up @@ -634,6 +649,8 @@ def installPlugin(self, key):
else:
infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
else: infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
if quiet:
infoString = (None, None)
else:
if plugin["error"] == "incompatible":
message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")
Expand Down
7 changes: 7 additions & 0 deletions python/plugins/plugin_installer/qgsplugininstallerbase.ui
Expand Up @@ -237,6 +237,13 @@
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QPushButton" name="buttonUpgradeAll">
<property name="text">
<string>Upgrade all</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
Expand Down

0 comments on commit d400fa0

Please sign in to comment.