30 lines
773 B
Smalltalk
30 lines
773 B
Smalltalk
"
|
|
I contain simple general functionality used by Grafoscopio, Dataviz
|
|
or other related projects.
|
|
"
|
|
Class {
|
|
#name : #GrafoscopioGenUtils,
|
|
#superclass : #Object,
|
|
#category : #'Grafoscopio-Utils'
|
|
}
|
|
|
|
{ #category : #'graphical interface' }
|
|
GrafoscopioGenUtils class >> downloadingFrom: downloadUrl withMessage: aString into: location [
|
|
| 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.
|
|
]
|