mirror of
https://github.com/Insality/druid.git
synced 2025-11-26 10:50:52 +01:00
Update
This commit is contained in:
@@ -218,6 +218,38 @@ function M.create_widget_item(item, is_installed, on_install)
|
|||||||
orientation = editor.ui.ORIENTATION.HORIZONTAL,
|
orientation = editor.ui.ORIENTATION.HORIZONTAL,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
local widget_buttons = {
|
||||||
|
editor.ui.button({
|
||||||
|
text = "Install",
|
||||||
|
on_pressed = on_install,
|
||||||
|
enabled = not is_installed
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
if item.api ~= nil then
|
||||||
|
table.insert(widget_buttons, editor.ui.button({
|
||||||
|
text = "API",
|
||||||
|
on_pressed = function() internal.open_url(item.api) end,
|
||||||
|
enabled = item.api ~= nil
|
||||||
|
}))
|
||||||
|
end
|
||||||
|
|
||||||
|
if item.example_url ~= nil then
|
||||||
|
table.insert(widget_buttons, editor.ui.button({
|
||||||
|
text = "Example",
|
||||||
|
on_pressed = function() internal.open_url(item.example_url) end,
|
||||||
|
enabled = item.example_url ~= nil
|
||||||
|
}))
|
||||||
|
end
|
||||||
|
|
||||||
|
if item.author_url ~= nil then
|
||||||
|
table.insert(widget_buttons, editor.ui.button({
|
||||||
|
text = "Author",
|
||||||
|
on_pressed = function() internal.open_url(item.author_url) end,
|
||||||
|
enabled = item.author_url ~= nil
|
||||||
|
}))
|
||||||
|
end
|
||||||
|
|
||||||
return editor.ui.horizontal({
|
return editor.ui.horizontal({
|
||||||
spacing = editor.ui.SPACING.NONE,
|
spacing = editor.ui.SPACING.NONE,
|
||||||
padding = editor.ui.PADDING.SMALL,
|
padding = editor.ui.PADDING.SMALL,
|
||||||
@@ -238,18 +270,8 @@ function M.create_widget_item(item, is_installed, on_install)
|
|||||||
-- Action buttons
|
-- Action buttons
|
||||||
editor.ui.vertical({
|
editor.ui.vertical({
|
||||||
spacing = editor.ui.SPACING.MEDIUM,
|
spacing = editor.ui.SPACING.MEDIUM,
|
||||||
children = {
|
grow = true,
|
||||||
editor.ui.button({
|
children = widget_buttons
|
||||||
text = "Install",
|
|
||||||
on_pressed = on_install,
|
|
||||||
enabled = not is_installed
|
|
||||||
}),
|
|
||||||
editor.ui.button({
|
|
||||||
text = "API",
|
|
||||||
on_pressed = function() internal.open_url(item.api) end,
|
|
||||||
enabled = item.api ~= nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user