@@ -101,7 +101,7 @@ class GetScriptsAndModelsDialog(QDialog, Ui_DlgGetScriptsAndModels):
101
101
'<p>Algorithms are divided in 3 groups:</p>'
102
102
'<ul><li><b>Installed:</b> Algorithms already in your system, with '
103
103
'the latest version available</li>'
104
- '<li><b>Upgradable :</b> Algorithms already in your system, but with '
104
+ '<li><b>Updatable :</b> Algorithms already in your system, but with '
105
105
'a newer version available in the server</li>'
106
106
'<li><b>Not installed:</b> Algorithms not installed in your '
107
107
'system</li></ul>' )
@@ -139,6 +139,7 @@ def populateTree(self):
139
139
self .notinstalledItem .setIcon (0 , self .icon )
140
140
resources = readUrl (self .urlBase + 'list.txt' ).splitlines ()
141
141
resources = [r .split (',' ) for r in resources ]
142
+ self .resources = {f :(v ,n ) for f ,v ,n in resources }
142
143
for filename , version , name in resources :
143
144
treeBranch = self .getTreeBranchForState (filename , float (version ))
144
145
item = TreeItem (filename , name , self .icon )
@@ -177,8 +178,8 @@ def getTreeBranchForState(self, filename, version):
177
178
with open (helpFile ) as f :
178
179
helpContent = json .load (f )
179
180
currentVersion = float (helpContent [Help2Html .ALG_VERSION ])
180
- except :
181
- currentVersion = 1
181
+ except Exception :
182
+ currentVersion = 0
182
183
if version > currentVersion :
183
184
return self .toupdateItem
184
185
else :
@@ -209,12 +210,21 @@ def okPressed(self):
209
210
path = os .path .join (self .folder , filename )
210
211
with open (path , 'w' ) as f :
211
212
f .write (code )
212
- self .progressBar .setValue (i + 1 )
213
213
except HTTPError :
214
214
QMessageBox .critical (iface .mainWindow (),
215
215
self .tr ('Connection problem' ),
216
216
self .tr ('Could not download file: %s' ) % filename )
217
217
return
218
+ url += '.help'
219
+ try :
220
+ html = readUrl (url )
221
+ except HTTPError :
222
+ html = '{"ALG_VERSION" : %s}' % self .resources [filename ][0 ]
223
+
224
+ path = os .path .join (self .folder , filename + '.help' )
225
+ with open (path , 'w' ) as f :
226
+ f .write (html )
227
+ self .progressBar .setValue (i + 1 )
218
228
219
229
220
230
toDelete = []
0 commit comments