GrafoscopioUtils/repository/Grafoscopio-Utils/GrafoscopioGenUtils.class.st
Offray Luna 8b29956392 Better styling and reuse for GrafoscopioDocumentation, which allow to define
better and more modular documentation for  several packages.
2020-05-02 22:53:56 +00:00

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.
]