forked from Mirrorlandia_minetest/minetest
dlg_contentstore.lua: Various fixes and improvements (#7612)
Add missing 'core.formspec_escape' to 'get_screenshot'. Add warning label when no packages fetched. Internal name of the "Update" button was the same as "Install". Rename to 'update_'.
This commit is contained in:
parent
85b01eacd2
commit
657a3d1e05
@ -356,21 +356,29 @@ function store.get_formspec()
|
|||||||
cur_page = 1
|
cur_page = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local formspec = {
|
local formspec
|
||||||
|
if #store.packages ~= 0 then
|
||||||
|
formspec = {
|
||||||
"size[12,7;true]",
|
"size[12,7;true]",
|
||||||
"position[0.5,0.55]",
|
"position[0.5,0.55]",
|
||||||
"field[0.2,0.1;7.8,1;search_string;;", core.formspec_escape(search_string), "]",
|
"field[0.2,0.1;7.8,1;search_string;;",
|
||||||
|
core.formspec_escape(search_string), "]",
|
||||||
"field_close_on_enter[search_string;false]",
|
"field_close_on_enter[search_string;false]",
|
||||||
"button[7.7,-0.2;2,1;search;", fgettext("Search"), "]",
|
"button[7.7,-0.2;2,1;search;",
|
||||||
|
fgettext("Search"), "]",
|
||||||
"dropdown[9.7,-0.1;2.4;type;",
|
"dropdown[9.7,-0.1;2.4;type;",
|
||||||
table.concat(filter_types_titles, ","),
|
table.concat(filter_types_titles, ","),
|
||||||
";",
|
";", filter_type, "]",
|
||||||
filter_type,
|
|
||||||
"]",
|
|
||||||
-- "textlist[0,1;2.4,5.6;a;",
|
-- "textlist[0,1;2.4,5.6;a;",
|
||||||
-- table.concat(taglist, ","),
|
-- table.concat(taglist, ","), "]",
|
||||||
-- "]"
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
formspec = {
|
||||||
|
"size[12,7;true]",
|
||||||
|
"position[0.5,0.55]",
|
||||||
|
"label[4,3;No packages could be retrieved]",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
local start_idx = (cur_page - 1) * num_per_page + 1
|
local start_idx = (cur_page - 1) * num_per_page + 1
|
||||||
for i=start_idx, math.min(#store.packages, start_idx+num_per_page-1) do
|
for i=start_idx, math.min(#store.packages, start_idx+num_per_page-1) do
|
||||||
@ -381,7 +389,7 @@ function store.get_formspec()
|
|||||||
|
|
||||||
-- image
|
-- image
|
||||||
formspec[#formspec + 1] = "image[-0.4,0;1.5,1;"
|
formspec[#formspec + 1] = "image[-0.4,0;1.5,1;"
|
||||||
formspec[#formspec + 1] = get_screenshot(package)
|
formspec[#formspec + 1] = core.formspec_escape(get_screenshot(package))
|
||||||
formspec[#formspec + 1] = "]"
|
formspec[#formspec + 1] = "]"
|
||||||
|
|
||||||
-- title
|
-- title
|
||||||
@ -404,7 +412,7 @@ function store.get_formspec()
|
|||||||
formspec[#formspec + 1] = fgettext("Install")
|
formspec[#formspec + 1] = fgettext("Install")
|
||||||
formspec[#formspec + 1] = "]"
|
formspec[#formspec + 1] = "]"
|
||||||
elseif package.installed_release < package.release then
|
elseif package.installed_release < package.release then
|
||||||
formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_"
|
formspec[#formspec + 1] = "button[8.4,0;1.5,1;update_"
|
||||||
formspec[#formspec + 1] = tostring(i)
|
formspec[#formspec + 1] = tostring(i)
|
||||||
formspec[#formspec + 1] = ";"
|
formspec[#formspec + 1] = ";"
|
||||||
formspec[#formspec + 1] = fgettext("Update")
|
formspec[#formspec + 1] = fgettext("Update")
|
||||||
|
Loading…
Reference in New Issue
Block a user