how to know if an image is resuming or not

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

how to know if an image is resuming or not

Stéphane Ducasse
hi guys

I'm too dead to think more but I want to do the following

        save the current image
                (I used saveSession)
        and only when not resuming I want to save another image.

Is there a way to know if an image is resuming (if the pc pointer just go reactivated - that the image was closed and reopened).

naively I was doing

saveImageForRunningTests

        | comment commentQuoted st |
        SmalltalkImage current saveSession.
                "now you can reopen prior to publishing to fix :)"
        self saveAsImageAsTestImage.
       
        self inform: 'Now you can use this image named ''Test'' to run the tests and come back to fix problems in the previous one and eventually freeze it by selecting the next step, in either one.'

and of course when I reopened the save session I reperformed the "self saveAsImageAsTestImage."
Now I could use startUp:....
Or I could simply change my process but I wanted to know... I'm too dead now.

Stef


Reply | Threaded
Open this post in threaded view
|

Re: how to know if an image is resuming or not

Igor Stasenko
On 9 November 2010 00:25, Stéphane Ducasse <[hidden email]> wrote:

> hi guys
>
> I'm too dead to think more but I want to do the following
>
>        save the current image
>                (I used saveSession)
>        and only when not resuming I want to save another image.
>
> Is there a way to know if an image is resuming (if the pc pointer just go reactivated - that the image was closed and reopened).
>
> naively I was doing
>
> saveImageForRunningTests
>
>        | comment commentQuoted st |
>        SmalltalkImage current saveSession.
>                "now you can reopen prior to publishing to fix :)"
>        self saveAsImageAsTestImage.
>
>        self inform: 'Now you can use this image named ''Test'' to run the tests and come back to fix problems in the previous one and eventually freeze it by selecting the next step, in either one.'
>
> and of course when I reopened the save session I reperformed the "self saveAsImageAsTestImage."
> Now I could use startUp:....
> Or I could simply change my process but I wanted to know... I'm too dead now.
>
what about using some variable, like:

RunTests := true.
self saveimage.
RunTests := false.
self saveImage.

and then in startUp:

startUp: resuming

 ( resuming and: [ RunTests] ) ifTrue: [ self runTests ]

?
> Stef
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: how to know if an image is resuming or not

Stéphane Ducasse
In reply to this post by Stéphane Ducasse
>>
> what about using some variable, like:
>
> RunTests := true.
> self saveimage.
> RunTests := false.
> self saveImage.
>
> and then in startUp:
>
> startUp: resuming
>
> ( resuming and: [ RunTests] ) ifTrue: [ self runTests ]
>

but my code is executed when a menu is selected. So the interaction with startUp: is not really good.

Stef


Reply | Threaded
Open this post in threaded view
|

Re: how to know if an image is resuming or not

Igor Stasenko
On 9 November 2010 09:58, Stéphane Ducasse <[hidden email]> wrote:

>>>
>> what about using some variable, like:
>>
>> RunTests := true.
>> self saveimage.
>> RunTests := false.
>> self saveImage.
>>
>> and then in startUp:
>>
>> startUp: resuming
>>
>> ( resuming and: [ RunTests] ) ifTrue: [ self runTests ]
>>
>
> but my code is executed when a menu is selected. So the interaction with startUp: is not really good.
>

snapshot: save andQuit: quit embedded: embeddedFlag

answers the resuming flag.

So, you can use it like:

| resumedInFirstSnapshot |
resumedInFirstSnapshot := false.

"first save"
(Smalltalk snapshot: save andQuit: false) ifTrue: [ ... "resuming here
" resumedInFirstSnapshot  := true ]
"second save"
(Smalltalk snapshot: save andQuit: false) ifTrue: [ ... "resuming here
" resumedInFirstSnapshot ifFalse: [ ... ] ]



> Stef
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: how to know if an image is resuming or not

Stéphane Ducasse
In reply to this post by Stéphane Ducasse

Yes I was reading that method yesterday and I went to sleep
The embedded flag  got me distracted. I will retry now.
Thanks


> snapshot: save andQuit: quit embedded: embeddedFlag
>
> answers the resuming flag.
>
> So, you can use it like:
>
> | resumedInFirstSnapshot |
> resumedInFirstSnapshot := false.
>
> "first save"
> (Smalltalk snapshot: save andQuit: false) ifTrue: [ ... "resuming here
> " resumedInFirstSnapshot  := true ]
> "second save"
> (Smalltalk snapshot: save andQuit: false) ifTrue: [ ... "resuming here
> " resumedInFirstSnapshot ifFalse: [ ... ] ]
>
>
>
>> Stef
>>
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>


Reply | Threaded
Open this post in threaded view
|

Re: how to know if an image is resuming or not

Stéphane Ducasse
In reply to this post by Stéphane Ducasse
Issue 3222: saveSession should return its resuming state

saveSession
        ^ self snapshot: true andQuit: false

Else we lose the resuming status....


> On 9 November 2010 09:58, Stéphane Ducasse <[hidden email]> wrote:
>>>>
>>> what about using some variable, like:
>>>
>>> RunTests := true.
>>> self saveimage.
>>> RunTests := false.
>>> self saveImage.
>>>
>>> and then in startUp:
>>>
>>> startUp: resuming
>>>
>>> ( resuming and: [ RunTests] ) ifTrue: [ self runTests ]
>>>
>>
>> but my code is executed when a menu is selected. So the interaction with startUp: is not really good.
>>
>
> snapshot: save andQuit: quit embedded: embeddedFlag
>
> answers the resuming flag.
>
> So, you can use it like:
>
> | resumedInFirstSnapshot |
> resumedInFirstSnapshot := false.
>
> "first save"
> (Smalltalk snapshot: save andQuit: false) ifTrue: [ ... "resuming here
> " resumedInFirstSnapshot  := true ]
> "second save"
> (Smalltalk snapshot: save andQuit: false) ifTrue: [ ... "resuming here
> " resumedInFirstSnapshot ifFalse: [ ... ] ]
>
>
>
>> Stef
>>
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>