elements := #('eins' 'zwei' 'drei' 'vier').
elements do: [ :element | Delay forSeconds: 2. ] displayingProgress: [ :element | 'Working on', element asString ]. Shouldn't it just open a progress bar and iterate through the elements printing 'Working on...? Regards Friedrich |
Without having tried it, I think you're missing a #wait message in there:
elements := #('eins' 'zwei' 'drei' 'vier').
elements do: [ :element | (Delay forSeconds: 2) wait ]. displayingProgress: [ :element | 'Working on', element asString ]. Cheers, Bernat. 2014-03-18 9:52 GMT+01:00 Friedrich Dominicus <[hidden email]>: elements := #('eins' 'zwei' 'drei' 'vier'). Bernat Romagosa. |
ouch, I added a . in the middle, sorry! elements := #('eins' 'zwei' 'drei' 'vier').
elements do: [ :element | (Delay forSeconds: 2) wait ]
displayingProgress: [ :element | 'Working on', element asString ]. 2014-03-18 9:55 GMT+01:00 Bernat Romagosa <[hidden email]>:
Bernat Romagosa. |
Bernat Romagosa <[hidden email]> writes:
> ouch, I added a . in the middle, sorry! > > elements := #('eins' 'zwei' 'drei' 'vier'). > elements > do: [ :element | (Delay forSeconds: 2) wait ] > displayingProgress: [ :element | 'Working on', element asString ]. > > 2014-03-18 9:55 GMT+01:00 Bernat Romagosa > <[hidden email]>: > > Without having tried it, I think you're missing a #wait message in > there: > > > > elements := #('eins' 'zwei' 'drei' 'vier'). > elements do: [ :element | (Delay forSeconds: 2) wait ]. > > displayingProgress: [ :element | 'Working on', element asString ]. It's just a progress bar with nothing else. No "Working on" anywhere. Regards Friedrich |
2014-03-19 8:17 GMT+01:00 Friedrich Dominicus <[hidden email]>:
It doesn't work anymore. (This worked in Pharo 1.4) In the comment of Collection>>do:displayingProgress: is a example, that doesn't work: Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name]. This should show the class names but it shows only a single progressbar. |
Note however that the first example used in the method
comment, which displays a static label, does work. There is something wrong in
the method of computing the changing label in the second example. I can't
follow the code here, so I can't see the error, but it should be clear where to
look.
Peter Kenny From: Pharo-users [mailto:[hidden email]] On Behalf Of Nicolai Hess Sent: 19 March 2014 08:56 To: Any question about pharo is welcome Subject: Re: [Pharo-users] What's wrong whith this code? 2014-03-19 8:17 GMT+01:00 Friedrich Dominicus <[hidden email]>:
It doesn't work anymore. (This worked in Pharo 1.4)
In the comment of Collection>>do:displayingProgress: is a example, that doesn't work: Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name]. This should show the class names but it shows
only a single progressbar. |
In reply to this post by FDominicus
Well I did some experiments, and I seem to have a solution. In
the method Collection>>do:displayingProgress:every:, you will find (three
lines from the end) the line:
ifFalse: [ProgressNotification signal: '' extra: (oldLabel := newLabel)]. ifFalse: [bar label: (oldLabel := newLabel)]. From: Pharo-users [mailto:[hidden email]] On Behalf Of PBK Research Sent: 19 March 2014 09:09 To: [hidden email]; 'Any question about pharo is welcome' Subject: Re: [Pharo-users] What's wrong whith this code? Note however that the first example used in the method
comment, which displays a static label, does work. There is something wrong in
the method of computing the changing label in the second example. I can't
follow the code here, so I can't see the error, but it should be clear where to
look.
Peter Kenny From: Pharo-users [mailto:[hidden email]] On Behalf Of Nicolai Hess Sent: 19 March 2014 08:56 To: Any question about pharo is welcome Subject: Re: [Pharo-users] What's wrong whith this code? 2014-03-19 8:17 GMT+01:00 Friedrich Dominicus <[hidden email]>:
It doesn't work anymore. (This worked in Pharo 1.4)
In the comment of Collection>>do:displayingProgress: is a example, that doesn't work: Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name]. This should show the class names but it shows
only a single progressbar. |
In reply to this post by FDominicus
Friedrich Dominicus wrote:
Bernat Romagosa [hidden email] writes:ouch, I added a . in the middle, sorry! elements := #('eins' 'zwei' 'drei' 'vier'). elements do: [ :element | (Delay forSeconds: 2) wait ] displayingProgress: [ :element | 'Working on', element asString ]. 2014-03-18 9:55 GMT+01:00 Bernat Romagosa [hidden email]: Without having tried it, I think you're missing a #wait message in there: elements := #('eins' 'zwei' 'drei' 'vier'). elements do: [ :element | (Delay forSeconds: 2) wait ]. displayingProgress: [ :element | 'Working on', element asString ].Sorry even with that I do not see the 'Working on ' message. It's just a progress bar with nothing else. No "Working on" anywhere. Regards Friedrich I'm not sure what the expected result is, but if you debug/step into that code a few times you find yourself in... Array(Collection)>>do:displayingProgress:every: Looking at expression... aStringOrBlock isString I guessed something might be learnt from stepping through... elements := #('eins' 'zwei' 'drei' 'vier'). elements do: [ :element | (Delay forSeconds: 2) wait ] displayingProgress: 'MyProgress' and indeed progress bar text is updated by the line... bar label: aStringOrBlock. Now stepping through your original script, #label: never seems to be executed So replacing... [ProgressNotification signal: '' extra: (oldLabel := newLabel)] with... [ bar label: newLabel. ProgressNotification signal: '' extra: (oldLabel := newLabel). ]. seems to do the trick, although as I said before, I don't know what the expected behaviour is. Is that what you need? I've not looked at this code before so I've learnt something new today. In particular, for a while I was wondering purpose ProgressNotification served since tracing through it seemed to do nothing, and then I realised it might be used something like this... elements := #('eins' 'zwei' 'drei' 'vier' ). [ elements do: [ :element | (Delay forSeconds: 2) wait ] displayingProgress: [ :element | 'Working on ', element asString ] ] on: ProgressNotification do: [ :notice | self inform: notice extraParam printString. notice resume ] I've logged a case https://pharo.fogbugz.com/f/cases/13101/Progress-bar-progressive-text-update-not-working cheers -ben |
I think the ProgressNotification was only used in older pharo version (like 1.4, where this displayProgress: ... 2014-03-19 16:46 GMT+01:00 Ben Coman <[hidden email]>:
|
In reply to this post by Ben Coman
Ben Coman wrote:
Friedrich Dominicus wrote:Bernat Romagosa [hidden email] writes:ouch, I added a . in the middle, sorry! elements := #('eins' 'zwei' 'drei' 'vier'). elements do: [ :element | (Delay forSeconds: 2) wait ] displayingProgress: [ :element | 'Working on', element asString ]. 2014-03-18 9:55 GMT+01:00 Bernat Romagosa [hidden email]: Without having tried it, I think you're missing a #wait message in there: elements := #('eins' 'zwei' 'drei' 'vier'). elements do: [ :element | (Delay forSeconds: 2) wait ]. displayingProgress: [ :element | 'Working on', element asString ].Sorry even with that I do not see the 'Working on ' message. It's just a progress bar with nothing else. No "Working on" anywhere. Regards Friedrich Friedrich, Peter, Bernat, I've uploaded slice 13101 to the Pharo30Inbox. Could you review and comment on the issue tracker whether that is satisfactory. cheers -ben |
Administrator
|
In reply to this post by Nicolai Hess
IIRC we use announcements everywhere now for progress and ProgressNotification is no longer used. You may have found a reference that we forgot to remove. In general, progress is handled via aBlock asJob. Maybe all other methods should be outright removed. There were so many access points, maybe creating more spaghetti than convenience. Background: one of my major drivers for revamping progress with Cami at ESUG a few years ago was that I feel that using exceptions for non-exceptional conditions smells funny. In particular, if you're interested in being notified of progress, but the exception was handled already in code which you don't own, you'll never know. With the announcement approach we take now, all interested parties can register.
Cheers,
Sean |
Free forum by Nabble | Edit this page |