Skip to content

Commit

Permalink
Menu content tab: Fix clipped description and missing depends (#7703)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker authored and paramat committed Sep 7, 2018
1 parent a4f41e7 commit 6ed9c6f
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions builtin/mainmenu/tab_content.lua
Expand Up @@ -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 ..
Expand All @@ -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
Expand Down

0 comments on commit 6ed9c6f

Please sign in to comment.