2017-07-03 22:12:09 +00:00
|
|
|
"
|
2017-07-05 11:17:44 +00:00
|
|
|
I contain simple general functionality used by Grafoscopio, Dataviz
|
|
|
|
or other related projects.
|
2017-07-03 22:12:09 +00:00
|
|
|
"
|
|
|
|
Class {
|
2017-07-05 11:17:44 +00:00
|
|
|
#name : #GrafoscopioGenUtils,
|
2017-07-03 22:12:09 +00:00
|
|
|
#superclass : #Object,
|
|
|
|
#category : #'Grafoscopio-Utils'
|
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #'graphical interface' }
|
2017-07-05 11:17:44 +00:00
|
|
|
GrafoscopioGenUtils class >> downloadingFrom: downloadUrl withMessage: aString into: location [
|
2017-07-03 22:12:09 +00:00
|
|
|
| fileName |
|
|
|
|
fileName := (downloadUrl splitOn: $/) last.
|
|
|
|
(location / fileName) exists ifTrue: [ (location / fileName) ensureDelete ].
|
|
|
|
[: bar |
|
|
|
|
bar title: aString.
|
|
|
|
[ZnClient new
|
|
|
|
enforceHttpSuccess: true;
|
|
|
|
url: downloadUrl;
|
|
|
|
downloadTo: location;
|
|
|
|
signalProgress: true
|
|
|
|
]
|
|
|
|
on: HTTPProgress
|
|
|
|
do: [ :progress |
|
|
|
|
progress isEmpty ifFalse: [ bar current: progress percentage ].
|
|
|
|
progress resume ].
|
|
|
|
] asJob run.
|
|
|
|
]
|