mirror of
https://github.com/kepler155c/opus
synced 2024-12-29 01:50:27 +00:00
inspect cleanup
This commit is contained in:
parent
25405f15c8
commit
053003f429
@ -1,13 +1,16 @@
|
|||||||
local Event = require('opus.event')
|
local UI = require('opus.ui')
|
||||||
local UI = require('opus.ui')
|
|
||||||
|
|
||||||
local colors = _G.colors
|
local colors = _G.colors
|
||||||
local multishell = _ENV.multishell
|
local multishell = _ENV.multishell
|
||||||
|
|
||||||
local args = { ... }
|
local name = ({ ... })[1] or error('Syntax: inspect COMPONENT')
|
||||||
local name = args[1] or error('Syntax: inspect COMPONENT')
|
|
||||||
local events = { }
|
local events = { }
|
||||||
local page
|
local page
|
||||||
|
local component = UI[name] and UI[name]() or error('Invalid component')
|
||||||
|
|
||||||
|
if not component.example then
|
||||||
|
error('No example present')
|
||||||
|
end
|
||||||
|
|
||||||
local function isRelevant(el)
|
local function isRelevant(el)
|
||||||
return page.testContainer == el or el.parent and isRelevant(el.parent)
|
return page.testContainer == el or el.parent and isRelevant(el.parent)
|
||||||
@ -27,6 +30,10 @@ function UI.Window:emit(event)
|
|||||||
while #events > 10 do
|
while #events > 10 do
|
||||||
table.remove(events)
|
table.remove(events)
|
||||||
end
|
end
|
||||||
|
page.tabs.events.grid:update()
|
||||||
|
if page.tabs.events.enabled then
|
||||||
|
page.tabs.events.grid:draw()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return emitter(self, event)
|
return emitter(self, event)
|
||||||
end
|
end
|
||||||
@ -34,11 +41,11 @@ end
|
|||||||
page = UI.Page {
|
page = UI.Page {
|
||||||
testContainer = UI.Window {
|
testContainer = UI.Window {
|
||||||
ey = 10,
|
ey = 10,
|
||||||
|
testing = component.example(),
|
||||||
},
|
},
|
||||||
tabs = UI.Tabs {
|
tabs = UI.Tabs {
|
||||||
y = 11,
|
y = 11,
|
||||||
properties = UI.Tab {
|
properties = UI.Tab {
|
||||||
backgroundColor = colors.red,
|
|
||||||
tabTitle = 'Properties',
|
tabTitle = 'Properties',
|
||||||
grid = UI.ScrollingGrid {
|
grid = UI.ScrollingGrid {
|
||||||
headerBackgroundColor = colors.red,
|
headerBackgroundColor = colors.red,
|
||||||
@ -53,7 +60,6 @@ page = UI.Page {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methodsTab = UI.Tab {
|
methodsTab = UI.Tab {
|
||||||
backgroundColor = colors.red,
|
|
||||||
tabTitle = 'Methods',
|
tabTitle = 'Methods',
|
||||||
grid = UI.ScrollingGrid {
|
grid = UI.ScrollingGrid {
|
||||||
headerBackgroundColor = colors.red,
|
headerBackgroundColor = colors.red,
|
||||||
@ -64,7 +70,6 @@ page = UI.Page {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
events = UI.Tab {
|
events = UI.Tab {
|
||||||
backgroundColor = colors.red,
|
|
||||||
tabTitle = 'Events',
|
tabTitle = 'Events',
|
||||||
grid = UI.ScrollingGrid {
|
grid = UI.ScrollingGrid {
|
||||||
headerBackgroundColor = colors.red,
|
headerBackgroundColor = colors.red,
|
||||||
@ -139,16 +144,5 @@ page = UI.Page {
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
Event.onInterval(1, function()
|
|
||||||
page.tabs.events.grid:update()
|
|
||||||
page.tabs.events.grid:draw()
|
|
||||||
page.tabs.events.grid:sync()
|
|
||||||
end)
|
|
||||||
|
|
||||||
local component = UI[name]()
|
|
||||||
local testing = component.example()
|
|
||||||
|
|
||||||
page.testContainer:add({ test = testing })
|
|
||||||
|
|
||||||
UI:setPage(page)
|
UI:setPage(page)
|
||||||
UI:pullEvents()
|
UI:pullEvents()
|
||||||
|
Loading…
Reference in New Issue
Block a user