HI Lou,
Don't feel bad. I'm not sure I understand how dependencies work either! There are a few things you can do like pre and post load scripts in Monticello that I use. You should understand how those work. You can right-click on a package in Monticello and "add required packages" but I'm not sure how that works.
When I try to load your code I get this:
This package depends on the following classes: RotaryDialMorph You must resolve these dependencies before you will be able to load these definitions:
That was very helpful for me to find the other repository that was required.
I don't see your other class but that is because it's not a superclass of other code.
The best way is to have good documentation in multiple locations so that people understand the feature is available.
Monticello also has Monticello Configurations which are very useful! That allows you to add multiple repositories and package versions into one package that is easy to load. I use that to keep track of specific versions of packages that make an application. You could commit one of those into your repository to let people know there is another repository available you can use to add features.
Maybe someone can help explain how "add required packages" is used or what it does.
All the best,
Ron
On Wed, Jan 31, 2018 at 4:42 PM, Louis LaBrunda Lou@keystone-software.com wrote:
Hi Ron and Everyone,
Thank you all for your comments and help. It seems there is a project name size limitation that I didn't notice when I first created the project. So I removed the project named "ClockAndCalendarMorp" and created a new one called "ClockCalendarMorphs". The old project is still listed and I'm not sure how to get rid of it?
I made a few changes. The latest version is ClockAndCalendarMorphs-LL.3.mcz.
I fixed a bug or two that Ron pointed out, thanks Ron. If latitude or longitude are not supplied I try to use Ron's web access to get them. I used the JSON package Tim said he uses (I found it before I saw his post, so I got lucky). I wrapped that code to trap and ignore errors. I changed the calendar header where the date/time/sunrise/sunset info is displayed. It's a little taller, shows seconds on sunrise and sunset (not really needed but why not) and uses 24 hour or AM/PM. I made the simple clock handles a little easier to tell apart.
I didn't add any dependencies as I'm still confused as to how that works.
Lou
On Wed, 31 Jan 2018 12:11:33 -0500, Ron Teitelbaum ron@usmedrec.com wrote:
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
-- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon