mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Allow toggling of texture pack by double clicking
This commit is contained in:
parent
9f6167fc3b
commit
d51d0d77c4
@ -145,11 +145,26 @@ local function get_formspec(tabview, name, tabdata)
|
|||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
local function handle_doubleclick(pkg)
|
||||||
|
if pkg.type == "txp" then
|
||||||
|
if core.settings:get("texture_path") == pkg.path then
|
||||||
|
core.settings:set("texture_path", "")
|
||||||
|
else
|
||||||
|
core.settings:set("texture_path", pkg.path)
|
||||||
|
end
|
||||||
|
packages = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function handle_buttons(tabview, fields, tabname, tabdata)
|
local function handle_buttons(tabview, fields, tabname, tabdata)
|
||||||
if fields["pkglist"] ~= nil then
|
if fields["pkglist"] ~= nil then
|
||||||
local event = core.explode_table_event(fields["pkglist"])
|
local event = core.explode_table_event(fields["pkglist"])
|
||||||
tabdata.selected_pkg = event.row
|
tabdata.selected_pkg = event.row
|
||||||
|
if event.type == "DCL" then
|
||||||
|
handle_doubleclick(packages:get_list()[tabdata.selected_pkg])
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user