mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
[processing] fixes in model/script downloader
This commit is contained in:
parent
a58e64897c
commit
877f07ab5d
@ -16,16 +16,7 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
from PyQt4 import QtGui
|
|
||||||
from processing.ui.ui_DlgGetScriptsAndModels import Ui_DlgGetScriptsAndModels
|
|
||||||
from processing.script.ScriptUtils import ScriptUtils
|
|
||||||
from processing.modeler.ModelerUtils import ModelerUtils
|
|
||||||
import json
|
|
||||||
from processing.gui import Help2Html
|
|
||||||
from qgis.utils import iface
|
|
||||||
from processing.gui.Help2Html import getDescription, ALG_DESC, ALG_VERSION,\
|
|
||||||
ALG_CREATOR
|
|
||||||
|
|
||||||
__author__ = 'Victor Olaya'
|
__author__ = 'Victor Olaya'
|
||||||
__date__ = 'June 2014'
|
__date__ = 'June 2014'
|
||||||
@ -35,12 +26,20 @@ __copyright__ = '(C) 201, Victor Olaya'
|
|||||||
|
|
||||||
__revision__ = '$Format:%H$'
|
__revision__ = '$Format:%H$'
|
||||||
|
|
||||||
|
import os
|
||||||
|
import json
|
||||||
import urllib2
|
import urllib2
|
||||||
from urllib2 import HTTPError
|
from urllib2 import HTTPError
|
||||||
from PyQt4.QtCore import *
|
from PyQt4.QtCore import *
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
from processing.gui.ToolboxAction import ToolboxAction
|
from processing.gui.ToolboxAction import ToolboxAction
|
||||||
|
from PyQt4 import QtGui
|
||||||
|
from processing.ui.ui_DlgGetScriptsAndModels import Ui_DlgGetScriptsAndModels
|
||||||
|
from processing.script.ScriptUtils import ScriptUtils
|
||||||
|
from processing.modeler.ModelerUtils import ModelerUtils
|
||||||
|
from processing.gui import Help2Html
|
||||||
|
from qgis.utils import iface
|
||||||
|
from processing.gui.Help2Html import getDescription, ALG_DESC, ALG_VERSION, ALG_CREATOR
|
||||||
|
|
||||||
class GetScriptsAction(ToolboxAction):
|
class GetScriptsAction(ToolboxAction):
|
||||||
|
|
||||||
@ -93,8 +92,8 @@ class GetScriptsAndModelsDialog(QDialog, Ui_DlgGetScriptsAndModels):
|
|||||||
HELP_TEXT = ("<h3> Processing resources manager </h3>"
|
HELP_TEXT = ("<h3> Processing resources manager </h3>"
|
||||||
"<p>Check/uncheck algorithms in the tree to select the ones that you want to install or remove</p>"
|
"<p>Check/uncheck algorithms in the tree to select the ones that you want to install or remove</p>"
|
||||||
"<p>Algorithms are divided in 3 groups:</p>"
|
"<p>Algorithms are divided in 3 groups:</p>"
|
||||||
"<ul><li><b>Installed:</b> Algorihms already in your system, with the latest version available</li>"
|
"<ul><li><b>Installed:</b> Algorithms already in your system, with the latest version available</li>"
|
||||||
"<li><b>Upgradable:</b> Algorihms already in your system, but with a newer version available in the server</li>"
|
"<li><b>Upgradable:</b> Algorithms already in your system, but with a newer version available in the server</li>"
|
||||||
"<li><b>Not installed:</b> Algorithms not installed in your system</li></ul>")
|
"<li><b>Not installed:</b> Algorithms not installed in your system</li></ul>")
|
||||||
MODELS = 0
|
MODELS = 0
|
||||||
SCRIPTS = 1
|
SCRIPTS = 1
|
||||||
@ -195,11 +194,17 @@ class GetScriptsAndModelsDialog(QDialog, Ui_DlgGetScriptsAndModels):
|
|||||||
for i, filename in enumerate(toDownload):
|
for i, filename in enumerate(toDownload):
|
||||||
QCoreApplication.processEvents()
|
QCoreApplication.processEvents()
|
||||||
url = self.urlBase + filename.replace(" ","%20")
|
url = self.urlBase + filename.replace(" ","%20")
|
||||||
code = readUrl(url)
|
try:
|
||||||
path = os.path.join(self.folder, filename)
|
code = readUrl(url)
|
||||||
with open(path, "w") as f:
|
path = os.path.join(self.folder, filename)
|
||||||
f.write(code)
|
with open(path, "w") as f:
|
||||||
self.progressBar.setValue(i + 1)
|
f.write(code)
|
||||||
|
self.progressBar.setValue(i + 1)
|
||||||
|
except HTTPError:
|
||||||
|
QMessageBox.critical(iface.mainWindow(), "Connection problem",
|
||||||
|
"Could not download file :" + filename)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
toDelete = []
|
toDelete = []
|
||||||
for i in xrange(self.uptodateItem.childCount()):
|
for i in xrange(self.uptodateItem.childCount()):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user