mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Plugin installer updates from Borys
git-svn-id: http://svn.osgeo.org/qgis/trunk@9558 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
31725ec599
commit
059cbee4df
@ -1,27 +1,27 @@
|
||||
#TODO: Need to configure cmake to run pyrcc4 and pyuic4 as required when the resource
|
||||
# file or the ui change
|
||||
SET(INSTALLER_FILES
|
||||
fetchingbase.py
|
||||
fetchingbase.py
|
||||
fetchingbase.ui
|
||||
guibase.py
|
||||
guibase.ui
|
||||
guibase.py
|
||||
guibase.ui
|
||||
__init__.py
|
||||
installer_data.py
|
||||
installer_gui.py
|
||||
installer_data.py
|
||||
installer_gui.py
|
||||
installer_plugin.py
|
||||
installingbase.py
|
||||
installingbase.ui
|
||||
pluginerrorbase.py
|
||||
pluginerrorbase.ui
|
||||
plugin_installer.png
|
||||
PluginInstaller.png
|
||||
qgis-icon.png
|
||||
repoConnected.png
|
||||
installingbase.py
|
||||
installingbase.ui
|
||||
pluginerrorbase.py
|
||||
pluginerrorbase.ui
|
||||
plugin_installer.png
|
||||
qgis-icon.png
|
||||
repoConnected.png
|
||||
repoDisabled.png
|
||||
repositorybase.py
|
||||
repositorybase.ui
|
||||
repositorybase.py
|
||||
repositorybase.ui
|
||||
repoUnavailable.png
|
||||
resources_rc.py
|
||||
unzip.py
|
||||
resources.qrc
|
||||
resources_rc.py
|
||||
unzip.py
|
||||
)
|
||||
INSTALL(FILES ${INSTALLER_FILES} DESTINATION ${QGIS_DATA_DIR}/python/plugins/plugin_installer)
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2008 Matthew Perry
|
||||
Copyright (C) 2007-2008 Matthew Perry
|
||||
Copyright (C) 2008 Borys Jurgiel
|
||||
/***************************************************************************
|
||||
* *
|
||||
@ -20,7 +20,7 @@ def author_name():
|
||||
return "perrygeo, borysiasty"
|
||||
|
||||
def version():
|
||||
return "Version 0.06.2"
|
||||
return "Version 0.07.2"
|
||||
|
||||
def classFactory(iface):
|
||||
from installer_plugin import InstallerPlugin
|
||||
|
@ -175,7 +175,7 @@ class Ui_QgsPluginInstallerDialog(object):
|
||||
|
||||
def retranslateUi(self, QgsPluginInstallerDialog):
|
||||
QgsPluginInstallerDialog.setWindowTitle(QtGui.QApplication.translate("QgsPluginInstallerDialog", "QGIS Python Plugin Installer", None, QtGui.QApplication.UnicodeUTF8))
|
||||
QgsPluginInstallerDialog.setWhatsThis(QtGui.QApplication.translate("QgsPluginInstallerDialog", "QGIS Plugin Installer", None, QtGui.QApplication.UnicodeUTF8))
|
||||
QgsPluginInstallerDialog.setWhatsThis(QtGui.QApplication.translate("QgsPluginInstallerDialog", "QGIS Python Plugin Installer", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_5.setText(QtGui.QApplication.translate("QgsPluginInstallerDialog", "Filter:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.lineFilter.setToolTip(QtGui.QApplication.translate("QgsPluginInstallerDialog", "Display only plugins containing this word in their metadata", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.lineFilter.setWhatsThis(QtGui.QApplication.translate("QgsPluginInstallerDialog", "Display only plugins containing this word in their metadata", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
@ -17,7 +17,7 @@
|
||||
<iconset resource="resources.qrc" >:/plugins/installer/qgis-icon.png</iconset>
|
||||
</property>
|
||||
<property name="whatsThis" >
|
||||
<string>QGIS Plugin Installer</string>
|
||||
<string>QGIS Python Plugin Installer</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
|
@ -1,6 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
qgis_plugins.py
|
||||
""" "
|
||||
Copyright (C) 2007-2008 Matthew Perry
|
||||
Copyright (C) 2008 Borys Jurgiel
|
||||
|
||||
@ -12,23 +11,29 @@ Copyright (C) 2008 Borys Jurgiel
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
"""
|
||||
|
||||
This file contains some additional quote marks (for example in the lines 2 and 20), they are
|
||||
for compatibility with lupdate, which doesn't properly recognize the comments in Python.
|
||||
The use of lupdate instead of pylupdate is forced by integration with rest of QGIS files,
|
||||
which are written mainly in C++. After editing this file make sure that lupdate and pylupdate
|
||||
find the same number of strings and balance the quotemarks if doesn't.
|
||||
" """
|
||||
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtXml import QDomDocument
|
||||
from PyQt4.QtNetwork import QHttp, QNetworkProxy
|
||||
from PyQt4.QtNetwork import *
|
||||
from qgis.core import *
|
||||
from unzip import unzip
|
||||
|
||||
|
||||
|
||||
"""
|
||||
""" "
|
||||
Data structure:
|
||||
mRepositories = dict of dicts: {repoName : {"url" string,
|
||||
"enabled" bool,
|
||||
"valid" bool,
|
||||
"QHttp" QHttp,
|
||||
"Relay" Relay, # Relay object for transmitting signals from QHttp with adding the repoName information
|
||||
"QPHttp" QPHttp,
|
||||
"Relay" Relay, # Relay object for transmitting signals from QPHttp with adding the repoName information
|
||||
"xmlData" QDomDocument,
|
||||
"state" int, (0 - disabled, 1-loading, 2-loaded ok, 3-error (to be retried), 4-rejected)
|
||||
"error" QString}}
|
||||
@ -45,25 +50,57 @@ mPlugins = dict of dicts {id : {"name" string,
|
||||
"repository" string,
|
||||
"localdir" string,
|
||||
"read-only" boolean}}
|
||||
"""
|
||||
" """
|
||||
|
||||
|
||||
QGIS_VER = 1
|
||||
try:
|
||||
if str(QGis.qgisVersion)[0] == "0":
|
||||
QGIS_VER = 0
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
reposGroup = "/Qgis/plugin-repos"
|
||||
settingsGroup = "/Qgis/plugin-installer"
|
||||
seenPluginGroup = "/Qgis/plugin-seen"
|
||||
|
||||
|
||||
# knownRepos: (name, url for QGIS 0.x, url for QGIS 1.x, possible depreciated url, another possible depreciated url)
|
||||
knownRepos = [("Official QGIS Repository","http://spatialserver.net/cgi-bin/pyqgis_plugin.rb","http://spatialserver.net/cgi-bin/pyqgis_plugin.rb","",""),
|
||||
("Carson Farmer's Repository","http://www.ftools.ca/cfarmerQgisRepo_0.xx.xml","","http://www.geog.uvic.ca/spar/carson/cfarmerQgisRepo.xml",""),
|
||||
("Barry Rowlingson's Repository","http://www.maths.lancs.ac.uk/~rowlings/Qgis/Plugins/plugins.xml","","",""),
|
||||
("Carson Farmer's Repository","http://www.ftools.ca/cfarmerQgisRepo_0.xx.xml","http://www.ftools.ca/cfarmerQgisRepo.xml", "http://www.geog.uvic.ca/spar/carson/cfarmerQgisRepo.xml",""),
|
||||
("Borys Jurgiel's Repository","http://bwj.aster.net.pl/qgis-oldapi/plugins.xml","http://bwj.aster.net.pl/qgis/plugins.xml","",""),
|
||||
("Faunalia Repository","http://faunalia.it/qgis/plugins.xml","http://faunalia.it/qgis/1.x/plugins.xml","","")]
|
||||
|
||||
|
||||
|
||||
|
||||
# --- class QPHttp ----------------------------------------------------------------------- #
|
||||
# --- It's a temporary workaround for broken proxy handling in Qt ------------------------- #
|
||||
class QPHttp(QHttp):
|
||||
def __init__(self,*args):
|
||||
QHttp.__init__(self,*args)
|
||||
settings = QSettings()
|
||||
settings.beginGroup("proxy")
|
||||
if settings.value("/proxyEnabled").toBool():
|
||||
self.proxy=QNetworkProxy()
|
||||
self.proxy.setType(QNetworkProxy.HttpProxy)
|
||||
self.proxy.setHostName(settings.value("/proxyHost").toString())
|
||||
self.proxy.setPort(settings.value("/proxyPort").toUInt()[0])
|
||||
self.proxy.setUser(settings.value("/proxyUser").toString())
|
||||
self.proxy.setPassword(settings.value("/proxyPassword").toString())
|
||||
self.setProxy(self.proxy)
|
||||
settings.endGroup()
|
||||
return None
|
||||
# --- /class QPHttp ---------------------------------------------------------------------- #
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# --- class Relay ----------------------------------------------------------------------- #
|
||||
class Relay(QObject):
|
||||
""" Relay object for transmitting signals from QHttp with adding the repoName information """
|
||||
""" Relay object for transmitting signals from QPHttp with adding the repoName information """
|
||||
# ----------------------------------------- #
|
||||
def __init__(self, key):
|
||||
QObject.__init__(self)
|
||||
@ -88,38 +125,41 @@ class Relay(QObject):
|
||||
|
||||
# --- class Repositories ----------------------------------------------------------------- #
|
||||
class Repositories(QObject):
|
||||
""" A dict-like class for handling repositories data """
|
||||
# ----------------------------------------- #
|
||||
def __init__(self):
|
||||
QObject.__init__(self)
|
||||
self.mRepositories = {}
|
||||
self.httpId = {} # {httpId : repoName}
|
||||
self.QGISver = int(str(QGis.QGIS_VERSION)[0])
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def addKnownRepos(self):
|
||||
""" add known 3rd party repositories to QSettings """
|
||||
presentURLs = []
|
||||
for i in self.all().values():
|
||||
presentURLs += [str(i["url"])]
|
||||
for i in knownRepos:
|
||||
if i[self.QGISver+1] and presentURLs.count(i[self.QGISver+1]) == 0:
|
||||
if i[QGIS_VER+1] and presentURLs.count(i[QGIS_VER+1]) == 0:
|
||||
settings = QSettings()
|
||||
settings.beginGroup(reposGroup)
|
||||
repoName = QString(i[0])
|
||||
if self.all().has_key(repoName):
|
||||
repoName = repoName + "(2)"
|
||||
# add to settings
|
||||
settings.setValue(repoName+"/url", QVariant(i[self.QGISver+1]))
|
||||
settings.setValue(repoName+"/url", QVariant(i[QGIS_VER+1]))
|
||||
settings.setValue(repoName+"/enabled", QVariant(True))
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def all(self):
|
||||
""" return dict of all repositories """
|
||||
return self.mRepositories
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def allEnabled(self):
|
||||
""" return dict of all enabled and valid repositories """
|
||||
repos = {}
|
||||
for i in self.mRepositories:
|
||||
if self.mRepositories[i]["enabled"] and self.mRepositories[i]["valid"]:
|
||||
@ -129,6 +169,7 @@ class Repositories(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def allUnavailable(self):
|
||||
""" return dict of all unavailable repositories """
|
||||
repos = {}
|
||||
for i in self.mRepositories:
|
||||
if self.mRepositories[i]["enabled"] and self.mRepositories[i]["valid"] and self.mRepositories[i]["state"] == 3:
|
||||
@ -138,11 +179,13 @@ class Repositories(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def setRepositoryData(self,reposName, key, value):
|
||||
""" write data to the mRepositories dict """
|
||||
self.mRepositories[reposName][key] = value
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def rename(self,oldName, newName):
|
||||
def rename(self, oldName, newName):
|
||||
""" rename repository key """
|
||||
if oldName == newName:
|
||||
return
|
||||
self.mRepositories[newName] = self.mRepositories[oldName]
|
||||
@ -151,12 +194,14 @@ class Repositories(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def checkingOnStart(self):
|
||||
""" return true if checking for news and updates is enabled """
|
||||
settings = QSettings()
|
||||
return settings.value(settingsGroup+"/checkOnStart", QVariant(True)).toBool()
|
||||
return settings.value(settingsGroup+"/checkOnStart", QVariant(False)).toBool()
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def setCheckingOnStart(self, state):
|
||||
""" set state of checking for news and updates """
|
||||
settings = QSettings()
|
||||
settings.setValue(settingsGroup+"/checkOnStart", QVariant(state))
|
||||
|
||||
@ -169,15 +214,15 @@ class Repositories(QObject):
|
||||
settings.beginGroup(reposGroup)
|
||||
# first, update the QSettings repositories if needed
|
||||
if len(settings.childGroups()) == 0: # add the default repository when there isn't any
|
||||
settings.setValue(knownRepos[0][0]+"/url", QVariant(knownRepos[0][self.QGISver+1]))
|
||||
settings.setValue(knownRepos[0][0]+"/url", QVariant(knownRepos[0][QGIS_VER+1]))
|
||||
else: # else update invalid urls
|
||||
for key in settings.childGroups():
|
||||
url = settings.value(key+"/url", QVariant()).toString()
|
||||
allOk = True
|
||||
for repo in knownRepos:
|
||||
if repo[3] == url or repo[4] == url or (repo[self.QGISver+1] != url and repo[int(not self.QGISver)+1] == url):
|
||||
if repo[self.QGISver+1]: #update the URL
|
||||
settings.setValue(key+"/url", QVariant(repo[self.QGISver+1]))
|
||||
if repo[3] == url or repo[4] == url or (repo[QGIS_VER+1] != url and repo[int(not QGIS_VER)+1] == url):
|
||||
if repo[QGIS_VER+1]: #update the URL
|
||||
settings.setValue(key+"/url", QVariant(repo[QGIS_VER+1]))
|
||||
settings.setValue(key+"/valid", QVariant(True))
|
||||
allOk = False
|
||||
else: # mark as invalid
|
||||
@ -191,7 +236,7 @@ class Repositories(QObject):
|
||||
self.mRepositories[key]["url"] = settings.value(key+"/url", QVariant()).toString()
|
||||
self.mRepositories[key]["enabled"] = settings.value(key+"/enabled", QVariant(True)).toBool()
|
||||
self.mRepositories[key]["valid"] = settings.value(key+"/valid", QVariant(True)).toBool()
|
||||
self.mRepositories[key]["QHttp"] = QHttp()
|
||||
self.mRepositories[key]["QPHttp"] = QPHttp()
|
||||
self.mRepositories[key]["Relay"] = Relay(key)
|
||||
self.mRepositories[key]["xmlData"] = QBuffer()
|
||||
self.mRepositories[key]["state"] = 0
|
||||
@ -201,20 +246,22 @@ class Repositories(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def requestFetching(self,key):
|
||||
""" start fetching the repository given by key """
|
||||
self.mRepositories[key]["state"] = 1
|
||||
url = QUrl(self.mRepositories[key]["url"])
|
||||
path = QString(url.toPercentEncoding(url.path(), "!$&'()*+,;=:@/"))
|
||||
self.mRepositories[key]["QHttp"] = QHttp(url.host())
|
||||
self.connect(self.mRepositories[key]["QHttp"], SIGNAL("requestFinished (int, bool)"), self.xmlDownloaded)
|
||||
self.connect(self.mRepositories[key]["QHttp"], SIGNAL("stateChanged ( int )"), self.mRepositories[key]["Relay"].stateChanged)
|
||||
self.connect(self.mRepositories[key]["QHttp"], SIGNAL("dataReadProgress ( int , int )"), self.mRepositories[key]["Relay"].dataReadProgress)
|
||||
self.mRepositories[key]["QPHttp"] = QPHttp(url.host())
|
||||
self.connect(self.mRepositories[key]["QPHttp"], SIGNAL("requestFinished (int, bool)"), self.xmlDownloaded)
|
||||
self.connect(self.mRepositories[key]["QPHttp"], SIGNAL("stateChanged ( int )"), self.mRepositories[key]["Relay"].stateChanged)
|
||||
self.connect(self.mRepositories[key]["QPHttp"], SIGNAL("dataReadProgress ( int , int )"), self.mRepositories[key]["Relay"].dataReadProgress)
|
||||
self.connect(self.mRepositories[key]["Relay"], SIGNAL("anythingChanged(QString, int, int)"), self, SIGNAL("anythingChanged (QString, int, int)"))
|
||||
i = self.mRepositories[key]["QHttp"].get(path, self.mRepositories[key]["xmlData"])
|
||||
i = self.mRepositories[key]["QPHttp"].get(path, self.mRepositories[key]["xmlData"])
|
||||
self.httpId[i] = key
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def fetchingInProgress(self):
|
||||
""" return true if fetching repositories is still in progress """
|
||||
for key in self.mRepositories:
|
||||
if self.mRepositories[key]["state"] == 1:
|
||||
return True
|
||||
@ -223,18 +270,20 @@ class Repositories(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def killConnection(self, key):
|
||||
if self.mRepositories[key]["QHttp"].state():
|
||||
self.mRepositories[key]["QHttp"].abort()
|
||||
""" kill the fetching on demand """
|
||||
if self.mRepositories[key]["QPHttp"].state():
|
||||
self.mRepositories[key]["QPHttp"].abort()
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def xmlDownloaded(self,nr,state):
|
||||
""" populate the plugins object with the fetched data """
|
||||
if not self.httpId.has_key(nr):
|
||||
return
|
||||
reposName = self.httpId[nr]
|
||||
if state: # fetching failed
|
||||
self.mRepositories[reposName]["state"] = 3
|
||||
self.mRepositories[reposName]["error"] = self.mRepositories[reposName]["QHttp"].errorString()
|
||||
self.mRepositories[reposName]["error"] = self.mRepositories[reposName]["QPHttp"].errorString()
|
||||
#print "Repository fetching failed! " , reposName , str(self.mRepositories[reposName]["error"])
|
||||
else:
|
||||
repoData = self.mRepositories[reposName]["xmlData"]
|
||||
@ -283,6 +332,7 @@ class Repositories(QObject):
|
||||
|
||||
# --- class Plugins ---------------------------------------------------------------------- #
|
||||
class Plugins(QObject):
|
||||
""" A dict-like class for handling plugins data """
|
||||
# ----------------------------------------- #
|
||||
def __init__(self):
|
||||
QObject.__init__(self)
|
||||
@ -291,11 +341,13 @@ class Plugins(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def all(self):
|
||||
""" return all plugins """
|
||||
return self.mPlugins
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def keyByUrl(self, name):
|
||||
""" return plugin key by given url """
|
||||
plugins = [i for i in self.mPlugins if self.mPlugins[i]["url"] == name]
|
||||
if plugins:
|
||||
return plugins[0]
|
||||
@ -304,6 +356,7 @@ class Plugins(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def setPluginData(self, pluginName, key, value):
|
||||
""" write data to the mPlugins dict """
|
||||
self.mPlugins[pluginName][key] = value
|
||||
|
||||
|
||||
@ -315,6 +368,7 @@ class Plugins(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def normalizeVersion(self,ver):
|
||||
""" remove the prefix from given version string """
|
||||
if not ver:
|
||||
return QString()
|
||||
if ver.toUpper().left(7) == "VERSION":
|
||||
@ -328,6 +382,7 @@ class Plugins(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def compareVersions(self,a,b):
|
||||
""" compare two plugin versions """
|
||||
# -------- #
|
||||
def classify(s):
|
||||
if s in [".","-","_"," "]:
|
||||
@ -353,20 +408,23 @@ class Plugins(QObject):
|
||||
# check if the matter is easy solvable:
|
||||
if s1 == s2:
|
||||
return 0
|
||||
# try to compare as numeric values:
|
||||
try:
|
||||
if s1[0] == '0' or s2[0] == '0':
|
||||
s1 = '0.' + s1
|
||||
s2 = '0.' + s2
|
||||
if float(s1) == float(s2):
|
||||
return 0
|
||||
elif float(s1) > float(s2):
|
||||
return 1
|
||||
else:
|
||||
return 2
|
||||
except:
|
||||
pass
|
||||
# set ALPHA < BETA < RC < FINAL < ANYTHING_ELSE
|
||||
if not s1:
|
||||
return 2
|
||||
if not s2:
|
||||
return 1
|
||||
# try to compare as numeric values (but only if the first character is not 0):
|
||||
if s1[0] != '0' and s2[0] != '0':
|
||||
try:
|
||||
if float(s1) == float(s2):
|
||||
return 0
|
||||
elif float(s1) > float(s2):
|
||||
return 1
|
||||
else:
|
||||
return 2
|
||||
except:
|
||||
pass
|
||||
# if the strings aren't numeric or start from 0, compare them as a strings:
|
||||
# but first, set ALPHA < BETA < RC < FINAL < ANYTHING_ELSE
|
||||
if s1 == 'FINAL':
|
||||
s1 = 'Z' + s1
|
||||
elif not s1 in ['ALPHA','BETA','RC']:
|
||||
@ -411,6 +469,7 @@ class Plugins(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def addPlugin(self, plugins):
|
||||
""" add a plugin (first from given) to the mPlugins dict """
|
||||
key = plugins.keys()[0]
|
||||
plugin = plugins[key]
|
||||
plugin["version_avail"] = self.normalizeVersion(QString(plugin["version_avail"]))
|
||||
@ -421,11 +480,13 @@ class Plugins(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def remove(self, key):
|
||||
""" remove given plugin from the mPlugins dict """
|
||||
del self.mPlugins[key]
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
def updatePlugin(self, key, readOnly):
|
||||
""" The mPlugins should contain available plugins first. Now, add installed one (add when not present, update if present) """
|
||||
try:
|
||||
exec("import "+ key)
|
||||
try:
|
||||
@ -460,7 +521,7 @@ class Plugins(QObject):
|
||||
path = QgsApplication.pkgDataPath()
|
||||
else:
|
||||
path = QgsApplication.qgisSettingsDirPath()
|
||||
path = QDir.cleanPath(unicode(path,"utf-8") + "python/plugins/" + key)
|
||||
path = QDir.cleanPath(unicode(path) + "python/plugins/" + key)
|
||||
normVer = self.normalizeVersion(QString(ver))
|
||||
plugin = {
|
||||
"name" : nam,
|
||||
@ -514,9 +575,10 @@ class Plugins(QObject):
|
||||
# ----------------------------------------- #
|
||||
def getAllInstalled(self):
|
||||
""" update the mPlugins dict with alredy installed plugins """
|
||||
# ' PLEASE DO NOT REMOVE THIS QUOTE MARK - it is a balance for compatibility with lupdate
|
||||
# first, try to add the read-only plugins...
|
||||
try:
|
||||
pluginDir = QDir.cleanPath(unicode(QgsApplication.pkgDataPath(),'utf-8') + "/python/plugins")
|
||||
pluginDir = QDir.cleanPath(unicode(QgsApplication.pkgDataPath()) + "/python/plugins")
|
||||
pluginDir = QDir(pluginDir)
|
||||
pluginDir.setFilter(QDir.AllDirs)
|
||||
except:
|
||||
@ -527,7 +589,7 @@ class Plugins(QObject):
|
||||
self.updatePlugin(key, True)
|
||||
# ...then try to add locally installed ones
|
||||
try:
|
||||
pluginDir = QDir.cleanPath(unicode(QgsApplication.qgisSettingsDirPath(),'utf-8') + "/python/plugins")
|
||||
pluginDir = QDir.cleanPath(unicode(QgsApplication.qgisSettingsDirPath()) + "/python/plugins")
|
||||
pluginDir = QDir(pluginDir)
|
||||
pluginDir.setFilter(QDir.AllDirs)
|
||||
except:
|
||||
@ -562,6 +624,7 @@ class Plugins(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def isThereAnythingNew(self):
|
||||
""" return true if an upgradeable or new plugin detected """
|
||||
for i in self.mPlugins.values():
|
||||
if i["status"] in ["upgradeable","new"]:
|
||||
return True
|
||||
@ -570,6 +633,7 @@ class Plugins(QObject):
|
||||
|
||||
# ----------------------------------------- #
|
||||
def workarounds(self):
|
||||
""" workarounds for particular plugins with wrong metadata """
|
||||
if self.mPlugins.has_key("postgps") and self.mPlugins["postgps"]["version_avail"] == "0.2":
|
||||
self.mPlugins["postgps"]["version_avail"] = "0.01"
|
||||
if self.mPlugins.has_key("select") and self.mPlugins["select"]["version_avail"] == "0.1":
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Copyright (C) 2008 Matthew Perry
|
||||
""" "
|
||||
Copyright (C) 2007-2008 Matthew Perry
|
||||
Copyright (C) 2008 Borys Jurgiel
|
||||
|
||||
/***************************************************************************
|
||||
@ -11,7 +11,15 @@ Copyright (C) 2008 Borys Jurgiel
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
"""
|
||||
|
||||
This file contains some additional quote marks (for example in the lines 2 and 20), they are
|
||||
for compatibility with lupdate, which doesn't properly recognize the comments in Python.
|
||||
The use of lupdate instead of pylupdate is forced by integration with rest of QGIS files,
|
||||
which are written mainly in C++. After editing this file make sure that lupdate and pylupdate
|
||||
find the same number of strings and balance the quotemarks if doesn't.
|
||||
" """
|
||||
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from qgis.core import QgsApplication, QgsContextHelp
|
||||
@ -30,7 +38,7 @@ def removeDir(path):
|
||||
result = QString()
|
||||
if not QFile(path).exists():
|
||||
result = QCoreApplication.translate("QgsPluginInstaller","Plugin directory doesn't exist: ") + path
|
||||
elif QFile(path).remove(): # if it's only link, just remove it without resolving.
|
||||
elif QFile(path).remove(): # if it is only link, just remove it without resolving.
|
||||
#print " Link removing successfull: %s" % path
|
||||
pass
|
||||
else:
|
||||
@ -62,6 +70,9 @@ def removeDir(path):
|
||||
|
||||
|
||||
# --- class QgsPluginInstallerFetchingDialog --------------------------------------------------------------- #
|
||||
""" " C++ style header for compability with lupdate
|
||||
QgsPluginInstallerFetchingDialog::foo(){
|
||||
" """
|
||||
class QgsPluginInstallerFetchingDialog(QDialog, Ui_QgsPluginInstallerFetchingDialog):
|
||||
# ----------------------------------------- #
|
||||
def __init__(self, parent):
|
||||
@ -86,7 +97,7 @@ class QgsPluginInstallerFetchingDialog(QDialog, Ui_QgsPluginInstallerFetchingDia
|
||||
|
||||
# ----------------------------------------- #
|
||||
def displayState(self,key,state,state2=None):
|
||||
messages=[self.tr("Done"),self.tr("Resolving host name..."),self.tr("Connecting..."),self.tr("Host connected. Sending request..."),self.tr("Downloading data..."),self.tr("Idle"),self.tr("Closing connection..."),self.tr("Error")]
|
||||
messages=[self.tr("Success"),self.tr("Resolving host name..."),self.tr("Connecting..."),self.tr("Host connected. Sending request..."),self.tr("Downloading data..."),self.tr("Idle"),self.tr("Closing connection..."),self.tr("Error")]
|
||||
message = messages[state]
|
||||
if state2:
|
||||
message += " (%s%%)" % state2
|
||||
@ -107,6 +118,7 @@ class QgsPluginInstallerFetchingDialog(QDialog, Ui_QgsPluginInstallerFetchingDia
|
||||
self.displayState(repoName,7)
|
||||
if not repositories.fetchingInProgress():
|
||||
self.close()
|
||||
# } - C++ style footer for compability with lupdate
|
||||
# --- /class QgsPluginInstallerFetchingDialog -------------------------------------------------------------- #
|
||||
|
||||
|
||||
@ -114,6 +126,9 @@ class QgsPluginInstallerFetchingDialog(QDialog, Ui_QgsPluginInstallerFetchingDia
|
||||
|
||||
|
||||
# --- class QgsPluginInstallerRepositoryDialog ------------------------------------------------------------- #
|
||||
""" " C++ style header for compability with lupdate
|
||||
QgsPluginInstallerRepositoryDialog::foo(){
|
||||
" """
|
||||
class QgsPluginInstallerRepositoryDialog(QDialog, Ui_QgsPluginInstallerRepositoryDetailsDialog):
|
||||
# ----------------------------------------- #
|
||||
def __init__(self, parent=None):
|
||||
@ -128,6 +143,7 @@ class QgsPluginInstallerRepositoryDialog(QDialog, Ui_QgsPluginInstallerRepositor
|
||||
def textChanged(self, string):
|
||||
enable = (self.editName.text().count() > 0 and self.editURL.text().count() > 0)
|
||||
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)
|
||||
# } - C++ style footer for compability with lupdate
|
||||
# --- /class QgsPluginInstallerRepositoryDialog ------------------------------------------------------------ #
|
||||
|
||||
|
||||
@ -135,6 +151,9 @@ class QgsPluginInstallerRepositoryDialog(QDialog, Ui_QgsPluginInstallerRepositor
|
||||
|
||||
|
||||
# --- class QgsPluginInstallerInstallingDialog --------------------------------------------------------------- #
|
||||
""" " C++ style header for compability with lupdate
|
||||
QgsPluginInstallerInstallingDialog::foo(){
|
||||
" """
|
||||
class QgsPluginInstallerInstallingDialog(QDialog, Ui_QgsPluginInstallerInstallingDialog):
|
||||
# ----------------------------------------- #
|
||||
def __init__(self, parent, plugin):
|
||||
@ -148,13 +167,13 @@ class QgsPluginInstallerInstallingDialog(QDialog, Ui_QgsPluginInstallerInstallin
|
||||
self.connect(self.buttonBox, SIGNAL("clicked(QAbstractButton*)"), self.abort)
|
||||
|
||||
url = QUrl(plugin["url"])
|
||||
path = QString(url.toPercentEncoding(url.path(), "!$&'()*+,;=:@/"))
|
||||
path = QString(url.toPercentEncoding(url.path(), "!$&'()*+,;=:/@"))
|
||||
fileName = plugin["filename"]
|
||||
#print "Retrieving from %s" % path
|
||||
tmpDir = QDir.tempPath()
|
||||
tmpPath = QDir.cleanPath(tmpDir+"/"+fileName)
|
||||
self.file = QFile(tmpPath)
|
||||
self.http = QHttp(url.host())
|
||||
self.http = QPHttp(url.host())
|
||||
self.connect(self.http, SIGNAL("stateChanged ( int )"), self.stateChanged)
|
||||
self.connect(self.http, SIGNAL("dataReadProgress ( int , int )"), self.readProgress)
|
||||
self.connect(self.http, SIGNAL("requestFinished (int, bool)"), self.requestFinished)
|
||||
@ -195,6 +214,10 @@ class QgsPluginInstallerInstallingDialog(QDialog, Ui_QgsPluginInstallerInstallin
|
||||
# make sure that the parent directory exists
|
||||
if not QDir(pluginDir).exists():
|
||||
QDir().mkpath(pluginDir)
|
||||
|
||||
# if the target directory already exists as a link, remove the link without resolving:
|
||||
QFile(pluginDir+QString(QDir.separator())+self.plugin["localdir"]).remove()
|
||||
|
||||
#print "Extracting to plugin directory (%s)" % pluginDir
|
||||
try:
|
||||
un = unzip()
|
||||
@ -221,6 +244,7 @@ class QgsPluginInstallerInstallingDialog(QDialog, Ui_QgsPluginInstallerInstallin
|
||||
self.http.abort()
|
||||
self.mResult = self.tr("Aborted by user")
|
||||
self.reject()
|
||||
# } - C++ style footer for compability with lupdate
|
||||
# --- /class QgsPluginInstallerPluginErrorDialog ------------------------------------------------------------- #
|
||||
|
||||
|
||||
@ -228,21 +252,29 @@ class QgsPluginInstallerInstallingDialog(QDialog, Ui_QgsPluginInstallerInstallin
|
||||
|
||||
|
||||
# --- class QgsPluginInstallerPluginErrorDialog -------------------------------------------------------------- #
|
||||
""" " C++ style header for compability with lupdate
|
||||
QgsPluginInstallerPluginErrorDialog::foo(){
|
||||
" """
|
||||
class QgsPluginInstallerPluginErrorDialog(QDialog, Ui_QgsPluginInstallerPluginErrorDialog):
|
||||
# ----------------------------------------- #
|
||||
def __init__(self, parent, errorMessage):
|
||||
QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
if not errorMessage:
|
||||
errorMessage = self.tr("No error message received. Try to restart QGIS and ensure the plugin isn't installed under different name. If it is, contact the plugin author and submit this issue, please.")
|
||||
errorMessage = self.tr("No error message received. Try to restart QGIS and ensure the plugin isn't installed under a different name. If it is, contact the plugin author and submit this issue, please.")
|
||||
self.textBrowser.setText(errorMessage)
|
||||
# } - C++ style footer for compability with lupdate
|
||||
# --- /class QgsPluginInstallerPluginErrorDialog ------------------------------------------------------------- #
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# --- class QgsPluginInstallerDialog ------------------------------------------------------------------------- #
|
||||
""" " C++ style header for compability with lupdate
|
||||
QgsPluginInstallerDialog::foo(){
|
||||
" """
|
||||
class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
# ----------------------------------------- #
|
||||
def __init__(self, parent, fl):
|
||||
@ -296,6 +328,8 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
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):
|
||||
@ -331,8 +365,8 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
# filling the status filter comboBox
|
||||
self.comboFilter2.clear()
|
||||
self.comboFilter2.addItem(self.tr("any status"))
|
||||
self.comboFilter2.addItem(self.tr("not installed"))
|
||||
self.comboFilter2.addItem(self.tr("installed"))
|
||||
self.comboFilter2.addItem(self.tr("not installed", "plural"))
|
||||
self.comboFilter2.addItem(self.tr("installed", "plural"))
|
||||
if plugins.isThereAnythingNew():
|
||||
self.comboFilter2.addItem(self.tr("upgradeable and news"))
|
||||
|
||||
@ -376,22 +410,22 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
"installed" : self.tr("This plugin is installed"),
|
||||
"upgradeable" : self.tr("This plugin is installed, but there is an updated version available"),
|
||||
"orphan" : self.tr("This plugin is installed, but I can't find it in any enabled repository"),
|
||||
"new" : self.tr("This plugin is not installed and is seen first time"),
|
||||
"new" : self.tr("This plugin is not installed and is seen for the first time"),
|
||||
"newer" : self.tr("This plugin is installed and is newer than its version available in a repository"),
|
||||
"invalid" : self.tr("This plugin seems to be invalid or have unfulfilled dependencies\nIt has been installed, but can't be loaded")}
|
||||
status ={"not installed" : self.tr("not installed"),
|
||||
"installed" : self.tr("installed"),
|
||||
"upgradeable" : self.tr("upgradeable"),
|
||||
"orphan" : self.tr("installed"),
|
||||
"new" : self.tr("new!"),
|
||||
"newer" : self.tr("installed"),
|
||||
"invalid" : self.tr("invalid")}
|
||||
status ={"not installed" : self.tr("not installed", "singular"),
|
||||
"installed" : self.tr("installed", "singular"),
|
||||
"upgradeable" : self.tr("upgradeable", "singular"),
|
||||
"orphan" : self.tr("installed", "singular"),
|
||||
"new" : self.tr("new!", "singular"),
|
||||
"newer" : self.tr("installed", "singular"),
|
||||
"invalid" : self.tr("invalid", "singular")}
|
||||
order = ["invalid","upgradeable","new","not installed","installed","orphan","newer"]
|
||||
def addItem(p):
|
||||
if self.filterCheck(p):
|
||||
statusTip = descrip[p["status"]]
|
||||
if p["read-only"]:
|
||||
statusTip += "\n" + self.tr("Note that it's installed in the read-only location and you can't uninstall it")
|
||||
statusTip += "\n" + self.tr("Note that it's a core plugin and I can't uninstall it")
|
||||
if p["status"] == "upgradeable":
|
||||
ver = p["version_inst"] + " -> " + p["version_avail"]
|
||||
elif p["status"] == "newer":
|
||||
@ -405,15 +439,15 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
elif p["status"] in ["not installed", "new"]:
|
||||
vd = self.tr("available version") + ": " + p["version_avail"]
|
||||
elif p["status"] == "installed":
|
||||
vd = self.tr("installed version") + ": " + p["version_inst"] + "\n" + self.tr("That's the newest available version.")
|
||||
vd = self.tr("installed version") + ": " + p["version_inst"] + "\n" + self.tr("That's the newest available version")
|
||||
elif p["status"] == "orphan":
|
||||
vd = self.tr("installed version") + ": " + p["version_inst"] + "\n" + self.tr("There is no version available for download.")
|
||||
vd = self.tr("installed version") + ": " + p["version_inst"] + "\n" + self.tr("There is no version available for download")
|
||||
else:
|
||||
vd = ""
|
||||
if p["status"] == "invalid":
|
||||
p["desc_local"] = self.tr("This plugin seems to be invalid or have unfulfilled dependencies")
|
||||
p["desc_repo"] = self.tr("This plugin seems to be invalid or have unfulfilled dependencies\nIt has been installed, but can't be loaded")
|
||||
if p["status"] == "orphan":
|
||||
if not p["repository"]:
|
||||
repository = self.tr("only locally available")
|
||||
else:
|
||||
repository = p["repository"]
|
||||
@ -467,7 +501,7 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
""" the pluginsTree has been clicked """
|
||||
buttons={"not installed":(True,False,self.tr("Install plugin")),
|
||||
"installed":(True,True,self.tr("Reinstall plugin")),
|
||||
"upgradeable":(True,True,self.tr("Upgrade plugin",)),
|
||||
"upgradeable":(True,True,self.tr("Upgrade plugin")),
|
||||
"orphan":(False,True,self.tr("Install/upgrade plugin")),
|
||||
"new":(True, False,self.tr("Install plugin")),
|
||||
"newer":(True,True,self.tr("Downgrade plugin")),
|
||||
@ -528,11 +562,9 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
if result:
|
||||
QMessageBox.warning(self, self.tr("Plugin uninstall failed"), result)
|
||||
plugins.updatePlugin(key, False)
|
||||
self.populateMostWidgets()
|
||||
self.populatePluginTree()
|
||||
return
|
||||
plugins.updatePlugin(key, False)
|
||||
self.populateMostWidgets()
|
||||
self.populatePluginTree()
|
||||
QMessageBox.information(self, infoString[0], infoString[1])
|
||||
|
||||
@ -546,7 +578,6 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
plugin = plugins.all()[key]
|
||||
if not plugin:
|
||||
return
|
||||
|
||||
warning = self.tr("Are you sure you want to uninstall the plugin ") + plugin["name"] + "?"
|
||||
if plugin["status"] == "orphan":
|
||||
warning += "\n\n"+self.tr("Warning: this plugin isn't available in any accessible repository!")
|
||||
@ -563,7 +594,7 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
exec ("del sys.modules[%s]" % plugin["localdir"])
|
||||
except:
|
||||
pass
|
||||
if plugin["status"] == "orphan":
|
||||
if not plugin["repository"]:
|
||||
plugins.remove(key)
|
||||
else:
|
||||
plugins.setPluginData(key, "status", "not installed")
|
||||
@ -586,9 +617,8 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
def addKnownRepositories(self):
|
||||
""" update list of known repositories - in the future it will be replaced with an online fetching """
|
||||
#print "add known repositories"
|
||||
message = "You are going to add some plugin repositories neither authorized nor supported by the QGIS team, however provided by folks associated with us.\n"
|
||||
message += "Plugin authors generally make efforts to make their works useful and safe, but we can't assume any responsibility for them. FEEL WARNED!"
|
||||
if QMessageBox.question(self, self.tr("QGIS Python Plugin Installer"), self.tr(message), QMessageBox.Ok, QMessageBox.Abort) == QMessageBox.Ok:
|
||||
message = self.tr("You are going to add some plugin repositories neither authorized nor supported by the QGIS team, however provided by folks associated with us. Plugin authors generally make efforts to make their works useful and safe, but we can't assume any responsibility for them. FEEL WARNED!")
|
||||
if QMessageBox.question(self, self.tr("QGIS Python Plugin Installer"), message, QMessageBox.Ok, QMessageBox.Abort) == QMessageBox.Ok:
|
||||
repositories.addKnownRepos()
|
||||
# refresh lists and populate widgets
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
@ -704,4 +734,5 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialog):
|
||||
""" update the list of seen plugins before exit (both 'done' and 'x' buttons emit 'reject' signal) """
|
||||
plugins.updateSeenPluginsList()
|
||||
QDialog.reject(self)
|
||||
# } - C++ style footer for compability with lupdate
|
||||
# --- /class QgsPluginInstallerDialog ------------------------------------------------------------------------ #
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Copyright (C) 2008 Matthew Perry
|
||||
""" "
|
||||
Copyright (C) 2007-2008 Matthew Perry
|
||||
Copyright (C) 2008 Borys Jurgiel
|
||||
|
||||
/***************************************************************************
|
||||
@ -11,7 +11,15 @@ Copyright (C) 2008 Borys Jurgiel
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
"""
|
||||
|
||||
This file contains some additional quote marks (for example in the lines 2 and 20), they are
|
||||
for compatibility with lupdate, which doesn't properly recognize the comments in Python.
|
||||
The use of lupdate instead of pylupdate is forced by integration with rest of QGIS files,
|
||||
which are written mainly in C++. After editing this file make sure that lupdate and pylupdate
|
||||
find the same number of strings and balance the quotemarks if doesn't.
|
||||
" """
|
||||
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from qgis.core import *
|
||||
@ -20,34 +28,34 @@ from installer_data import *
|
||||
import resources_rc
|
||||
|
||||
|
||||
|
||||
class InstallerPlugin:
|
||||
# ----------------------------------------- #
|
||||
def __init__(self, iface):
|
||||
self.iface = iface
|
||||
if str(QGis.QGIS_VERSION)[0] == "0": # old plugin API
|
||||
self.mainWindow = self.iface.getMainWindow
|
||||
else: # new plugin API
|
||||
if QGIS_VER: # new plugin API
|
||||
self.mainWindow = self.iface.mainWindow
|
||||
else: # old plugin API
|
||||
self.mainWindow = self.iface.getMainWindow
|
||||
|
||||
# ----------------------------------------- #
|
||||
def initGui(self):
|
||||
""" create action that will start plugin window and then add it to menu """
|
||||
self.action = QAction(QIcon(":/plugins/installer/PluginInstaller.png"), QCoreApplication.translate("QgsPluginInstaller","Fetch Python Plugins..."), self.mainWindow())
|
||||
self.action = QAction(QIcon(":/plugins/installer/plugin_installer.png"), QCoreApplication.translate("QgsPluginInstaller","Fetch Python Plugins..."), self.mainWindow())
|
||||
self.action.setWhatsThis(QCoreApplication.translate("QgsPluginInstaller","Install more plugins from remote repositories"))
|
||||
self.action.setStatusTip(QCoreApplication.translate("QgsPluginInstaller","Install more plugins from remote repositories"))
|
||||
if str(QGis.QGIS_VERSION)[0] == "0":
|
||||
if QGIS_VER: # new plugin API
|
||||
nextAction = self.iface.actionManagePlugins()
|
||||
self.iface.pluginMenu().insertAction(nextAction,self.action)
|
||||
else: # old plugin API
|
||||
nextAction = self.mainWindow().menuBar().actions()[4].menu().actions()[1]
|
||||
self.mainWindow().menuBar().actions()[4].menu().insertAction(nextAction,self.action)
|
||||
else:
|
||||
nextAction = self.iface.actionManagePlugins() #actionPluginSeparator1()
|
||||
self.iface.pluginMenu().insertAction(nextAction,self.action)
|
||||
QObject.connect(self.action, SIGNAL("activated()"), self.run)
|
||||
self.statusLabel = None
|
||||
|
||||
repositories.load()
|
||||
plugins.clear()
|
||||
if repositories.checkingOnStart():
|
||||
|
||||
if repositories.checkingOnStart() and repositories.allEnabled():
|
||||
self.statusLabel = QLabel(QCoreApplication.translate("QgsPluginInstaller","Looking for new plugins..."), self.mainWindow().statusBar())
|
||||
self.mainWindow().statusBar().insertPermanentWidget(0,self.statusLabel)
|
||||
QObject.connect(self.statusLabel, SIGNAL("linkActivated (QString)"), self.run)
|
||||
@ -112,11 +120,13 @@ class InstallerPlugin:
|
||||
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
# display error messages for every unavailable reposioty, except the case if all repositories are unavailable!
|
||||
# display an error message for every unavailable reposioty, except the case if all repositories are unavailable!
|
||||
if repositories.allUnavailable() and repositories.allUnavailable() != repositories.allEnabled():
|
||||
for key in repositories.allUnavailable():
|
||||
QMessageBox.warning(self.mainWindow(), 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(self.mainWindow(),flags)
|
||||
self.guiDlg.show()
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'repositorybase.ui'
|
||||
#
|
||||
# Created: Fri Sep 12 19:21:37 2008
|
||||
# Created: Wed Sep 17 14:22:09 2008
|
||||
# by: PyQt4 UI code generator 4.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -118,6 +118,5 @@ class Ui_QgsPluginInstallerRepositoryDetailsDialog(object):
|
||||
self.checkBoxEnabled.setToolTip(QtGui.QApplication.translate("QgsPluginInstallerRepositoryDetailsDialog", "Enable or disable the repository (disabled repositories will be omitted)", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.checkBoxEnabled.setWhatsThis(QtGui.QApplication.translate("QgsPluginInstallerRepositoryDetailsDialog", "Enable or disable the repository (disabled repositories will be omitted)", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.checkBoxEnabled.setText(QtGui.QApplication.translate("QgsPluginInstallerRepositoryDetailsDialog", "Enabled", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.labelInfo.setText(QtGui.QApplication.translate("QgsPluginInstallerRepositoryDetailsDialog", "[place for a warning message]", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
import resources_rc
|
||||
|
@ -187,7 +187,7 @@
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>[place for a warning message]</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/plugins/installer">
|
||||
<file>PluginInstaller.png</file>
|
||||
<file>plugin_installer.png</file>
|
||||
<file>qgis-icon.png</file>
|
||||
<file>repoDisabled.png</file>
|
||||
<file>repoUnavailable.png</file>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: pt. wrz 12 19:21:37 2008
|
||||
# Created: sob. wrz 13 00:34:16 2008
|
||||
# by: The Resource Compiler for PyQt (Qt v4.3.2)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -162,58 +162,6 @@ qt_resource_data = "\
|
||||
\xae\xad\x5d\xf1\x5c\xcf\x3f\x9c\xe8\xa1\xcd\x18\x70\x3e\x28\xa8\
|
||||
\x1e\x34\x9b\x57\xff\xfb\x3f\xc8\x9f\xa2\x63\x68\x95\x98\xd0\x55\
|
||||
\x56\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
|
||||
\x00\x00\x03\x11\
|
||||
\x89\
|
||||
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
|
||||
\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1f\xf3\xff\x61\
|
||||
\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\
|
||||
\xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x12\x00\x00\
|
||||
\x0b\x12\x01\xd2\xdd\x7e\xfc\x00\x00\x00\x07\x74\x49\x4d\x45\x07\
|
||||
\xd4\x0c\x0e\x14\x29\x37\x87\x80\x5f\xe3\x00\x00\x02\x9e\x49\x44\
|
||||
\x41\x54\x78\xda\x95\x92\x5b\x48\x53\x01\x18\xc7\xff\x3b\x3b\xd3\
|
||||
\xb9\xa6\x39\x2f\x9b\x97\xb4\x24\x13\xa7\xb9\x12\xb1\xde\x7a\xb1\
|
||||
\x0c\xc4\x4c\x34\x08\xc5\x34\x8d\x0a\x0c\x34\x7b\x29\x84\x8c\x22\
|
||||
\x33\xd0\x61\x3d\x16\x51\x12\x2a\x09\xf9\x50\xa1\xf8\x30\x12\xba\
|
||||
\x4b\x37\x9b\x28\xa3\x79\x69\xa6\xa6\xe7\xec\xd2\xe6\xe6\x39\x67\
|
||||
\x3b\x97\x5e\x5a\x99\x5b\x50\xdf\xdb\xf7\x7d\xfc\x7f\x1f\xfc\xbf\
|
||||
\x3f\xf0\x1f\x15\x73\x1e\xd9\x9a\x2e\x3c\x24\x33\xb1\x3b\x38\x23\
|
||||
\xfe\x45\x18\xdd\x82\x54\x4d\x27\x6e\xcb\xb5\x98\x10\x56\x50\xc2\
|
||||
\x4f\x43\x0c\xee\xc8\x70\x82\x95\x95\x9e\x84\xd8\x58\xa9\x66\xca\
|
||||
\x32\xb9\x43\x4e\xb2\xfc\x3b\xdb\x1c\xd5\xd4\x3f\x5c\x44\xe8\x24\
|
||||
\x52\xa0\x41\x01\xb0\xff\xf5\x1a\xc3\xf4\x95\xf0\x82\xd1\xf1\x78\
|
||||
\xa4\xdc\xab\x89\x53\xd6\xd4\x9d\xd4\x1f\x7d\x69\xad\x10\x53\x8c\
|
||||
\xa4\xa4\x3e\x8e\x6f\x11\x7b\xf1\x02\x80\x3a\xac\x78\x75\xf5\x8e\
|
||||
\x21\x20\x5c\x63\xe6\x1c\xc7\xa4\xba\x53\xd9\x23\x00\x54\x64\x06\
|
||||
\x48\x7d\xa7\x7a\x5e\xd7\x46\x4a\xcd\x17\x0d\xd3\x91\x5a\x79\x01\
|
||||
\x00\x79\x58\x0f\x94\xca\xef\xed\x94\xcf\xaa\xf4\xad\x05\x30\x6b\
|
||||
\xf5\xbc\x01\xc0\xa8\x8e\xa0\x79\x59\xf4\xa6\x1d\x8a\xc8\x44\x7d\
|
||||
\x7d\xf6\xf6\xc6\x86\xbc\xfd\xc0\x6f\x0f\x7e\x01\x86\x86\xce\xa8\
|
||||
\x78\x19\x5d\xcc\x70\x7e\xf8\x39\x01\xd4\x0a\x63\x53\x37\x42\x4f\
|
||||
\xc4\xe3\x6a\x16\x95\xb0\x76\xba\x72\x27\xd4\xd1\x0a\xa4\x67\xa8\
|
||||
\xcb\x00\x44\x86\x00\x72\x73\xa5\x24\x2e\xe0\x89\x08\xf6\x7e\x41\
|
||||
\x08\xc8\x93\xd0\x23\xd2\x60\x0f\xeb\xf4\xc3\xc9\xc9\x9b\x00\x00\
|
||||
\x2a\x95\x3c\x05\x80\x2a\x04\x60\x36\x3b\xdd\x3c\x38\x09\x00\x08\
|
||||
\x42\x86\x2d\x45\x9a\x73\x07\xb2\xf3\x0a\x8b\xb8\x9c\xc1\xda\xea\
|
||||
\x82\x31\x99\x4c\x06\x00\xb0\xd3\x1c\x0b\x40\x0a\x01\x94\x95\x3d\
|
||||
\x70\xd9\x5d\xac\x19\x00\xa2\x54\x24\x0e\x1a\xb6\xe6\x47\x8c\x8a\
|
||||
\x96\xa6\xaa\x9c\xd2\xd8\x44\xf2\x0a\x2f\x8a\xe0\x38\x01\x1f\xde\
|
||||
\xd2\x13\x00\x7c\xe1\x4c\x14\x5f\x3f\xa7\xba\x58\x86\x07\x41\xc8\
|
||||
\x30\x69\x59\x72\xf6\xdf\x9a\xac\xcd\x48\x8f\xeb\x76\x31\x54\x94\
|
||||
\x3f\x20\xe0\xd5\xb3\xe5\x35\xd3\xf0\xc2\x3d\x00\xfe\x10\x00\xb9\
|
||||
\x0d\xc4\x59\xb3\x69\xa9\xf3\xd1\x47\x87\x9d\x66\x50\x55\x96\x45\
|
||||
\x1a\x76\x25\xba\xb5\xf1\x9a\x48\x00\x98\x9a\x70\x06\x6e\x5c\x37\
|
||||
\x1b\xdd\x6e\x6e\xb4\xa3\xa3\xea\xcf\x37\x46\x55\x42\xa1\x2c\x46\
|
||||
\xbb\x40\xa3\x77\xf0\xd3\xe7\xb8\x13\x97\x9f\x7e\x99\x18\x77\xcc\
|
||||
\xb4\xb6\xed\x19\x98\xb1\xb1\x0d\x82\x28\xc2\xeb\xe5\x7d\x4e\xbb\
|
||||
\xd0\xc7\xb2\x77\x5b\xd7\x58\x7b\x43\xb8\x1c\x29\x00\x68\x55\x15\
|
||||
\xb8\x1f\xb9\x0f\xdd\x3f\xd3\x96\xf6\xc4\x54\x7a\xc1\x4a\x55\x4b\
|
||||
\x56\xaa\x5a\x72\xf9\x5a\xfc\xbd\x03\xe5\x76\x85\x82\x28\x0c\x8a\
|
||||
\xe4\xeb\x3d\x00\xe0\x53\xe4\x63\x41\xa4\x01\x61\x11\x63\x00\x3c\
|
||||
\x8b\x5f\x99\x71\x8f\xdb\x9f\x6a\x9b\x5d\x8d\x19\x1c\xb4\xcc\xdf\
|
||||
\x34\xbe\xbf\xe4\x71\xfb\x4d\xeb\xc3\xb4\xb1\x08\xb9\x0e\x9b\x37\
|
||||
\xcc\x48\x00\x1a\x00\x31\x00\x64\xeb\x17\x3f\x00\x3d\x4b\x18\xbb\
|
||||
\x0e\x57\x7e\xbc\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
|
||||
\
|
||||
\x00\x00\x13\x3e\
|
||||
\x89\
|
||||
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
|
||||
@ -524,6 +472,58 @@ qt_resource_data = "\
|
||||
\x2e\x17\x0c\xed\x7d\x65\xf2\x6f\x00\x36\x2d\x10\x9f\x17\x4e\x01\
|
||||
\xc4\x00\x4e\x03\x38\xf2\x9f\x01\x00\x7c\x97\x4a\xe1\x34\x7b\x75\
|
||||
\xb6\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
|
||||
\x00\x00\x03\x11\
|
||||
\x89\
|
||||
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
|
||||
\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1f\xf3\xff\x61\
|
||||
\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\
|
||||
\xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x12\x00\x00\
|
||||
\x0b\x12\x01\xd2\xdd\x7e\xfc\x00\x00\x00\x07\x74\x49\x4d\x45\x07\
|
||||
\xd4\x0c\x0e\x14\x29\x37\x87\x80\x5f\xe3\x00\x00\x02\x9e\x49\x44\
|
||||
\x41\x54\x78\xda\x95\x92\x5b\x48\x53\x01\x18\xc7\xff\x3b\x3b\xd3\
|
||||
\xb9\xa6\x39\x2f\x9b\x97\xb4\x24\x13\xa7\xb9\x12\xb1\xde\x7a\xb1\
|
||||
\x0c\xc4\x4c\x34\x08\xc5\x34\x8d\x0a\x0c\x34\x7b\x29\x84\x8c\x22\
|
||||
\x33\xd0\x61\x3d\x16\x51\x12\x2a\x09\xf9\x50\xa1\xf8\x30\x12\xba\
|
||||
\x4b\x37\x9b\x28\xa3\x79\x69\xa6\xa6\xe7\xec\xd2\xe6\xe6\x39\x67\
|
||||
\x3b\x97\x5e\x5a\x99\x5b\x50\xdf\xdb\xf7\x7d\xfc\x7f\x1f\xfc\xbf\
|
||||
\x3f\xf0\x1f\x15\x73\x1e\xd9\x9a\x2e\x3c\x24\x33\xb1\x3b\x38\x23\
|
||||
\xfe\x45\x18\xdd\x82\x54\x4d\x27\x6e\xcb\xb5\x98\x10\x56\x50\xc2\
|
||||
\x4f\x43\x0c\xee\xc8\x70\x82\x95\x95\x9e\x84\xd8\x58\xa9\x66\xca\
|
||||
\x32\xb9\x43\x4e\xb2\xfc\x3b\xdb\x1c\xd5\xd4\x3f\x5c\x44\xe8\x24\
|
||||
\x52\xa0\x41\x01\xb0\xff\xf5\x1a\xc3\xf4\x95\xf0\x82\xd1\xf1\x78\
|
||||
\xa4\xdc\xab\x89\x53\xd6\xd4\x9d\xd4\x1f\x7d\x69\xad\x10\x53\x8c\
|
||||
\xa4\xa4\x3e\x8e\x6f\x11\x7b\xf1\x02\x80\x3a\xac\x78\x75\xf5\x8e\
|
||||
\x21\x20\x5c\x63\xe6\x1c\xc7\xa4\xba\x53\xd9\x23\x00\x54\x64\x06\
|
||||
\x48\x7d\xa7\x7a\x5e\xd7\x46\x4a\xcd\x17\x0d\xd3\x91\x5a\x79\x01\
|
||||
\x00\x79\x58\x0f\x94\xca\xef\xed\x94\xcf\xaa\xf4\xad\x05\x30\x6b\
|
||||
\xf5\xbc\x01\xc0\xa8\x8e\xa0\x79\x59\xf4\xa6\x1d\x8a\xc8\x44\x7d\
|
||||
\x7d\xf6\xf6\xc6\x86\xbc\xfd\xc0\x6f\x0f\x7e\x01\x86\x86\xce\xa8\
|
||||
\x78\x19\x5d\xcc\x70\x7e\xf8\x39\x01\xd4\x0a\x63\x53\x37\x42\x4f\
|
||||
\xc4\xe3\x6a\x16\x95\xb0\x76\xba\x72\x27\xd4\xd1\x0a\xa4\x67\xa8\
|
||||
\xcb\x00\x44\x86\x00\x72\x73\xa5\x24\x2e\xe0\x89\x08\xf6\x7e\x41\
|
||||
\x08\xc8\x93\xd0\x23\xd2\x60\x0f\xeb\xf4\xc3\xc9\xc9\x9b\x00\x00\
|
||||
\x2a\x95\x3c\x05\x80\x2a\x04\x60\x36\x3b\xdd\x3c\x38\x09\x00\x08\
|
||||
\x42\x86\x2d\x45\x9a\x73\x07\xb2\xf3\x0a\x8b\xb8\x9c\xc1\xda\xea\
|
||||
\x82\x31\x99\x4c\x06\x00\xb0\xd3\x1c\x0b\x40\x0a\x01\x94\x95\x3d\
|
||||
\x70\xd9\x5d\xac\x19\x00\xa2\x54\x24\x0e\x1a\xb6\xe6\x47\x8c\x8a\
|
||||
\x96\xa6\xaa\x9c\xd2\xd8\x44\xf2\x0a\x2f\x8a\xe0\x38\x01\x1f\xde\
|
||||
\xd2\x13\x00\x7c\xe1\x4c\x14\x5f\x3f\xa7\xba\x58\x86\x07\x41\xc8\
|
||||
\x30\x69\x59\x72\xf6\xdf\x9a\xac\xcd\x48\x8f\xeb\x76\x31\x54\x94\
|
||||
\x3f\x20\xe0\xd5\xb3\xe5\x35\xd3\xf0\xc2\x3d\x00\xfe\x10\x00\xb9\
|
||||
\x0d\xc4\x59\xb3\x69\xa9\xf3\xd1\x47\x87\x9d\x66\x50\x55\x96\x45\
|
||||
\x1a\x76\x25\xba\xb5\xf1\x9a\x48\x00\x98\x9a\x70\x06\x6e\x5c\x37\
|
||||
\x1b\xdd\x6e\x6e\xb4\xa3\xa3\xea\xcf\x37\x46\x55\x42\xa1\x2c\x46\
|
||||
\xbb\x40\xa3\x77\xf0\xd3\xe7\xb8\x13\x97\x9f\x7e\x99\x18\x77\xcc\
|
||||
\xb4\xb6\xed\x19\x98\xb1\xb1\x0d\x82\x28\xc2\xeb\xe5\x7d\x4e\xbb\
|
||||
\xd0\xc7\xb2\x77\x5b\xd7\x58\x7b\x43\xb8\x1c\x29\x00\x68\x55\x15\
|
||||
\xb8\x1f\xb9\x0f\xdd\x3f\xd3\x96\xf6\xc4\x54\x7a\xc1\x4a\x55\x4b\
|
||||
\x56\xaa\x5a\x72\xf9\x5a\xfc\xbd\x03\xe5\x76\x85\x82\x28\x0c\x8a\
|
||||
\xe4\xeb\x3d\x00\xe0\x53\xe4\x63\x41\xa4\x01\x61\x11\x63\x00\x3c\
|
||||
\x8b\x5f\x99\x71\x8f\xdb\x9f\x6a\x9b\x5d\x8d\x19\x1c\xb4\xcc\xdf\
|
||||
\x34\xbe\xbf\xe4\x71\xfb\x4d\xeb\xc3\xb4\xb1\x08\xb9\x0e\x9b\x37\
|
||||
\xcc\x48\x00\x1a\x00\x31\x00\x64\xeb\x17\x3f\x00\x3d\x4b\x18\xbb\
|
||||
\x0e\x57\x7e\xbc\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
|
||||
\
|
||||
"
|
||||
|
||||
qt_resource_name = "\
|
||||
@ -549,24 +549,24 @@ qt_resource_name = "\
|
||||
\x00\x72\
|
||||
\x00\x65\x00\x70\x00\x6f\x00\x55\x00\x6e\x00\x61\x00\x76\x00\x61\x00\x69\x00\x6c\x00\x61\x00\x62\x00\x6c\x00\x65\x00\x2e\x00\x70\
|
||||
\x00\x6e\x00\x67\
|
||||
\x00\x14\
|
||||
\x04\x88\x2d\xc7\
|
||||
\x00\x70\
|
||||
\x00\x6c\x00\x75\x00\x67\x00\x69\x00\x6e\x00\x5f\x00\x69\x00\x6e\x00\x73\x00\x74\x00\x61\x00\x6c\x00\x6c\x00\x65\x00\x72\x00\x2e\
|
||||
\x00\x70\x00\x6e\x00\x67\
|
||||
\x00\x0d\
|
||||
\x09\xa1\x91\x67\
|
||||
\x00\x71\
|
||||
\x00\x67\x00\x69\x00\x73\x00\x2d\x00\x69\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
|
||||
\x00\x13\
|
||||
\x06\x9f\x85\x27\
|
||||
\x00\x50\
|
||||
\x00\x6c\x00\x75\x00\x67\x00\x69\x00\x6e\x00\x49\x00\x6e\x00\x73\x00\x74\x00\x61\x00\x6c\x00\x6c\x00\x65\x00\x72\x00\x2e\x00\x70\
|
||||
\x00\x6e\x00\x67\
|
||||
"
|
||||
|
||||
qt_resource_struct = "\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
|
||||
\x00\x00\x00\x14\x00\x02\x00\x00\x00\x05\x00\x00\x00\x03\
|
||||
\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x00\xc6\x00\x00\x00\x00\x00\x01\x00\x00\x0c\x26\
|
||||
\x00\x00\x00\xa6\x00\x00\x00\x00\x00\x01\x00\x00\x09\x11\
|
||||
\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x00\xd4\x00\x00\x00\x00\x00\x01\x00\x00\x1c\x53\
|
||||
\x00\x00\x00\x7a\x00\x00\x00\x00\x00\x01\x00\x00\x05\x7f\
|
||||
\x00\x00\x00\x52\x00\x00\x00\x00\x00\x01\x00\x00\x01\xe6\
|
||||
"
|
||||
|
@ -26,7 +26,7 @@ class unzip:
|
||||
|
||||
def extract(self, file, dir):
|
||||
if not dir.endswith(':') and not os.path.exists(dir):
|
||||
os.mkdir(dir)
|
||||
os.makedirs(dir)
|
||||
|
||||
zf = zipfile.ZipFile(file)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user