Hi Lou,
One more thing: http://www.squeaksource.com/ClockAndCalendarMorp
Not sure if there was a name size limitation but I would change that to Morph instead of Morp.
All the best,
Ron
On Wed, Jan 31, 2018 at 11:34 AM, Ron Teitelbaum ron@usmedrec.com wrote:
Hi Lou,
For the Json stuff Herbert is correct. You will need to load a Json reader. On my image I use.
Json readFrom: self readStream. To get a dictionary. You then just read the values from the dictionary.
Some other Json reader might have #readFromString: as Herbert suggested.
For managing the package if it is not loaded I would recommend adding
Smalltalk at: #KscEarthSunAstroData ifPresent: [ <put your draw code here> ].
That way you handle the problem if the dependency is not loaded.
I also had a problem with my image (4.1)
I had to use: Project current fullScreenOn and Project current fullScreenOff.
Also, it is possible to return fraction from your x point calculation which will cause problems: I added asFloat below to fix it.
Form >> drawString: aString centeredIn: rect vOffset: vOffset withFont: font color: color "Display the string centered horizontally in the rectangle with a vertical offset from the top using the font and color." | bb stringExtent f x y rOrigin |
bb := (StringMorph contents: aString font: font) imageForm boundingBox. stringExtent := bb extent. f := Form extent: stringExtent depth: 32. f getCanvas drawString: aString in: (0@0 extent: stringExtent) font: font color: color. rOrigin := rect origin. x := rOrigin x + ((rect width - bb width) / 2) asFloat. y := rOrigin y + vOffset. self getCanvas translucentImage: f at: (x@y).
I also noticed that the time quite large :) I'm seeing: 11:28:35.28400000001 am
Keep up the nice work!
All the best,
Ron
On Tue, Jan 30, 2018 at 7:43 PM, Louis LaBrunda <Lou@keystone-software.com
wrote:
Hi Ron,
Sorry, I forgot to ask, did I get the dependency stuff right?
Lou
On Tue, 30 Jan 2018 15:04:24 -0500, Ron Teitelbaum ron@usmedrec.com wrote:
Hi Lou,
Very cool.
Just for fun, you can get user lat and long from the resulting dictionary by using the following:
(WebClient httpGet: 'http://freegeoip.net/json/', (WebClient httpGet: ' https://api.ipify.org') content) content
:)
All the best,
Ron
On Tue, Jan 30, 2018 at 2:40 PM, Louis LaBrunda <
Lou@keystone-software.com>
wrote:
Hi,
I have created and uploaded my ClockAndCalendarMorphs project on SqueakSource. It depends upon another of my projects, KscAstroDataApp. KscAstroDataApp is used to calculate sunrise and sunset times displayed on the clock and calendar. Latitude and
longitude
are required for the sunrise and sunset calculations. If you don't supply them, no attempt will be made to do the calculations. In that case the KscAstroDataApp package should not be needed. Anyway it is probably best to download it too.
I'm new to SqueakSource and I'm not sure I defined the dependency correctly. If not, I will fix it. Please let me know if you have any problems. The code below
will
get you started testing/playing with the clock morph. The latitude & longitude are
for my
location.
The #initialize method of ClockImageMorph has a lot of comments about
the
options of the clock.
Have fun.
Lou
| c |
" c := ClockImageMorph clockFace: 'path2picture.jpg'." c := ClockImageMorph new. " c setTestMode." c desiredExtent: 1200@800. c setIncludeCalendar. c latitude: 40.66296 longitude: -74.535398. " c beTwentyFourHourClock." c setUseArabicNumerals. " c setUseRomanNumerals." c setAddCirclesAndTicks. " c setUseFancyHourHand. c setUseFancyMinuteHand. c setUseFancySecondHand." " c beFullScreen." c setShowDateTimeInfo. c numberColor: Color blue; circleColor: Color blue; tickColor: Color blue. c hourHandColor: Color blue; minuteHandColor: Color blue; secondHandColor: Color blue. c calendarTextColor: Color blue. c open. -- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon
-- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon