On 2013-09-24, at 17:43, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 24 Sep 2013, at 22:23, kilon <thekilon@yahoo.co.uk> wrote:
Actually it works its just that is not meant to create a progress bar.
To create a progressbar I created a new test
testProgressBar UIManager default informUserDuring: [ :bar | [ ^ ZnClient new signalProgress: true; get: 'http://zn.stfx.eu/echo?delay=2' ] on: HTTPProgress do: [ :progress | bar label: progress printString. progress isEmpty ifFalse: [ bar current: progress percentage ]. progress resume ] ]
it displays the progressbar , but it displays no progress (blue bar thing) and it close as soon as it finish the get. I tried to implement that in
createImageFromTemplate | name | name := UIManager default request: 'Image name?'. self showDownloadInProgress. [UIManager default informUserDuring: [ :bar | [ imageGroup extractTemplate: self selectedTemplate to: name] on: HTTPProgress do: [ :progress | bar label: progress printString. progress isEmpty ifFalse: [ bar current: progress percentage ]. progress resume ] ]] on: PhLDownloadError do: [ :err | UIManager default alert: err longDescription. ^ self ].
self updateAll.
I assume that code is deeply flawed , hence why it does not display me any progressbar at all. Looks like I have a lot to learn.
First I am not sure if ZnClient downloads in packets and if it reports progress per packet . If its progress is upon success of download then it does not help at all , because in that case there will be only one stage of progress upon success of download. I want multiple stages of progress so the download bar increases from 0% to 100%(preferably per kb ). IF that is the cace then probably I will be better using the HTTP client of monticello to download the images which I know it works that way.
Is there a particular reason why we should stick to Zinc ?
The HTTP client of Monticello _is_ ZnClient, see MCHttpRepository>>#httpClient ;-)
Now, for performance reasons, progress in only signalled every ZnUtils class>>#streamingBufferSize which is currently 16K.
Apart from that, the download might go that fast that there is little to show.
I am certainly not claiming that the HTTPProgress stuff is perfect, but it seems to work.
... and the progress bar certainly much further away from that goal :)