On 24 Sep 2013, at 22:23, kilon <[email protected]> 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.

> I am open to suggestions :) 
> 
> 
> Sven Van Caekenberghe-2 wrote
>> On 24 Sep 2013, at 15:18, kilon &lt;
> 
>> [email protected]
> 
>> &gt; wrote:
>> 
>>> ah yes of course. Ok thanks for adding me. 
>>> 
>>> I took a look at the code, it points back to Zinc , it look like I would
>>> need to override  ZnClient >> withProgressDo: , no Idea how to do this
>>> currently but will continue looking into . I also found how monticello
>>> uses
>>> progress bars when downloading repos but it does not seem to use Zinc at
>>> all. So yeah this will take me quite some time to implement. 
>> 
>> Progress is indicated by HTTPProgress Notification that are being
>> signalled by the underlying code. You have to catch them and do something
>> with them.
>> 
>> Have a look at ZnClientTests>>#testProgress
>> 
>> Although the example in the comment does no longer seem to work...
>> 
>>> Its Fun none the less ;) 
>>> 
>>> 
>>> 
>>> Damien Cassou wrote
>>>> On Tue, Sep 24, 2013 at 1:21 PM, kilon &lt;
>>> 
>>>> [email protected]
>>> 
>>>> &gt; wrote:
>>>>> yeah I will give it a try, don't know how long will take me but I like
>>>>> what
>>>>> you have done with Pharo Launcher. I will create an enhancement issue
>>>>> when I
>>>>> have it working as I want and report back. Esteban has granted me
>>>>> commit
>>>>> right to pharo 3 inbox too so I will commit there. Or do you want me to
>>>>> contribute directly to smalltalk hub repo ?
>>>>> 
>>>>> I am new with pharo and morphic so please bare with me :)
>>>> 
>>>> 
>>>> the Pharo3Inbox is only for code integrated in Pharo itself. The
>>>> launcher won't be integrated in Pharo. I added you to the project
>>>> http://www.smalltalkhub.com/#!/~Pharo/PharoLauncher
>>>> 
>>>> -- 
>>>> Damien Cassou
>>>> http://damiencassou.seasidehosting.st
>>>> 
>>>> "Success is the ability to go from one failure to another without
>>>> losing enthusiasm."
>>>> Winston Churchill
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> View this message in context:
>>> http://forum.world.st/ANN-Launching-Pharo-on-Ubuntu-tp4709757p4710044.html
>>> Sent from the Pharo Smalltalk Developers mailing list archive at
>>> Nabble.com.
>>> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/ANN-Launching-Pharo-on-Ubuntu-tp4709757p4710146.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
> 


Reply via email to