Kilon,

Here is another example:

OrderedCollection streamContents: [ :out |
  [ ZnClient new 
        signalProgress: true; 
        url: 'http://stfx.eu/PharoV20.sources'; 
        downloadTo: '/tmp' ]
     on: HTTPProgress 
     do: [ :notification | out nextPut: notification. notification resume ] ].

The resulting collection has more than 1000 elements.
So from the standpoint of Zn it works.
What is then done with the notifications is another thing.

Regards,

Sven

On 24 Sep 2013, at 22:53, kilon <[email protected]> wrote:

> The confusion of the noob, I saw a method though it was a class, did not see
> "self" in front of it. Yeap its definitely Zinc , its staring me in the face
> with that blank look :D
> 
> Ok then its certainly my lack of understanding. I will take my time learning
> how Zinc works and how progress bar works. Will take a deeper look into how
> Monticello uses it. Thanks for the help, I should be able to figure this
> out. If not you will know it by the deep sounds I make when I hit my head
> against the wall.  
> 
> 
> Sven Van Caekenberghe-2 wrote
>> On 24 Sep 2013, at 22:23, kilon &lt;
> 
>> [email protected]
> 
>> &gt; 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.
>>> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/ANN-Launching-Pharo-on-Ubuntu-tp4709757p4710159.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
> 


Reply via email to