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
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@lists.pharo.org] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@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
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@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@lists.pharo.org] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@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
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@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@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@lists.pharo.org] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@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
You could also have a look at ZnClientTests>>#testProgress where Notification are used, try the example in the comment. But that is probably not what you are looking for.
On 5 Feb 2017, at 20:32, Yuriy Tymchuk <yuriy.tymchuk@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@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@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@lists.pharo.org] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@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
You can create a morph that steps until the process is terminated. Attached is an example class: ==================== StepForProcessMorph new process: [ 10 seconds asDelay wait ]; extent: 200 asPoint; openCenteredInWorld ==================== Best regards, Henrik -----Opprinnelig melding----- Fra: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 20:33 Til: Pharo Development List <pharo-dev@lists.pharo.org> Emne: Re: [Pharo-dev] How can I create a trivial "spinner" etc, to see if image is busy? 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@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@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@lists.pharo.org] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@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
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@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@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@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@lists.pharo.org] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@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
In the base image Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name]. Phil On Sun, Feb 5, 2017 at 7:16 PM, Henrik Nergaard <draagren@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@lists.pharo.org] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@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
Yes, but that will block the UI. The progress bar update (world rendering) is done by force using âself currentWorld displayWorldâ, which also means that if the #do:displayingProgress: is forked there will be more than one UI rendering at the same time. Open a window, evaluate the script below, drag and drop the window around. [ Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name]. ] fork Best regards, Henrik Fra: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] PÃ¥ vegne av phil@highoctane.be Sendt: 05 February 2017 21:43 Til: Pharo Development List <pharo-dev@lists.pharo.org> Emne: Re: [Pharo-dev] How can I create a trivial "spinner" etc, to see if image is busy? In the base image Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name]. Phil On Sun, Feb 5, 2017 at 7:16 PM, Henrik Nergaard <draagren@outlook.com<mailto:draagren@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@lists.pharo.org<mailto:pharo-dev-bounces@lists.pharo.org>] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@lists.pharo.org<mailto:pharo-dev@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
Hey guys, thanks for all the replies, I know there there are many ways to do it right, but I donât have time to do a nice implementation because I want to see if I can hack something out of the data that I have and so I just need a way to see whether my image is busy. This did a job for me (and itâs the shortest thing I came up with, so I can put into my snippets collection): (Morph newAnonymousSubclass compile: 'step self color: self color negated'; compile: 'stepTime ^ 500'; new) openInHand Cheers Uko
On 5 Feb 2017, at 22:39, Henrik Nergaard <draagren@outlook.com> wrote:
Yes, but that will block the UI. The progress bar update (world rendering) is done by force using âself currentWorld displayWorldâ, which also means that if the #do:displayingProgress: is forked there will be more than one UI rendering at the same time.
Open a window, evaluate the script below, drag and drop the window around. [ Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name]. ] fork
Best regards, Henrik
Fra: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] PÃ¥ vegne av phil@highoctane.be Sendt: 05 February 2017 21:43 Til: Pharo Development List <pharo-dev@lists.pharo.org> Emne: Re: [Pharo-dev] How can I create a trivial "spinner" etc, to see if image is busy?
In the base image
Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name].
Phil
On Sun, Feb 5, 2017 at 7:16 PM, Henrik Nergaard <draagren@outlook.com <mailto:draagren@outlook.com>> wrote: http://smalltalkhub.com/#!/~Latsabben/GafletFremgangFremviser <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@lists.pharo.org <mailto:pharo-dev-bounces@lists.pharo.org>] PÃ¥ vegne av Yuriy Tymchuk Sendt: 05 February 2017 16:56 Til: Pharo Development List <pharo-dev@lists.pharo.org <mailto:pharo-dev@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
Hi Yuriy, For DrGeo I wrote this spinner DrGLoader start. DrGLoader stop -- Dr. Geo http://drgeo.eu
Fork can be used to avoid freezing issues unless of course they are caused by the VM. VM usually prefer to crash. I have used fork once to load a very glitchy package when StHub was misbeheaving. You do not need a spinner in this case because you can keep using the image. But if you want to find out if the process indeed has frozen in that case I can see its need. On Sun, Feb 5, 2017 at 5:56 PM Yuriy Tymchuk <yuriy.tymchuk@me.com> wrote:
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
participants (6)
-
Dimitris Chloupis -
Henrik Nergaard -
Hilaire -
phil@highoctane.be -
Sven Van Caekenberghe -
Yuriy Tymchuk