simplify ui

This commit is contained in:
kepler155c
2017-10-11 11:36:56 -04:00
parent ed2d6eeef1
commit 980c635037
4 changed files with 29 additions and 7 deletions

View File

@@ -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)

View File

@@ -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()

View File

@@ -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)

View File

@@ -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