Autowarmth: wording, help_text, menu tweaks (#8338)

pull/8350/head
zwim 3 years ago committed by GitHub
parent d652eec2cd
commit 6492583e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -352,15 +352,19 @@ function AutoWarmth:getSubMenuItems()
}, },
{ {
text = _("Location settings"), text = _("Location settings"),
enabled_func = function() return self.activate ~= activate_schedule end,
sub_item_table = self:getLocationMenu(), sub_item_table = self:getLocationMenu(),
}, },
{ {
text = _("Schedule settings"), text = _("Time schedule settings"),
enabled_func = function() return self.activate ~= activate_sun end, enabled_func = function()
return self.activate ~= activate_sun and self.activate ~=0
end,
sub_item_table = self:getScheduleMenu(), sub_item_table = self:getScheduleMenu(),
}, },
{ {
enabled_func = function()
return self.activate ~=0
end,
text = Device:hasNaturalLight() and _("Warmth and night mode settings") text = Device:hasNaturalLight() and _("Warmth and night mode settings")
or _("Night mode settings"), or _("Night mode settings"),
sub_item_table = self:getWarmthMenu(), sub_item_table = self:getWarmthMenu(),
@ -368,14 +372,15 @@ function AutoWarmth:getSubMenuItems()
}, },
self:getTimesMenu(_("Active parameters")), self:getTimesMenu(_("Active parameters")),
self:getTimesMenu(_("Information about the sun in"), true, activate_sun), self:getTimesMenu(_("Information about the sun in"), true, activate_sun),
self:getTimesMenu(_("Information about the schedule"), false, activate_schedule), self:getTimesMenu(_("Information about the time schedule"), false, activate_schedule),
} }
end end
function AutoWarmth:getActivateMenu() function AutoWarmth:getActivateMenu()
local function getActivateMenuEntry(text, activator) local function getActivateMenuEntry(text, help_text, activator)
return { return {
text = text, text = text,
help_text = help_text,
checked_func = function() return self.activate == activator end, checked_func = function() return self.activate == activator end,
callback = function() callback = function()
if self.activate ~= activator then if self.activate ~= activator then
@ -390,10 +395,18 @@ function AutoWarmth:getActivateMenu()
end end
return { return {
getActivateMenuEntry(_("Sun position"), activate_sun), getActivateMenuEntry(_("Sun position"),
getActivateMenuEntry(_("Time schedule"), activate_schedule), _("Only use the times calculated from the position of the sun."),
getActivateMenuEntry(_("Whatever is closer to noon"), activate_closer_noon), activate_sun),
getActivateMenuEntry(_("Whatever is closer to midnight"), activate_closer_midnight), getActivateMenuEntry(_("Time schedule"),
_("Only use the times from the schedule."),
activate_schedule),
getActivateMenuEntry(_("Whatever is closer to noon"),
_("Use the times from the sun position or schedule that are closer to noon."),
activate_closer_noon),
getActivateMenuEntry(_("Whatever is closer to midnight"),
_("Use the times from the sun position or schedule that are closer to midnight."),
activate_closer_midnight),
} }
end end
@ -851,6 +864,11 @@ end
-- activate_schedule .. scheduler times -- activate_schedule .. scheduler times
function AutoWarmth:getTimesMenu(title, location, activator) function AutoWarmth:getTimesMenu(title, location, activator)
return { return {
enabled_func = function()
-- always show sun position times so you can see ephemeris
return self.activate ~= 0 and (self.activate ~= activate_sun or activator == nil)
or activator == activate_sun
end,
text_func = function() text_func = function()
if location then if location then
return title .. " " .. self:getLocationString() return title .. " " .. self:getLocationString()

Loading…
Cancel
Save