Skip to content

Commit

Permalink
update a bunch of styling for Today scene
Browse files Browse the repository at this point in the history
  • Loading branch information
rorpage committed Jun 7, 2019
1 parent 614d27d commit 12340f5
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 74 deletions.
46 changes: 27 additions & 19 deletions components/TodayScene.brs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ sub OnWasShown()
m.park_ids = [ "mk", "ep", "hs", "ak", "ds", "tl", "bb" ]

m.light_font = CreateObject("roSGNode", "Font")
m.light_font.uri = "pkg:/components/fonts/avenir_45_book_latin.ttf"
m.light_font.size = 26
m.light_font.uri = "pkg:/components/fonts/avenir_35_light_latin.ttf"
m.light_font.size = 60

m.book_font = CreateObject("roSGNode", "Font")
m.book_font.uri = "pkg:/components/fonts/avenir_45_book_latin.ttf"
m.book_font.size = 24

setUpLabels()

Expand All @@ -29,33 +33,33 @@ end sub
sub setUpLabels()
m.park_image = m.top.findNode("park_image")
m.name = m.top.findNode("name")

m.todaysHours = m.top.findNode("todaysHours")
m.todaysHours.font = m.light_font

m.todaysHoursLabel = m.top.findNode("todaysHoursLabel")
m.todaysHoursLabel.font = m.light_font

m.day_of_the_week = m.top.findNode("day_of_the_week")
m.day_of_the_week.font = m.light_font
m.day_of_the_week.font = m.book_font

m.month_day = m.top.findNode("month_day")
m.month_day.font = m.light_font
m.month_day.font = m.book_font

m.time = m.top.findNode("time")

m.weather = m.top.findNode("weather")
m.weather.font = m.light_font
m.weather.font = m.book_font
m.weather_icon = m.top.findNode("weather_icon")

m.mk_hours = m.top.findNode("mk_hours")
m.mk_hours.font = m.light_font
m.mk_hours.font = m.book_font
m.ep_hours = m.top.findNode("ep_hours")
m.ep_hours.font = m.light_font
m.ep_hours.font = m.book_font
m.hs_hours = m.top.findNode("hs_hours")
m.hs_hours.font = m.light_font
m.hs_hours.font = m.book_font
m.ak_hours = m.top.findNode("ak_hours")
m.ak_hours.font = m.light_font
m.ds_hours = m.top.findNode("ds_hours")
m.ds_hours.font = m.light_font
m.tl_hours = m.top.findNode("tl_hours")
m.tl_hours.font = m.light_font
m.bb_hours = m.top.findNode("bb_hours")
m.bb_hours.font = m.light_font
m.ak_hours.font = m.book_font
end sub

sub buildTasks()
Expand Down Expand Up @@ -119,16 +123,20 @@ sub onParksChanged()
m.ep_hours.text = m.parks["ep"].todaysHours
m.hs_hours.text = m.parks["hs"].todaysHours
m.ak_hours.text = m.parks["ak"].todaysHours
m.ds_hours.text = m.parks["ds"].todaysHours
m.tl_hours.text = m.parks["tl"].todaysHours
m.bb_hours.text = m.parks["bb"].todaysHours

updatePark()
end sub

sub onWeatherChanged()
m.weather_info = m.WeatherTask.weather_info["weather"]
m.weather.text = Substitute("Currently {0}°F ({1}°C) and {2}", m.weather_info.currently_temperature_f.ToStr(), m.weather_info.currently_temperature_c.ToStr(), LCase(m.weather_info.currently_summary))
fahrenheit = m.weather_info.currently_temperature_f.ToStr()
celsius = m.weather_info.currently_temperature_c.ToStr()

unformatted_summary = m.weather_info.currently_summary
summary = Left(unformatted_summary, 1) + LCase(Right(unformatted_summary, Len(unformatted_summary) - 1))

m.weather.text = fahrenheit + "°F (" + celsius + "°C)" + chr(10) + summary
m.weather_icon.uri = Substitute("https://darksky.net/images/weather-icons/{0}.png", m.weather_info.currently_icon)
end sub

