Squeak clock face

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

Squeak clock face

Louis LaBrunda
Hi,

I'm toying with the idea of making a clock program in Squeak to run on a Raspberry Pi Zero W. I
would like to have a full screen display of the face of the clock sans hands and have the hands
display over the clock face and move with the time.  Can someone please point me in the right
direction as to Squeak objects to define and control the display.

I will probably use Seaside to allow web access to the settings of the program.  Things like
timezone and maybe replacement clock faces and hands.

Lou
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

Bob Arning-2

There once was a WatchMorph

then in 2013 it was removed


"These classes don't seem to be used, so unload them. They always can be loaded later."

(MCPackage named: 'Morphic-CandidatesForGo') unload .


On 12/11/17 11:18 AM, Louis LaBrunda wrote:
Hi,

I'm toying with the idea of making a clock program in Squeak to run on a Raspberry Pi Zero W. I
would like to have a full screen display of the face of the clock sans hands and have the hands
display over the clock face and move with the time.  Can someone please point me in the right
direction as to Squeak objects to define and control the display.

I will probably use Seaside to allow web access to the settings of the program.  Things like
timezone and maybe replacement clock faces and hands.

Lou



Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

Tobias Pape
In reply to this post by Louis LaBrunda
Hi Lou

On 11.12.2017, at 17:18, Louis LaBrunda <[hidden email]> wrote:

Hi,

I'm toying with the idea of making a clock program in Squeak to run on a Raspberry Pi Zero W. I
would like to have a full screen display of the face of the clock sans hands and have the hands
display over the clock face and move with the time.  Can someone please point me in the right
direction as to Squeak objects to define and control the display.


While I cannot give you what you want, I'd just like to point out that the Trunk image actually has
a WatchMorph (see screenshot), maybe you can fiddle something with it?

I will probably use Seaside to allow web access to the settings of the program.  

Cool. Using metacello, it should load in 5.1 and Trunk as well.

Things like
timezone and maybe replacement clock faces and hands.

Best regards
-Tobias




Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

timrowledge
You might like to grab the code that Bob helped me with for the weather station barometer/thermometer gauges.
http://www.squeaksource.com/WeatherStation.html
Oh, wait, the dial stuff is RotaryDialMorph which is in Morphic-Extras-Widgets which ought to be in the trunk image for now.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful random insult:- A gross ignoramus -- 144 times worse than an ordinary ignoramus.



Reply | Threaded
Open this post in threaded view
|

Squeak clock face

Louis LaBrunda
Hi Tim, Bob and Tobias,

Thanks for your replies.

On Mon, 11 Dec 2017 09:33:17 -0800, tim Rowledge <[hidden email]> wrote:

>You might like to grab the code that Bob helped me with for the weather station barometer/thermometer gauges.
>http://www.squeaksource.com/WeatherStation.html
>Oh, wait, the dial stuff is RotaryDialMorph which is in Morphic-Extras-Widgets which ought to be in the trunk image for now.
>tim

The ClockDialMorph looks like what I want.  I may add a second hand if that isn't too hard and
doesn't slow down the display.

The morphs are completely new to me, so is there a simple way I can instantiate a
ClockDialMorph and test/play with it?

Thanks again.

Lou
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

timrowledge

>
> The morphs are completely new to me, so is there a simple way I can instantiate a
> ClockDialMorph and test/play with it?

ClockDialMorph new openInWorld

Right now it doesn’t scale with the halo handles; if anyone wants to improve that it would be nice. Adding a second hand shouldn’t present too many problems (basically add an instvar, make it pretty much a copy of what the hourHandMorph is/does but skinnier, add rotating it a bit to the #setTime: method)


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful random insult:- IQ = dx / (1 + dx), where x = age.



Reply | Threaded
Open this post in threaded view
|

Squeak clock face

Louis LaBrunda
Hi Tim,

>ClockDialMorph new openInWorld
>Right now it doesn’t scale with the halo handles; if anyone wants to improve that it would be nice. Adding a second hand shouldn’t present too many problems (basically add an instvar, make it pretty much a copy of what the hourHandMorph is/does but skinnier, add rotating it a bit to the #setTime: method)
>tim

I did some digging and found openInWorld.  I am working on my own ClockImageMorph where the
face and the three hands will be images read from the disk.  Trying to figure out how to read
the images now.  I want the user to be able to install their own images.  So, I don't want to
have them imbedded in the Squeak image.  I'm trying to learn how to read the graphics into a
morph now.

Lou
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

Hannes Hirzel
f := Form fromFileNamed: aFileName.
"http://wiki.squeak.org/squeak/697"

f asMorph openInWorld

f asMorph class
             ImageMorph

"http://wiki.squeak.org/squeak/6345"

On 12/12/17, Louis LaBrunda <[hidden email]> wrote:

> Hi Tim,
>
>>ClockDialMorph new openInWorld
>>Right now it doesn’t scale with the halo handles; if anyone wants to
>> improve that it would be nice. Adding a second hand shouldn’t present too
>> many problems (basically add an instvar, make it pretty much a copy of
>> what the hourHandMorph is/does but skinnier, add rotating it a bit to the
>> #setTime: method)
>>tim
>
> I did some digging and found openInWorld.  I am working on my own
> ClockImageMorph where the
> face and the three hands will be images read from the disk.  Trying to
> figure out how to read
> the images now.  I want the user to be able to install their own images.
> So, I don't want to
> have them imbedded in the Squeak image.  I'm trying to learn how to read the
> graphics into a
> morph now.
>
> Lou
> --
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

Bert Freudenberg
In reply to this post by timrowledge
On Tue, Dec 12, 2017 at 8:33 PM, tim Rowledge <[hidden email]> wrote:

>
> The morphs are completely new to me, so is there a simple way I can instantiate a
> ClockDialMorph and test/play with it?

ClockDialMorph new openInWorld

​Or, even simpler, just get a sample instance from the System Browser:

Inline image 2

- Bert -



cbc
Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

cbc
In reply to this post by Louis LaBrunda
There are undoubtedly a few ways to handle this (as answered by other folks already). One way to do this is to open the desktop menu (click on background), then open objects(o) menu, choose the 'find' option, and search for clock.  The non-digital clock is the clock face - if you drag it out, you it will be instantiated and ready to play with.

Also, you asked how to read an image into a Morph.  You can just drag the image file onto the Squeak desktop, and it should give you a variety of options, including 'open in a window', which imports it as a SketchMorph visible in Squeak.

-cbc

On Tue, Dec 12, 2017 at 8:52 AM, Louis LaBrunda <[hidden email]> wrote:
Hi Tim, Bob and Tobias,

Thanks for your replies.

On Mon, 11 Dec 2017 09:33:17 -0800, tim Rowledge <[hidden email]> wrote:

>You might like to grab the code that Bob helped me with for the weather station barometer/thermometer gauges.
>http://www.squeaksource.com/WeatherStation.html
>Oh, wait, the dial stuff is RotaryDialMorph which is in Morphic-Extras-Widgets which ought to be in the trunk image for now.
>tim

The ClockDialMorph looks like what I want.  I may add a second hand if that isn't too hard and
doesn't slow down the display.

The morphs are completely new to me, so is there a simple way I can instantiate a
ClockDialMorph and test/play with it?

Thanks again.

Lou
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe <a href="callto://PhotonDemon" target="_blank">callto://PhotonDemon





Reply | Threaded
Open this post in threaded view
|

Squeak clock face

Louis LaBrunda
In reply to this post by Hannes Hirzel
Hi Everyone,

Thanks for all the help so far.  I'm able to read/load a picture from disk to use as the clock
face.  For now I'm making the hands in much the same way they are made in ClockDialMorph.  I
will replace that with pictures read in the same way the clock face is read.  I'm having some
trouble with the way the hands rotate around their origin/corner point.  I vaguely remember an
old discussion about this kind of thing.  I will search for any info I can find on that.  I
need to solve this because the user will need to specify a point on the hands that they rotate
around and I will need to use that point.

Lou

On Tue, 12 Dec 2017 21:37:56 +0100, "H. Hirzel" <[hidden email]> wrote:

>f := Form fromFileNamed: aFileName.
>"http://wiki.squeak.org/squeak/697"
>
>f asMorph openInWorld
>
>f asMorph class
>             ImageMorph
>
>"http://wiki.squeak.org/squeak/6345"
>
>On 12/12/17, Louis LaBrunda <[hidden email]> wrote:
>> Hi Tim,
>>
>>>ClockDialMorph new openInWorld
>>>Right now it doesn’t scale with the halo handles; if anyone wants to
>>> improve that it would be nice. Adding a second hand shouldn’t present too
>>> many problems (basically add an instvar, make it pretty much a copy of
>>> what the hourHandMorph is/does but skinnier, add rotating it a bit to the
>>> #setTime: method)
>>>tim
>>
>> I did some digging and found openInWorld.  I am working on my own
>> ClockImageMorph where the
>> face and the three hands will be images read from the disk.  Trying to
>> figure out how to read
>> the images now.  I want the user to be able to install their own images.
>> So, I don't want to
>> have them imbedded in the Squeak image.  I'm trying to learn how to read the
>> graphics into a
>> morph now.
>>
>> Lou
>> --
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>>
>>
>>
>
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Squeak clock face

Louis LaBrunda
In reply to this post by Hannes Hirzel
Hi Guys,

Thanks to all your help I am well past reading in images and using them as clock faces and
clock hands.  BUT I am having trouble rotating things around a point in the middle of a clock
hand.  Either I don't understand what I'm doing (which is most likely) or something is wrong.

While trying to understand what happens when a morph is rotated, I have looked at the position
of things.  Positions seems to be based on the real screen and not where things are within
another morph.  Is it possible to find out where a morph is within its parent?

Lou


On Tue, 12 Dec 2017 21:37:56 +0100, "H. Hirzel" <[hidden email]> wrote:

>f := Form fromFileNamed: aFileName.
>"http://wiki.squeak.org/squeak/697"
>
>f asMorph openInWorld
>
>f asMorph class
>             ImageMorph
>
>"http://wiki.squeak.org/squeak/6345"
>
>On 12/12/17, Louis LaBrunda <[hidden email]> wrote:
>> Hi Tim,
>>
>>>ClockDialMorph new openInWorld
>>>Right now it doesn’t scale with the halo handles; if anyone wants to
>>> improve that it would be nice. Adding a second hand shouldn’t present too
>>> many problems (basically add an instvar, make it pretty much a copy of
>>> what the hourHandMorph is/does but skinnier, add rotating it a bit to the
>>> #setTime: method)
>>>tim
>>
>> I did some digging and found openInWorld.  I am working on my own
>> ClockImageMorph where the
>> face and the three hands will be images read from the disk.  Trying to
>> figure out how to read
>> the images now.  I want the user to be able to install their own images.
>> So, I don't want to
>> have them imbedded in the Squeak image.  I'm trying to learn how to read the
>> graphics into a
>> morph now.
>>
>> Lou
>> --
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>>
>>
>>
>
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

Bob Arning-2

self position - owner position


On 12/15/17 4:00 PM, Louis LaBrunda wrote:
Is it possible to find out where a morph is within its parent?



Reply | Threaded
Open this post in threaded view
|

Squeak clock face

Louis LaBrunda
Hi Bob,

Thanks for the help.  But owner position is always 0@0.  Maybe I should try to ask a big
picture question.  I have sub-classed RotaryDialMorph similar to Tim's ClockDialMorph.  Tim has
the hands (minute and hour) rotate around one of their ends.  I'm trying to get them to rotate
around a point say 20 pixels in from that end.  How should I do this?

Lou


On Fri, 15 Dec 2017 16:08:41 -0500, Bob Arning <[hidden email]> wrote:

>self position - owner position
>
>
>On 12/15/17 4:00 PM, Louis LaBrunda wrote:
>> Is it possible to find out where a morph is within its parent?
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

timrowledge
In reply to this post by Bob Arning-2
Take a look at ClockDialMorph>>initialize and how that needle is created, positioned, and wrapped with a transformationmorph - which is in turn positioned.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Change is inevitable....except from vending machines.



Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

Javier Diaz-Reinoso
In reply to this post by Louis LaBrunda
Use Morph>>rotationCenter:

> On 15 Dec 2017, at 17:01, Louis LaBrunda <[hidden email]> wrote:
>
> Hi Bob,
>
> Thanks for the help.  But owner position is always 0@0.  Maybe I should try to ask a big
> picture question.  I have sub-classed RotaryDialMorph similar to Tim's ClockDialMorph.  Tim has
> the hands (minute and hour) rotate around one of their ends.  I'm trying to get them to rotate
> around a point say 20 pixels in from that end.  How should I do this?
>
> Lou
>
>
> On Fri, 15 Dec 2017 16:08:41 -0500, Bob Arning <[hidden email]> wrote:
>
>> self position - owner position
>>
>>
>> On 12/15/17 4:00 PM, Louis LaBrunda wrote:
>>> Is it possible to find out where a morph is within its parent?
> --
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

timrowledge
In reply to this post by Louis LaBrunda

> On 15-12-2017, at 2:01 PM, Louis LaBrunda <[hidden email]> wrote:
>  I have sub-classed RotaryDialMorph similar to Tim's ClockDialMorph.  Tim has
> the hands (minute and hour) rotate around one of their ends.  I'm trying to get them to rotate
> around a point say 20 pixels in from that end.  How should I do this?

Take a look also at Barometer (etc) morph>>initialize to see how the fancy needle is created and positioned


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Spell checkers at maximum!  Fire!



Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

timrowledge
In reply to this post by Javier Diaz-Reinoso

> On 15-12-2017, at 2:32 PM, Javier Diaz-Reinoso <[hidden email]> wrote:
>
> Use Morph>>rotationCenter:

Unfortunately back in April of this year we pretty much established that the rotationCenter stuff was broken and had been for a looooooooooooooooooooooooong time.

Look for messages with subject 'MatrixTransformMorph appears to be as broken as a very broken thing'


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful random insult:- A titanic intellect...  In a world full of icebergs.



Reply | Threaded
Open this post in threaded view
|

Re: Squeak clock face

Javier Diaz-Reinoso
Well, I think is for eToys Players and in that works well, to test use this in workspace:

attrs := {{100 . Color red . 0.5@0.5} . {200 . Color blue . 0.25@0.25}}..
hands := attrs collect: [:att| |lm|
        lm := LineMorph from: 150@300 to: (Point x: 150+(att at:1) y: 300) color: (att at: 2) width: 2.
        lm rotationCenter: (att at: 3).
        lm makeForwardArrow].
hands do: [:m | m openInWorld].

and then create 2 (eToy) scripts to rotate, I am enclosing a movie (344kb), I hope is not rejected:



> On 15 Dec 2017, at 18:09, tim Rowledge <[hidden email]> wrote:
>
>
>> On 15-12-2017, at 2:32 PM, Javier Diaz-Reinoso <[hidden email]> wrote:
>>
>> Use Morph>>rotationCenter:
>
> Unfortunately back in April of this year we pretty much established that the rotationCenter stuff was broken and had been for a looooooooooooooooooooooooong time.
>
> Look for messages with subject 'MatrixTransformMorph appears to be as broken as a very broken thing'
>
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Useful random insult:- A titanic intellect...  In a world full of icebergs.
>
>
>



hands.mp4 (457K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Squeak clock face

Louis LaBrunda
In reply to this post by timrowledge
Hi Tim,

Can you please explain what this does:

        pointerMorph position: pointerMorph extent * ( -0.5@ -0.65).

especially what does "* ( -0.5@ -0.65)" do and why and what do -0.5 and -0.65 relate to?

Thanks.

Lou

On Fri, 15 Dec 2017 14:33:34 -0800, tim Rowledge <[hidden email]> wrote:

>
>> On 15-12-2017, at 2:01 PM, Louis LaBrunda <[hidden email]> wrote:
>>  I have sub-classed RotaryDialMorph similar to Tim's ClockDialMorph.  Tim has
>> the hands (minute and hour) rotate around one of their ends.  I'm trying to get them to rotate
>> around a point say 20 pixels in from that end.  How should I do this?
>
>Take a look also at Barometer (etc) morph>>initialize to see how the fancy needle is created and positioned
>
>
>tim
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


12