[Pharo-dev] How can I create a trivial "spinner" etc, to see if image is busy?

phil at highoctane.be phil at highoctane.be
Sun Feb 5 15:49:52 EST 2017


Maybe time to resurrect the AnimatedImageMorph that can load an animated
gif...

http://magaloma.seasidehosting.st/MorphExamplesAndDemos

http://smalltalkhub.com/#!/~PharoExtras/MorphExamplesAndDemos

Phil

On Sun, Feb 5, 2017 at 8:32 PM, Yuriy Tymchuk <yuriy.tymchuk at me.com> wrote:

> This is a really nice solution for STON, thank you!
>
> But in general terms, imagine I have some task and it’s not the trivial to
> add a progress bar. I could spawn a string morph and make circle the digits
> with some interval, but maybe there is something easier. For example
> Kommiter had a spinner morph that you could just open and it would be
> spinning. So when you run a task you can easily see that the task is still
> running
>
> Uko
>
> > On 5 Feb 2017, at 20:01, Sven Van Caekenberghe <sven at stfx.eu> wrote:
> >
> > A bit off topic, but I would do the STON writing as follows:
> >
> > [
> > (FileLocator temp / 'file.ston') writeStreamDo: [ :out |
> >  (STON writer on: out) in: [ :stonWriter |
> >    30 timesRepeat: [
> >      stonWriter nextPut: Smalltalk allClasses ] ] ].
> > ] timeToRun. "0:00:00:02.176"
> >
> > But in light of alternative streams and some optimisation, this works
> too:
> >
> > [
> > | file |
> > file := (File named: '/tmp/file.ston') openForWrite.
> > [
> >  ZnBufferedWriteStream on: (ZnCharacterWriteStream on: file) do: [ :out |
> >    (STON writer on: out) in: [ :stonWriter |
> >      30 timesRepeat: [
> >        stonWriter nextPut: Smalltalk allClasses ] ] ]
> > ] ensure: [ file close ].
> > ] timeToRun. "0:00:00:00.385"
> >
> > Which is faster.
> >
> > Total file size is ~1.2MB.
> >
> > BTW, we need #readStreamDo: and #writeStreamDo: on File I think, as it
> encourages proper resource management.
> >
> >> On 5 Feb 2017, at 19:16, Henrik Nergaard <draagren at outlook.com> wrote:
> >>
> >> http://smalltalkhub.com/#!/~Latsabben/GafletFremgangFremviser
> >>
> >> ---------------------
> >> | ston file|
> >>
> >> ston := (1 to: 30) flatCollect: [:ix |STON toStringPretty: Smalltalk
> allClasses].
> >> file := (FileStream fileNamed: 'file.ston').
> >>
> >> ston whileDisplayingProgress
> >>      action: [ :stream | file nextPutAll: stream ] whenDone: [ file
> close ];
> >>      open;
> >>      fillOwner
> >> ---------------------
> >>
> >> Best regards,
> >> Henrik
> >>
> >> -----Opprinnelig melding-----
> >> Fra: Pharo-dev [mailto:pharo-dev-bounces at lists.pharo.org] På vegne av
> Yuriy Tymchuk
> >> Sendt: 05 February 2017 16:56
> >> Til: Pharo Development List <pharo-dev at lists.pharo.org>
> >> Emne: [Pharo-dev] How can I create a trivial "spinner" etc, to see if
> image is busy?
> >>
> >> Hi all,
> >>
> >> is there an easy was to do some thing that is constantly changing? so
> if my image freezes (to export a 1gb ston file for example) I can see when
> it’s done.    Or maybe there is a way to send a mac notification from Pharo?
> >>
> >> Cheers.
> >> Uko
> >
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20170205/02206c45/attachment.html>


More information about the Pharo-dev mailing list