clipping for transistions + tab ordering via index + more examples
This commit is contained in:
@@ -24,40 +24,38 @@ local page = UI.Page {
|
||||
values = kernel.routines,
|
||||
sortColumn = 'uid',
|
||||
autospace = true,
|
||||
getDisplayValues = function(_, row)
|
||||
local elapsed = os.clock()-row.timestamp
|
||||
return {
|
||||
uid = row.uid,
|
||||
title = row.title,
|
||||
status = row.isDead and 'error' or coroutine.status(row.co),
|
||||
timestamp = elapsed < 60 and
|
||||
string.format("%ds", math.floor(elapsed)) or
|
||||
string.format("%sm", math.floor(elapsed/6)/10),
|
||||
}
|
||||
end
|
||||
},
|
||||
accelerators = {
|
||||
[ 'control-q' ] = 'quit',
|
||||
space = 'activate',
|
||||
t = 'terminate',
|
||||
},
|
||||
}
|
||||
|
||||
function page:eventHandler(event)
|
||||
local t = self.grid:getSelected()
|
||||
if t then
|
||||
if event.type == 'activate' or event.type == 'grid_select' then
|
||||
multishell.setFocus(t.uid)
|
||||
elseif event.type == 'terminate' then
|
||||
multishell.terminate(t.uid)
|
||||
eventHandler = function (self, event)
|
||||
local t = self.grid:getSelected()
|
||||
if t then
|
||||
if event.type == 'activate' or event.type == 'grid_select' then
|
||||
multishell.setFocus(t.uid)
|
||||
elseif event.type == 'terminate' then
|
||||
multishell.terminate(t.uid)
|
||||
end
|
||||
end
|
||||
if event.type == 'quit' then
|
||||
Event.exitPullEvents()
|
||||
end
|
||||
UI.Page.eventHandler(self, event)
|
||||
end
|
||||
if event.type == 'quit' then
|
||||
Event.exitPullEvents()
|
||||
end
|
||||
UI.Page.eventHandler(self, event)
|
||||
end
|
||||
|
||||
function page.grid:getDisplayValues(row)
|
||||
local elapsed = os.clock()-row.timestamp
|
||||
return {
|
||||
uid = row.uid,
|
||||
title = row.title,
|
||||
status = row.isDead and 'error' or coroutine.status(row.co),
|
||||
timestamp = elapsed < 60 and
|
||||
string.format("%ds", math.floor(elapsed)) or
|
||||
string.format("%sm", math.floor(elapsed/6)/10),
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
Event.onInterval(1, function()
|
||||
page.grid:update()
|
||||
|
||||
@@ -63,6 +63,7 @@ page = UI.Page {
|
||||
},
|
||||
},
|
||||
methodsTab = UI.Tab {
|
||||
index = 2,
|
||||
tabTitle = 'Methods',
|
||||
grid = UI.ScrollingGrid {
|
||||
headerBackgroundColor = colors.red,
|
||||
@@ -73,11 +74,12 @@ page = UI.Page {
|
||||
},
|
||||
},
|
||||
events = UI.Tab {
|
||||
index = 1,
|
||||
tabTitle = 'Events',
|
||||
UI.MenuBar {
|
||||
y = -1,
|
||||
buttons = {
|
||||
{ text = 'Clear', event = 'event_clear' },
|
||||
{ text = 'Clear' },
|
||||
}
|
||||
},
|
||||
grid = UI.ScrollingGrid {
|
||||
@@ -89,10 +91,21 @@ page = UI.Page {
|
||||
{ heading = 'type', key = 'type' },
|
||||
{ heading = 'value', key = 'value', }
|
||||
},
|
||||
accelerators = {
|
||||
grid_select = 'event_inspect',
|
||||
},
|
||||
}
|
||||
},
|
||||
eventHandler = function (self, event)
|
||||
if event.type == 'button_press' then
|
||||
Util.clear(self.grid.values)
|
||||
self.grid:update()
|
||||
self.grid:draw()
|
||||
|
||||
elseif event.type == 'grid_select' then
|
||||
multishell.openTab({
|
||||
path = 'sys/apps/Lua.lua',
|
||||
args = { event.selected.raw },
|
||||
focused = true,
|
||||
})
|
||||
end
|
||||
end
|
||||
}
|
||||
},
|
||||
editor = UI.SlideOut {
|
||||
@@ -134,18 +147,6 @@ page = UI.Page {
|
||||
self.tabs.methodsTab.grid:update()
|
||||
self.tabs.methodsTab.grid:draw()
|
||||
|
||||
elseif event.type == 'event_clear' then
|
||||
Util.clear(self.tabs.events.grid.values)
|
||||
self.tabs.events.grid:update()
|
||||
self.tabs.events.grid:draw()
|
||||
|
||||
elseif event.type == 'event_inspect' then
|
||||
multishell.openTab({
|
||||
path = 'sys/apps/Lua.lua',
|
||||
args = { event.selected.raw },
|
||||
focused = true,
|
||||
})
|
||||
|
||||
elseif event.type == 'edit_property' then
|
||||
self.editor.entry.value = event.selected.value
|
||||
self.editor:show()
|
||||
|
||||
Reference in New Issue
Block a user