sub onDateTimeChanged()
Expand Down
94 changes: 40 additions & 54 deletions components/TodayScene.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
width="1920"
translation="[0, 0]" />
</Group>
<Group id="background_overlay">
<Rectangle color="0x00000055" width="1520" height="1080" />
</Group>
<Group id="park_info" translation="[100, 100]">
<Label id="name" translation="[0, 0]" color="0xFFFFFFFF">
<Font
Expand All @@ -19,105 +22,88 @@
size="100"
/>
</Label>
<Label id="todaysHoursLabel" text="&#xe855;" translation="[0, 120]" color="0xFFFFFFFF">
<Label id="todaysHoursIcon" text="&#xe855;" translation="[0, 135]" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/MaterialIcons-Regular.ttf"
id="materialicons-regular"
size="60"
/>
</Label>
<Label id="todaysHoursLabel" text="Today's Park Hours" translation="[80, 130]" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/avenirltstd-light-webfont.ttf"
id="avenir-light"
size="60"
/>
</Label>
<Label id="todaysHours" translation="[0, 200]" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/avenirltstd-light-webfont.ttf"
id="avenir-light"
size="60"
/>
</Label>
<Label id="todaysHoursLabel" text="Today's Park Hours" translation="[80, 130]" color="0xFFFFFFFF" />
<Label id="todaysHours" translation="[0, 200]" color="0xFFFFFFFF" />
</Group>
<Group id="sidebar">
<Rectangle
id="sidebar_rectangle"
color="0x0088FFAB"
width="500"
color="0x224471DD"
width="400"
height="1080"
translation="[1420, 0]">
<LayoutGroup itemSpacings="[0, 20]">
<Label id="day_of_the_week" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="month_day" width="450" wrap="true" color="0xFFFFFFFF" />
translation="[1520, 0]">
<LayoutGroup itemSpacings="[0, 20]" translation="[30, 30]">
<Label id="day_of_the_week" width="450" wrap="true" color="0x8EB3DEFF" />
<Label id="month_day" width="450" wrap="true" color="0x80A9D3FF" />
<Label id="time" width="450" wrap="true" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/avenir_85_heavy_latin.ttf"
size="40"
uri="pkg:/components/fonts/avenirltstd-light-webfont.ttf"
id="avenir-light"
size="60"
/>
</Label>
<Label id="weather" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="mk_title" text="Magic Kindgom" color="0xFFFFFFFF">
<Label id="weather_label" text="Currently" color="0x8EB3DEFF">
<Font
role="font"
uri="pkg:/components/fonts/avenir_85_heavy_latin.ttf"
size="30"
/>
</Label>
<Label id="mk_hours" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="ep_title" text="Epcot" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/avenir_85_heavy_latin.ttf"
size="30"
uri="pkg:/components/fonts/avenir_35_light_latin.ttf"
id="avenir-light"
size="40"
/>
</Label>
<Label id="ep_hours" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="hs_title" text="Hollywood Studios" color="0xFFFFFFFF">
<Poster id="weather_icon" width="50" height="50" />
<Label id="weather" width="350" wrap="true" color="0xFFFFFFFF" />
<Label id="park_hours_label" text="Park Hours" color="0x8EB3DEFF">
<Font
role="font"
uri="pkg:/components/fonts/avenir_85_heavy_latin.ttf"
size="30"
uri="pkg:/components/fonts/avenir_55_roman_latin.ttf"
id="avenir-light"
size="40"
/>
</Label>
<Label id="hs_hours" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="ak_title" text="Animal Kingdom" color="0xFFFFFFFF">
<Label id="mk_title" text="Magic Kindgom" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/avenir_85_heavy_latin.ttf"
uri="pkg:/components/fonts/avenir_55_roman_latin.ttf"
size="30"
/>
</Label>
<Label id="ak_hours" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="ds_title" text="Disney Springs" color="0xFFFFFFFF">
<Label id="mk_hours" width="350" wrap="true" color="0xFFFFFFFF" />
<Rectangle height="2" width="340" color="0xFFFFFF66" />
<Label id="ep_title" text="Epcot" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/avenir_85_heavy_latin.ttf"
uri="pkg:/components/fonts/avenir_55_roman_latin.ttf"
size="30"
/>
</Label>
<Label id="ds_hours" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="tl_title" text="Typhoon Lagoon" color="0xFFFFFFFF">
<Label id="ep_hours" width="350" wrap="true" color="0xFFFFFFFF" />
<Rectangle height="2" width="340" color="0xFFFFFF66" />
<Label id="hs_title" text="Hollywood Studios" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/avenir_85_heavy_latin.ttf"
uri="pkg:/components/fonts/avenir_55_roman_latin.ttf"
size="30"
/>
</Label>
<Label id="tl_hours" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="bb_title" text="Blizzard Beach" color="0xFFFFFFFF">
<Label id="hs_hours" width="350" wrap="true" color="0xFFFFFFFF" />
<Rectangle height="2" width="340" color="0xFFFFFF66" />
<Label id="ak_title" text="Animal Kingdom" color="0xFFFFFFFF">
<Font
role="font"
uri="pkg:/components/fonts/avenir_85_heavy_latin.ttf"
uri="pkg:/components/fonts/avenir_55_roman_latin.ttf"
size="30"
/>
</Label>
<Label id="bb_hours" width="450" wrap="true" color="0xFFFFFFFF" />
<Label id="ak_hours" width="350" wrap="true" color="0xFFFFFFFF" />
</LayoutGroup>
</Rectangle>
</Group>
Expand Down
2 changes: 1 addition & 1 deletion components/tasks/DateTimeTask.brs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function getCurrentTime(datetime) as string

minutes = datetime.GetMinutes()
minutes_formatted = minutes.ToStr()
if (minutes < 10) then minutes_formatted = Substitute("0{1}", minutes.ToStr())
if (minutes < 10) then minutes_formatted = "0" + minutes.ToStr()

return Substitute("{0}:{1} {2}", current_hour.ToStr(), minutes_formatted, ampm)
end function

0 comments on commit 12340f5

Please sign in to comment.