aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/plugin_manager/init.lua18
-rw-r--r--plugins/plugin_manager/plugin_view.lua49
-rw-r--r--plugins/welcome.lua2
3 files changed, 21 insertions, 48 deletions
diff --git a/plugins/plugin_manager/init.lua b/plugins/plugin_manager/init.lua
index 9bb4440..c9f9f53 100644
--- a/plugins/plugin_manager/init.lua
+++ b/plugins/plugin_manager/init.lua
@@ -1,4 +1,4 @@
--- mod-version:3 --lite-xl 2.1 --priority:5
+-- mod-version:4 --lite-xl 3.0 --priority:5
local core = require "core"
local common = require "core.common"
@@ -471,9 +471,9 @@ end
command.add(nil, {
- ["plugin-manager:install"] = function()
+ ["plugin-manager:install"] = function(root_view)
PluginManager:get_addons({ progress = PluginManager.view.progress_callback })
- core.command_view:enter("Enter plugin name",
+ root_view.command_view:enter("Enter plugin name",
function(name)
PluginManager:get_addon(name, { progress = PluginManager.view.progress_callback }):done(function(addon)
core.log("Attempting to install plugin " .. name .. "...")
@@ -496,9 +496,9 @@ command.add(nil, {
end
)
end,
- ["plugin-manager:uninstall"] = function()
+ ["plugin-manager:uninstall"] = function(root_view)
PluginManager:get_addons({ progress = PluginManager.view.progress_callback })
- core.command_view:enter("Enter plugin name",
+ root_view.command_view:enter("Enter plugin name",
function(name)
PluginManager:get_addon(name, { progress = PluginManager.view.progress_callback }):done(function(addon)
core.log("Attempting to uninstall plugin " .. addon.id .. "...")
@@ -521,8 +521,8 @@ command.add(nil, {
end
)
end,
- ["plugin-manager:add-repository"] = function()
- core.command_view:enter("Enter repository url",
+ ["plugin-manager:add-repository"] = function(root_view)
+ root_view.command_view:enter("Enter repository url",
function(url)
PluginManager:add(url):done(function()
core.log("Successfully added repository " .. url .. ".")
@@ -530,9 +530,9 @@ command.add(nil, {
end
)
end,
- ["plugin-manager:remove-repository"] = function()
+ ["plugin-manager:remove-repository"] = function(root_view)
PluginManager:get_addons({ progress = PluginManager.view.progress_callback })
- core.command_view:enter("Enter repository url",
+ root_view.command_view:enter("Enter repository url",
function(url)
PluginManager:remove(url):done(function()
core.log("Successfully removed repository " .. url .. ".")
diff --git a/plugins/plugin_manager/plugin_view.lua b/plugins/plugin_manager/plugin_view.lua
index 0755a30..1798c97 100644
--- a/plugins/plugin_manager/plugin_view.lua
+++ b/plugins/plugin_manager/plugin_view.lua
@@ -21,7 +21,6 @@ end
local plugin_view = nil
-PluginView.menu = ContextMenu()
function PluginView:new()
PluginView.super.new(self)
@@ -54,34 +53,6 @@ function PluginView:get_name()
end
-local root_view_update = RootView.update
-function RootView:update(...)
- root_view_update(self, ...)
- PluginView.menu:update()
-end
-
-
-local root_view_draw = RootView.draw
-function RootView:draw(...)
- root_view_draw(self, ...)
- PluginView.menu:draw()
-end
-
-
-local root_view_on_mouse_moved = RootView.on_mouse_moved
-function RootView:on_mouse_moved(...)
- if PluginView.menu:on_mouse_moved(...) then return end
- return root_view_on_mouse_moved(self, ...)
-end
-
-
-local on_view_mouse_pressed = RootView.on_view_mouse_pressed
-function RootView.on_view_mouse_pressed(button, x, y, clicks)
- local handled = PluginView.menu:on_mouse_pressed(button, x, y, clicks)
- return handled or on_view_mouse_pressed(button, x, y, clicks)
-end
-
-
function PluginView:on_mouse_pressed(button, mx, my, clicks)
if PluginView.super.on_mouse_pressed(self, button, mx, my, clicks) then return true end
local lh = style.font:get_height() + style.padding.y
@@ -461,14 +432,16 @@ keymap.add {
}
-PluginView.menu:register(function() return core.active_view:is(PluginView) end, {
- { text = "Install", command = "plugin-manager:install-hovered" },
- { text = "Uninstall", command = "plugin-manager:uninstall-hovered" },
- { text = "View Source", command = "plugin-manager:view-source-hovered" },
- { text = "View README", command = "plugin-manager:view-readme-hovered" },
- ContextMenu.DIVIDER,
- { text = "Refresh Listing", command = "plugin-manager:refresh-all" },
- { text = "Upgrade All", command = "plugin-manager:upgrade-all" },
-})
+function PluginView:on_context_menu()
+ return { items = {
+ { text = "Install", command = "plugin-manager:install-hovered" },
+ { text = "Uninstall", command = "plugin-manager:uninstall-hovered" },
+ { text = "View Source", command = "plugin-manager:view-source-hovered" },
+ { text = "View README", command = "plugin-manager:view-readme-hovered" },
+ ContextMenu.DIVIDER,
+ { text = "Refresh Listing", command = "plugin-manager:refresh-all" },
+ { text = "Upgrade All", command = "plugin-manager:upgrade-all" }
+ } }
+end
return PluginView
diff --git a/plugins/welcome.lua b/plugins/welcome.lua
index 5516568..03762b5 100644
--- a/plugins/welcome.lua
+++ b/plugins/welcome.lua
@@ -1,4 +1,4 @@
--- mod-version:3 --lite-xl 2.1
+-- mod-version:4 --lite-xl 3.0
local core = require "core"
local style = require "core.style"