What's wrong whith this code?
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 <frido@q-software-solutions.de
:
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
-- 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 <tibabenfortlapalanca@gmail.com>:
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 < frido@q-software-solutions.de>:
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
-- Bernat Romagosa.
-- Bernat Romagosa.
Bernat Romagosa <tibabenfortlapalanca@gmail.com> 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 <tibabenfortlapalanca@gmail.com>:
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
2014-03-19 8:17 GMT+01:00 Friedrich Dominicus <frido@q-software-solutions.de
:
Bernat Romagosa <tibabenfortlapalanca@gmail.com> 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 <tibabenfortlapalanca@gmail.com>:
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
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:pharo-users-bounces@lists.pharo.org] 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 <frido@q-software-solutions.de>: Bernat Romagosa <tibabenfortlapalanca@gmail.com> 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 <tibabenfortlapalanca@gmail.com>:
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 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.
I think the ProgressNotification was only used in older pharo version (like 1.4, where this displayProgress: ... with progress title worked) 2014-03-19 16:46 GMT+01:00 Ben Coman <btc@openinworld.com>:
Friedrich Dominicus wrote:
Bernat Romagosa <tibabenfortlapalanca@gmail.com> <tibabenfortlapalanca@gmail.com> 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<tibabenfortlapalanca@gmail.com> <tibabenfortlapalanca@gmail.com>:
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...
cheers -ben
Nicolai Hess wrote
I think the ProgressNotification was only used in
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 -- View this message in context: http://forum.world.st/What-s-wrong-whith-this-code-tp4749558p4749960.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
participants (6)
-
Ben Coman -
Bernat Romagosa -
Friedrich Dominicus -
Nicolai Hess -
PBK Research -
Sean P. DeNigris