ui theme generator + better module handling

This commit is contained in:
xAnavrins
2019-07-16 23:21:33 -04:00
parent c8f200ebb6
commit 672cca3084
6 changed files with 110 additions and 96 deletions

View File

@@ -12,6 +12,7 @@ local fs = _G.fs
local os = _G.os
local peripheral = _G.peripheral
local term = _G.term
local textutils = _G.textutils
--[[
Using the shorthand window definition, elements are created from
@@ -217,6 +218,34 @@ function Manager:loadTheme(filename)
end
end
function Manager:generateTheme(filename)
local t = { }
for k,v in pairs(self) do
if type(v) == 'table' then
if v._preload then
v._preload()
v = self[k]
end
if v.defaults and v.defaults.UIElement ~= 'Device' then
for p,d in pairs(v.defaults) do
if p:find('olor') then
if not t[k] then
t[k] = { }
end
for c, n in pairs(colors) do
if n == d then
t[k][p] = 'colors.' .. c
break
end
end
end
end
end
end
end
Util.writeFile(filename, textutils.serialize(t):gsub('(")', ''))
end
function Manager:emitEvent(event)
local currentPage = self:getActivePage()
if currentPage and currentPage.focused then