diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/plugin_manager/init.lua | 2 | ||||
-rw-r--r-- | plugins/plugin_manager/plugin_view.lua | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/plugins/plugin_manager/init.lua b/plugins/plugin_manager/init.lua index 82e5442..eea9efb 100644 --- a/plugins/plugin_manager/init.lua +++ b/plugins/plugin_manager/init.lua @@ -80,7 +80,7 @@ end local function run(cmd, progress) table.insert(cmd, 1, config.plugins.plugin_manager.lpm_binary_path) table.insert(cmd, "--json") - table.insert(cmd, "--mod-version=" .. MOD_VERSION_MAJOR) + table.insert(cmd, "--mod-version=" .. (rawget(_G, "MOD_VERSION") or MOD_VERSION_STRING)) -- #workaround hack for new system. table.insert(cmd, "--quiet") table.insert(cmd, "--progress") table.insert(cmd, "--userdir=" .. USERDIR) diff --git a/plugins/plugin_manager/plugin_view.lua b/plugins/plugin_manager/plugin_view.lua index a00b5da..98dcc7b 100644 --- a/plugins/plugin_manager/plugin_view.lua +++ b/plugins/plugin_manager/plugin_view.lua @@ -34,13 +34,13 @@ function PluginView:new() self.scrollable = true self.progress = nil self.show_incompatible_plugins = false - self.plugin_table_columns = { "ID", "Name", "Version", "Type", "Modversion", "Status", "Tags", "Author", "Description" } + self.plugin_table_columns = { "Name", "Version", "Type", "Status", "Tags", "Author", "Description" } self.hovered_plugin = nil self.hovered_plugin_idx = nil self.selected_plugin = nil self.selected_plugin_idx = nil self.initialized = false - self.offset_y = 0 + self.offset_y = 1 self.plugin_manager = require "plugins.plugin_manager" self.progress_callback = function(progress) self.progress = progress @@ -54,7 +54,7 @@ function PluginView:new() end local function get_plugin_text(plugin) - return plugin.id, (plugin.name or plugin.id), plugin.version, plugin.type, plugin.mod_version, plugin.status, join(", ", plugin.tags), plugin.author or "unknown", plugin.description-- (plugin.description or ""):gsub("%[[^]+%]%([^)]+%)", "") + return (plugin.name or plugin.id), (plugin.status == "core" and VERSION or plugin.version), plugin.type, plugin.status, join(", ", plugin.tags), plugin.author or "unknown", plugin.description-- (plugin.description or ""):gsub("%[[^]+%]%([^)]+%)", "") end @@ -96,7 +96,7 @@ function PluginView:on_mouse_moved(x, y, dx, dy) if self.initialized then local th = style.font:get_height() local lh = th + style.padding.y - local offset = math.floor((y - self.position.y + self.scroll.y) / lh) - self.offset_y + local offset = math.floor((y - self.position.y + self.scroll.y) / lh) self.hovered_plugin = offset > 0 and self:get_plugins()[offset] self.hovered_plugin_idx = offset > 0 and offset end @@ -167,14 +167,15 @@ function PluginView:draw() local ox, oy = self:get_content_offset() - oy = oy + (lh + style.padding.y) * self.offset_y - core.push_clip_rect(self.position.x, self.position.y + (lh + style.padding.y) * self.offset_y, self.size.x, self.size.y) + oy = oy + lh * self.offset_y + local x, y = ox + style.padding.x, oy for i, v in ipairs(self.plugin_table_columns) do - common.draw_text(style.font, style.accent, v, "left", x, y, self.widths[i], lh) + common.draw_text(style.font, style.accent, v, "left", x, self.position.y, self.widths[i], lh) x = x + self.widths[i] + style.padding.x end - oy = oy + lh + + core.push_clip_rect(self.position.x, self.position.y + lh * self.offset_y, self.size.x, self.size.y) for i, plugin in ipairs(self:get_plugins()) do local x, y = ox, oy if y + lh >= self.position.y and y <= self.position.y + self.size.y then |