From 9a64a9fd9427fc3b62d4dc9bf1ca7c15477ebc5a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 29 May 2020 00:52:48 +0100 Subject: [PATCH] Update ContentDB dialog (#9949) --- LICENSE.txt | 6 ++ builtin/mainmenu/dlg_contentstore.lua | 86 ++++++++++++++------------ textures/base/pack/end_icon.png | Bin 0 -> 908 bytes textures/base/pack/next_icon.png | Bin 0 -> 714 bytes textures/base/pack/prev_icon.png | Bin 0 -> 714 bytes textures/base/pack/start_icon.png | Bin 0 -> 912 bytes 6 files changed, 53 insertions(+), 39 deletions(-) create mode 100644 textures/base/pack/end_icon.png create mode 100644 textures/base/pack/next_icon.png create mode 100644 textures/base/pack/prev_icon.png create mode 100644 textures/base/pack/start_icon.png diff --git a/LICENSE.txt b/LICENSE.txt index 994e024c9..f5c51833b 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -21,6 +21,12 @@ ShadowNinja: paramat: textures/base/pack/menu_header.png + textures/base/pack/next_icon.png + textures/base/pack/prev_icon.png + +rubenwardy, paramat: + textures/base/pack/start_icon.png + textures/base/pack/end_icon.png erlehmann: misc/minetest-icon-24x24.png diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 9af16ac86..76c398f5a 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -303,34 +303,35 @@ function store.get_formspec(dlgdata) cur_page = 1 end + local W = 15.75 + local H = 9.5 + local formspec if #store.packages_full > 0 then formspec = { - "size[12,7;true]", + "formspec_version[3]", + "size[15.75,9.5]", "position[0.5,0.55]", - "field[0.2,0.1;7.8,1;search_string;;", - core.formspec_escape(search_string), "]", + "container[0.375,0.375]", + "field[0,0;10.225,0.8;search_string;;", core.formspec_escape(search_string), "]", "field_close_on_enter[search_string;false]", - "button[7.7,-0.2;2,1;search;", - fgettext("Search"), "]", - "dropdown[9.7,-0.1;2.4;type;", - table.concat(filter_types_titles, ","), - ";", filter_type, "]", - -- "textlist[0,1;2.4,5.6;a;", - -- table.concat(taglist, ","), "]", + "button[10.225,0;2,0.8;search;", fgettext("Search"), "]", + "dropdown[12.6,0;2.4,0.8;type;", table.concat(filter_types_titles, ","), ";", filter_type, "]", + "container_end[]", -- Page nav buttons - "container[0,", - num_per_page + 1.5, "]", - "button[-0.1,0;3,1;back;", - fgettext("Back to Main Menu"), "]", - "button[7.1,0;1,1;pstart;<<]", - "button[8.1,0;1,1;pback;<]", - "label[9.2,0.2;", - tonumber(cur_page), " / ", - tonumber(dlgdata.pagemax), "]", - "button[10.1,0;1,1;pnext;>]", - "button[11.1,0;1,1;pend;>>]", + "container[0,", H - 0.8 - 0.375, "]", + "button[0.375,0;4,0.8;back;", fgettext("Back to Main Menu"), "]", + + "container[", W - 0.375 - 0.8*4 - 2, ",0]", + "image_button[0,0;0.8,0.8;", defaulttexturedir, "start_icon.png;pstart;]", + "image_button[0.8,0;0.8,0.8;", defaulttexturedir, "prev_icon.png;pback;]", + "style[pagenum;border=false]", + "button[1.6,0;2,0.8;pagenum;", tonumber(cur_page), " / ", tonumber(dlgdata.pagemax), "]", + "image_button[3.6,0;0.8,0.8;", defaulttexturedir, "next_icon.png;pnext;]", + "image_button[4.4,0;0.8,0.8;", defaulttexturedir, "end_icon.png;pend;]", + "container_end[]", + "container_end[]", } @@ -341,75 +342,82 @@ function store.get_formspec(dlgdata) end else formspec = { - "size[12,7;true]", + "size[12,7]", "position[0.5,0.55]", "label[4,3;", fgettext("No packages could be retrieved"), "]", - "button[-0.1,", - num_per_page + 1.5, - ";3,1;back;", - fgettext("Back to Main Menu"), "]", + "container[0,", H - 0.8 - 0.375, "]", + "button[0,0;4,0.8;back;", fgettext("Back to Main Menu"), "]", + "container_end[]", } end 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 local package = store.packages[i] - formspec[#formspec + 1] = "container[0.5," - formspec[#formspec + 1] = (i - start_idx) * 1.1 + 1 + formspec[#formspec + 1] = "container[0.375," + formspec[#formspec + 1] = (i - start_idx) * 1.375 + (2*0.375 + 0.8) formspec[#formspec + 1] = "]" -- image - formspec[#formspec + 1] = "image[-0.4,0;1.5,1;" + formspec[#formspec + 1] = "image[0,0;1.5,1;" formspec[#formspec + 1] = core.formspec_escape(get_screenshot(package)) formspec[#formspec + 1] = "]" -- title - formspec[#formspec + 1] = "label[1,-0.1;" + formspec[#formspec + 1] = "label[1.875,0.1;" formspec[#formspec + 1] = core.formspec_escape( minetest.colorize(mt_color_green, package.title) .. minetest.colorize("#BFBFBF", " by " .. package.author)) formspec[#formspec + 1] = "]" - local description_width = 7.5 + -- buttons + local description_width = W - 0.375*5 - 1 - 2*1.5 + formspec[#formspec + 1] = "container[" + formspec[#formspec + 1] = W - 0.375*2 + formspec[#formspec + 1] = ",0.1]" + if package.downloading then - formspec[#formspec + 1] = "label[8.4,0.2;" + formspec[#formspec + 1] = "style[download;border=false]" + + formspec[#formspec + 1] = "button[-3.5,0;2,0.8;download;" formspec[#formspec + 1] = fgettext("Downloading...") formspec[#formspec + 1] = "]" elseif not package.path then - formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_" + formspec[#formspec + 1] = "button[-3,0;1.5,0.8;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Install") formspec[#formspec + 1] = "]" else if package.installed_release < package.release then - description_width = 6 + description_width = description_width - 1.5 -- The install_ action also handles updating - formspec[#formspec + 1] = "button[6.9,0;1.5,1;install_" + formspec[#formspec + 1] = "button[-4.5,0;1.5,0.8;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Update") formspec[#formspec + 1] = "]" end - formspec[#formspec + 1] = "button[8.4,0;1.5,1;uninstall_" + formspec[#formspec + 1] = "button[-3,0;1.5,0.8;uninstall_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Uninstall") formspec[#formspec + 1] = "]" end - formspec[#formspec + 1] = "button[9.9,0;1.5,1;view_" + formspec[#formspec + 1] = "button[-1.5,0;1.5,0.8;view_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("View") formspec[#formspec + 1] = "]" + formspec[#formspec + 1] = "container_end[]" -- description - formspec[#formspec + 1] = "textarea[1.25,0.3;" + formspec[#formspec + 1] = "textarea[1.855,0.3;" formspec[#formspec + 1] = tostring(description_width) - formspec[#formspec + 1] = ",1;;;" + formspec[#formspec + 1] = ",0.8;;;" formspec[#formspec + 1] = core.formspec_escape(package.short_description) formspec[#formspec + 1] = "]" diff --git a/textures/base/pack/end_icon.png b/textures/base/pack/end_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4fb4d52a0d19f421424b43478cb3e4d0d710c1b4 GIT binary patch literal 908 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&T@COFaRt)v+_m00B2eMo~fS z6%98wG_dVX>eM~<`(J;`ie-1?efP~wF;1@*E6$rSg>~l~1&$^ds-LJY(zBy&%Fd^~ zn3QQ-1v~2V~&XQF^2y@CeMev#WyyvReX;rPq$!~zSrCWaF^+S~FO&M5*zmikdj6r+9Bezj-8^Y(^i}9L zduMX=+P&N-D=@CL=yx~*LQmNoEdx^2uj iVhWGiCWRvp*sFI2JN@~Y_#T-07(8A5T-G@yGywq89R<$- literal 0 HcmV?d00001 diff --git a/textures/base/pack/next_icon.png b/textures/base/pack/next_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..03f960917cfa90b54f94ae60cba0ce82d202f2e8 GIT binary patch literal 714 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&%?a=caRt)<2P>GYa3KZgKI4)g zzhDMtHg-;KNohF+MI{wg6H_yDOKV%d(8#FhnAo_aoc!*d-Z@K_u2{Kh?bU0y?%aL& z^vB=z>l^1WFfgw2ba4!+xb=3{>#!yVkygPaMw?g9lA5a8db73Rd;RtcN{urghG)OO z8uh!n@$*{a*)tzDJm*ww5pd!F694<+_P-BivfE#=`c8;DfIV zgchiN3~!ivWG_ReXcp5Pm20dTwiz4-RTo4QzAR8}sF%9U^z^dCeFa_~#x0GS4EHAL zFx^nO#j?P23ztH1f;fYe1xtZv3Fm=HFGL(vFX}R!a%^Wfw!oWV(hU?3>Ay%Jba$k&wc+rgO&yHcFP|xpX`}pvzz-aJOCXg+m$V0XjpE-I%t6|TK==D!egbQ~weEWJqDs^s4+rX|0A7uv3@Q*~G!U%P4H)%A8!7hk<+nelZy)0JOK z8Mf~;kIY^1b#M3Yr*k6jTieJN*C%{9JmEKYJ0zTef&FiWe!+)lk9JOaG#41@44$rj JF6*2UngEY&hi?D? literal 0 HcmV?d00001 diff --git a/textures/base/pack/prev_icon.png b/textures/base/pack/prev_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..71509e71a738b351fcb0ec91437e7eaa175308b1 GIT binary patch literal 714 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&%?a=caRt)<2P>GYa3KZgKI4)g zzhDMtHg-;KNohF+MI{wg6H_yDOKV%d(8#FhnAo_aoc!*d-Z@K_u2{Kh?bU0y?%aL& z^vB=z>l^1WFfgw2ba4!+h2fp@jEXndkl|BBm;>X_F59XHMb?Fw|+eOao*brhySGfD=1I0e!9+J=h^%6 z`nkvFJXL?09k?&%=DD3(Ha?%vZxUi|dHnj#;x$JYzJ9Kcs}D_T`1Ld0wYXNXVZP7j zXFt6e%f9O~-+1HCwc+l3fdzm6s4}em+sRP%ouB>7dwE`oJN6P6D*v-EJp7>+UH)F4 zDH-X{n`+nvZ>-!lqzOggE_}0#p@tvJXqOP9fKvC^;hRgp1 z8XhF9yD!fqF!%oc%Vg4}8*OVmQOZ za$tuG$AY*=UseWi8!()=_bUFnn}O-YeO3{N-7XRi+g)TFHoGV|>~&Fb*y*C-u+>G! zVWW#d!VVXcgbgkh3--I%EZFYC=n$^J_=3ZQA-9odfvN!08uP~^rr14u|qB)@t8l{ePt*`xOGA4b4PXYh3O Kb6Mw<&;$S*k&Lqd literal 0 HcmV?d00001 diff --git a/textures/base/pack/start_icon.png b/textures/base/pack/start_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3830fb3ae493b622db421f8470b74dc910a0ece4 GIT binary patch literal 912 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7xzrU=H_maSW-r^>*%A?<1p4;3%lS0OC(wTvj`;bVP3N&-(9g~wc7QWt^3aQXCDyTz&VFm{Xk~$YmEar zzLAV&4a^DRKlo~5%96dV1~%Muf5P`cs$#O#XE}?kq`8$ZOKYC+H7 zxMadN!JU@hp9%ao~+_CD$9~_5*Rpo~5r}%<$R&cz$s3HY1b$9aFa2 z;^*sB%j$)?Gd`1^_&Zbg9`iQizCUY9MG`g&T6!pNx_-opYeR&9behyp*H;=1jsA>0 zHCzb~f*F|SGg*8RJuq=SL*Cb2ItN06+j{P&%ctCWCAuTpnD+pTK{u17F(v2B#wa1Y4zVB})oSbc!|L7_Br{9~3C3LR^i z`7c-9|Ml#8R6|$O4YygW@5&ec+$y@@(B$o3RUFda&3tox$Inofjk`xeBU3zhA;o=5X5op2&l;u*+8eg(_UT{qLP&_&?on+4a`7FR$?w z9Q@HK8Gq?s{n@Ykotat$+zgKiAM-!E!_Quh>3j^A)h2EZ#W}|%`WsJA;Z(bxF7c*` z!Cd8sL20e(_U7xcvkSAzg(RGIbQ#L|vL5n2CCf2)snlw&fc}{YvxJ2Hc<%o%xKA=f zn^TXQ^>A>)lyfRpf)3e#D;uN_8Y~H)U&HRYzcK$n;WH~PgLH#8%dab3e)oXq2UpFh z7+_TJv`xP2cxH=r#{vBZ#XuzikMABdeZ0IPY$JDIgB8o+E~XVsS2QKU1RO*c spE_op{M#U|*b+GTbq7A+A^nqmqFmf#8}S8Jz?{b5>FVdQ&MBb@08B=O*Z=?k literal 0 HcmV?d00001 -- 2.25.1