Menu content tab: Fix clipped description and missing depends (#7703)

master
SmallJoker 2018-09-07 03:46:58 +02:00 committed by Paramat
parent a4f41e7bfc
commit 6ed9c6fb3a
1 changed files with 21 additions and 24 deletions

View File

@ -81,50 +81,45 @@ local function get_formspec(tabview, name, tabdata)
modscreenshot = defaulttexturedir .. "no_screenshot.png"
end
local info = core.get_content_info(selected_pkg.path)
local desc = fgettext("No package description available")
if info.description and info.description:trim() ~= "" then
desc = info.description
end
retval = retval ..
"image[5.5,0;3,2;" .. core.formspec_escape(modscreenshot) .. "]" ..
"label[8.25,0.6;" .. core.formspec_escape(selected_pkg.name) .. "]" ..
"label[5.5,1.7;".. fgettext("Information:") .. "]" ..
"textlist[5.5,2.2;6.2,2.4;description;"
local info = core.get_content_info(selected_pkg.path)
local desc = info.description or fgettext("No package description available")
local descriptionlines = core.wrap_text(desc, 42, true)
for i = 1, #descriptionlines do
retval = retval .. core.formspec_escape(descriptionlines[i]) .. ","
end
"box[5.5,2.2;6.15,2.35;#000]"
if selected_pkg.type == "mod" then
if selected_pkg.is_modpack then
retval = retval .. ";0]" ..
retval = retval ..
"button[8.65,4.65;3.25,1;btn_mod_mgr_rename_modpack;" ..
fgettext("Rename") .. "]"
else
--show dependencies
local toadd_hard = table.concat(info.depends or {}, ",")
local toadd_soft = table.concat(info.optional_depends or {}, ",")
desc = desc .. "\n\n"
local toadd_hard = table.concat(info.depends or {}, "\n")
local toadd_soft = table.concat(info.optional_depends or {}, "\n")
if toadd_hard == "" and toadd_soft == "" then
retval = retval .. "," .. fgettext("No dependencies.")
desc = desc .. fgettext("No dependencies.")
else
if toadd_hard ~= "" then
retval = retval .. "," .. fgettext("Dependencies:") .. ","
retval = retval .. toadd_hard
desc = desc ..fgettext("Dependencies:") ..
"\n" .. toadd_hard
end
if toadd_soft ~= "" then
if toadd_hard ~= "" then
retval = retval .. ","
desc = desc .. "\n\n"
end
retval = retval .. "," .. fgettext("Optional dependencies:") .. ","
retval = retval .. toadd_soft
desc = desc .. fgettext("Optional dependencies:") ..
"\n" .. toadd_soft
end
end
retval = retval .. ";0]"
end
else
retval = retval .. ";0]"
if selected_pkg.type == "txp" then
if selected_pkg.enabled then
retval = retval ..
@ -138,8 +133,10 @@ local function get_formspec(tabview, name, tabdata)
end
end
retval = retval .. "button[5.5,4.65;3.25,1;btn_mod_mgr_delete_mod;"
.. fgettext("Uninstall Package") .. "]"
retval = retval .. "textarea[5.85,2.2;6.35,2.9;;" ..
fgettext("Information:") .. ";" .. desc .. "]" ..
"button[5.5,4.65;3.25,1;btn_mod_mgr_delete_mod;" ..
fgettext("Uninstall Package") .. "]"
end
return retval
end