Add setting to remove the 'Today' button
parent
94f710c014
commit
c989105bab
2
API.md
2
API.md
|
@ -127,6 +127,8 @@ get a tooltip.
|
||||||
* `"full"`: Can change year and month (default)
|
* `"full"`: Can change year and month (default)
|
||||||
* `"months"`: Can change month only
|
* `"months"`: Can change month only
|
||||||
* `"none"`: Can't change anything
|
* `"none"`: Can't change anything
|
||||||
|
* `today_button`: Whether to show the 'Today' button (default: `true`)
|
||||||
|
Note: If `changable=="none"`, the 'Today' button is never shown
|
||||||
* `wanted_months`: Which cardinal calendar month to show (default: current one)
|
* `wanted_months`: Which cardinal calendar month to show (default: current one)
|
||||||
* `wanted_years`: Which cardinal calendar year to show (default: current one)
|
* `wanted_years`: Which cardinal calendar year to show (default: current one)
|
||||||
* `caption_format`: Optional format information to change the calendar caption.
|
* `caption_format`: Optional format information to change the calendar caption.
|
||||||
|
|
4
gui.lua
4
gui.lua
|
@ -14,6 +14,7 @@ SHOW_WEEKDAYS = true
|
||||||
SHOW_TODAY = true
|
SHOW_TODAY = true
|
||||||
SHOWHOLIDAYS = true
|
SHOWHOLIDAYS = true
|
||||||
CHANGABLE = "full"
|
CHANGABLE = "full"
|
||||||
|
TODAY_BUTTON = true
|
||||||
|
|
||||||
local DEFAULT_SETTINGS = {
|
local DEFAULT_SETTINGS = {
|
||||||
ordinal = ORDINAL,
|
ordinal = ORDINAL,
|
||||||
|
@ -21,6 +22,7 @@ local DEFAULT_SETTINGS = {
|
||||||
show_today = SHOW_TODAY,
|
show_today = SHOW_TODAY,
|
||||||
show_holidays = SHOW_HOLIDAYS,
|
show_holidays = SHOW_HOLIDAYS,
|
||||||
changable = CHANGABLE,
|
changable = CHANGABLE,
|
||||||
|
today_button = TODAY_BUTTON,
|
||||||
}
|
}
|
||||||
|
|
||||||
local SHOW_AREA_TOOLTIPS = minetest.features.formspec_version_element
|
local SHOW_AREA_TOOLTIPS = minetest.features.formspec_version_element
|
||||||
|
@ -154,7 +156,9 @@ function calendar.show_calendar(player_name, settings, wanted_months, wanted_yea
|
||||||
.. "tooltip[prev_year;"..F(S("Previous year")).."]"
|
.. "tooltip[prev_year;"..F(S("Previous year")).."]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if settings.today_button then
|
||||||
formspec = formspec .. "button[2.5,"..y..";2,1;today;"..F(S("Today")).."]"
|
formspec = formspec .. "button[2.5,"..y..";2,1;today;"..F(S("Today")).."]"
|
||||||
|
end
|
||||||
|
|
||||||
if chg_months and wanted_months < calendar.MONTHS - 1 then
|
if chg_months and wanted_months < calendar.MONTHS - 1 then
|
||||||
formspec = formspec .. "button[4.5,"..y..";1,1;next_month;>]"
|
formspec = formspec .. "button[4.5,"..y..";1,1;next_month;>]"
|
||||||
|
|
Loading…
Reference in New Issue