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-06 21:23:22 +00:00
|
|
|
#name : #GrafoscopioUtils,
|
2017-07-03 22:12:09 +00:00
|
|
|
#superclass : #Object,
|
|
|
|
#category : #'Grafoscopio-Utils'
|
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #'graphical interface' }
|
2017-07-06 21:23:22 +00:00
|
|
|
GrafoscopioUtils 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.
|
|
|
|
]
|