simplify ui
This commit is contained in:
@@ -128,10 +128,6 @@ function methodsPage:enable(p)
|
||||
self:setFocus(self.grid)
|
||||
end
|
||||
|
||||
function methodsPage.doc:focus()
|
||||
-- allow keyboard scrolling
|
||||
end
|
||||
|
||||
function methodsPage:eventHandler(event)
|
||||
if event.type == 'back' then
|
||||
UI:setPage(peripheralsPage)
|
||||
|
||||
@@ -125,7 +125,8 @@ local page = UI.Page {
|
||||
fn = 'turtle.turnRight',
|
||||
},
|
||||
info = UI.TextArea {
|
||||
x = 2, y = 9
|
||||
x = 2, y = 9,
|
||||
inactive = true,
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -379,7 +380,7 @@ local lookup = {
|
||||
}
|
||||
|
||||
if lookup[options.tab.value] then
|
||||
page.tabs:activateTab(lookup[options.tab.value])
|
||||
page.tabs:activateTab(lookup[options.tab.value].uid)
|
||||
end
|
||||
|
||||
UI:pullEvents()
|
||||
|
||||
@@ -36,6 +36,31 @@ elseif device.monitor then
|
||||
})
|
||||
end
|
||||
|
||||
--[[-- ScrollingText --]]--
|
||||
UI.ScrollingText = class(UI.Window)
|
||||
UI.ScrollingText.defaults = {
|
||||
UIElement = 'ScrollingText',
|
||||
backgroundColor = colors.black,
|
||||
buffer = { },
|
||||
}
|
||||
function UI.ScrollingText:appendLine(text)
|
||||
if #self.buffer+1 >= self.height then
|
||||
table.remove(self.buffer, 1)
|
||||
end
|
||||
table.insert(self.buffer, text)
|
||||
end
|
||||
|
||||
function UI.ScrollingText:clear()
|
||||
self.buffer = { }
|
||||
UI.Window.clear(self)
|
||||
end
|
||||
|
||||
function UI.ScrollingText:draw()
|
||||
for k,text in ipairs(self.buffer) do
|
||||
self:write(1, k, Util.widthify(text, self.width), self.backgroundColor)
|
||||
end
|
||||
end
|
||||
|
||||
terminal:clear()
|
||||
|
||||
function getClient(id)
|
||||
|
||||
@@ -291,7 +291,7 @@ function normalChestUnload()
|
||||
makeWalkableTunnel(action, tpt, { x = pt.x, z = pt.z })
|
||||
end)
|
||||
|
||||
safeGoto(0, 0)
|
||||
safeGoto(0, 0, 0)
|
||||
if not turtle.detectUp() then
|
||||
error('no chest')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user