resizing now works properly
This commit is contained in:
@@ -179,9 +179,9 @@ local mainPage = UI.Page({
|
|||||||
}),
|
}),
|
||||||
statusBar = UI.StatusBar({
|
statusBar = UI.StatusBar({
|
||||||
columns = {
|
columns = {
|
||||||
{ '', 'status', 4 },
|
{ key = 'status' },
|
||||||
{ '', 'fuelF', 5 },
|
{ key = 'fuelF', width = 5 },
|
||||||
{ '', 'distanceF', 4 },
|
{ key = 'distanceF', width = 4 },
|
||||||
},
|
},
|
||||||
autospace = true,
|
autospace = true,
|
||||||
}),
|
}),
|
||||||
@@ -347,7 +347,7 @@ local function nameDialog(f)
|
|||||||
height = 6,
|
height = 6,
|
||||||
title = 'Enter Name',
|
title = 'Enter Name',
|
||||||
form = UI.Form {
|
form = UI.Form {
|
||||||
x = 2, rex = -2, y = 2,
|
x = 2, ex = -2, y = 2,
|
||||||
textEntry = UI.TextEntry({ y = 2, width = 20, limit = 20 })
|
textEntry = UI.TextEntry({ y = 2, width = 20, limit = 20 })
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -470,7 +470,7 @@ function mainPage:eventHandler(event)
|
|||||||
|
|
||||||
elseif event.type == 'grid_focus_row' then
|
elseif event.type == 'grid_focus_row' then
|
||||||
local computer = self.computers:getSelected()
|
local computer = self.computers:getSelected()
|
||||||
self.statusBar.values = { computer }
|
self.statusBar.values = computer
|
||||||
self.statusBar:draw()
|
self.statusBar:draw()
|
||||||
|
|
||||||
elseif event.type == 'grid_select' then
|
elseif event.type == 'grid_select' then
|
||||||
@@ -498,15 +498,16 @@ function mainPage:eventHandler(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function mainPage.statusBar:draw()
|
function mainPage.statusBar:draw()
|
||||||
local computer = self.values[1]
|
if self.values then
|
||||||
if computer then
|
local computer = self.values
|
||||||
if computer.fuel then
|
if computer then
|
||||||
computer.fuelF = string.format("%dk", math.floor(computer.fuel/1000))
|
if computer.fuel then
|
||||||
|
computer.fuelF = string.format("%dk", math.floor(computer.fuel/1000))
|
||||||
|
end
|
||||||
|
if computer.distance then
|
||||||
|
computer.distanceF = Util.round(computer.distance, 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if computer.distance then
|
|
||||||
computer.distanceF = Util.round(computer.distance, 1)
|
|
||||||
end
|
|
||||||
mainPage.statusBar:adjustWidth()
|
|
||||||
end
|
end
|
||||||
UI.StatusBar.draw(self)
|
UI.StatusBar.draw(self)
|
||||||
end
|
end
|
||||||
@@ -558,7 +559,7 @@ Event.onInterval(1, function()
|
|||||||
local selected = mainPage.computers:getSelected()
|
local selected = mainPage.computers:getSelected()
|
||||||
if selected then
|
if selected then
|
||||||
local computer = _G.network[selected.id]
|
local computer = _G.network[selected.id]
|
||||||
mainPage.statusBar.values = { computer }
|
mainPage.statusBar.values = computer
|
||||||
mainPage.statusBar:draw()
|
mainPage.statusBar:draw()
|
||||||
mainPage:sync()
|
mainPage:sync()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ local page = UI.Page {
|
|||||||
height = 4,
|
height = 4,
|
||||||
},
|
},
|
||||||
tabs = UI.Tabs {
|
tabs = UI.Tabs {
|
||||||
x = 1, y = 5, rey = -2,
|
x = 1, y = 5, ey = -2,
|
||||||
scripts = UI.Grid {
|
scripts = UI.Grid {
|
||||||
tabTitle = 'Run',
|
tabTitle = 'Run',
|
||||||
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor,
|
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor,
|
||||||
|
|||||||
@@ -1375,7 +1375,7 @@ end
|
|||||||
--[[-- blankPage --]]--
|
--[[-- blankPage --]]--
|
||||||
blankPage = UI.Page()
|
blankPage = UI.Page()
|
||||||
function blankPage:draw()
|
function blankPage:draw()
|
||||||
self:clear()
|
self:clear(colors.black)
|
||||||
self:setCursorPos(1, 1)
|
self:setCursorPos(1, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ local itemPage = UI.Page {
|
|||||||
event = 'form_cancel',
|
event = 'form_cancel',
|
||||||
},
|
},
|
||||||
form = UI.Form {
|
form = UI.Form {
|
||||||
x = 1, y = 2, height = 10, rex = -1,
|
x = 1, y = 2, height = 10, ex = -1,
|
||||||
[1] = UI.TextEntry {
|
[1] = UI.TextEntry {
|
||||||
width = 7,
|
width = 7,
|
||||||
formLabel = 'Min', formKey = 'low', help = 'Craft if below min'
|
formLabel = 'Min', formKey = 'low', help = 'Craft if below min'
|
||||||
@@ -573,7 +573,7 @@ local listingPage = UI.Page {
|
|||||||
{ text = 'Learn', event = 'learn' },
|
{ text = 'Learn', event = 'learn' },
|
||||||
{ text = 'Forget', event = 'forget' },
|
{ text = 'Forget', event = 'forget' },
|
||||||
{ text = 'Craft', event = 'craft' },
|
{ text = 'Craft', event = 'craft' },
|
||||||
{ text = 'Refresh', event = 'refresh', rx = -8 },
|
{ text = 'Refresh', event = 'refresh', x = -9 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
grid = UI.Grid {
|
grid = UI.Grid {
|
||||||
@@ -594,7 +594,7 @@ local listingPage = UI.Page {
|
|||||||
value = 'Filter',
|
value = 'Filter',
|
||||||
},
|
},
|
||||||
filter = UI.TextEntry {
|
filter = UI.TextEntry {
|
||||||
x = 9, rex = -2,
|
x = 9, ex = -2,
|
||||||
limit = 50,
|
limit = 50,
|
||||||
backgroundColor = colors.gray,
|
backgroundColor = colors.gray,
|
||||||
backgroundFocusColor = colors.gray,
|
backgroundFocusColor = colors.gray,
|
||||||
@@ -797,11 +797,11 @@ local learnPage = UI.Dialog {
|
|||||||
value = 'Place recipe in turtle'
|
value = 'Place recipe in turtle'
|
||||||
},
|
},
|
||||||
accept = UI.Button {
|
accept = UI.Button {
|
||||||
rx = -13, ry = -2,
|
x = -14, y = -3,
|
||||||
text = 'Ok', event = 'accept',
|
text = 'Ok', event = 'accept',
|
||||||
},
|
},
|
||||||
cancel = UI.Button {
|
cancel = UI.Button {
|
||||||
rx = -8, ry = -2,
|
x = -9, y = -3,
|
||||||
text = 'Cancel', event = 'cancel'
|
text = 'Cancel', event = 'cancel'
|
||||||
},
|
},
|
||||||
statusBar = UI.StatusBar {
|
statusBar = UI.StatusBar {
|
||||||
@@ -844,12 +844,12 @@ local craftPage = UI.Dialog {
|
|||||||
value = '1',
|
value = '1',
|
||||||
},
|
},
|
||||||
accept = UI.Button {
|
accept = UI.Button {
|
||||||
rx = -7, ry = -1,
|
x = -8, y = -2,
|
||||||
backgroundColor = colors.green,
|
backgroundColor = colors.green,
|
||||||
text = '+', event = 'accept',
|
text = '+', event = 'accept',
|
||||||
},
|
},
|
||||||
cancel = UI.Button {
|
cancel = UI.Button {
|
||||||
rx = -3, ry = -1,
|
x = -4, y = -2,
|
||||||
backgroundColor = colors.red,
|
backgroundColor = colors.red,
|
||||||
text = '\215', event = 'cancel'
|
text = '\215', event = 'cancel'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,97 +25,97 @@ local page = UI.Page({
|
|||||||
stationName = UI.Text({
|
stationName = UI.Text({
|
||||||
y = 2,
|
y = 2,
|
||||||
x = 2,
|
x = 2,
|
||||||
width = monitor.width - 14,
|
ex = -14,
|
||||||
height = 3,
|
height = 3,
|
||||||
backgroundColor = colors.black,
|
backgroundColor = colors.black,
|
||||||
}),
|
}),
|
||||||
seek = UI.Button({
|
|
||||||
y = 7,
|
|
||||||
x = 13,
|
|
||||||
height = 3,
|
|
||||||
event = 'seek',
|
|
||||||
text = ' >> ',
|
|
||||||
}),
|
|
||||||
play = UI.Button({
|
play = UI.Button({
|
||||||
y = 7,
|
y = -4,
|
||||||
x = 2,
|
x = 2,
|
||||||
height = 3,
|
height = 3,
|
||||||
event = 'play',
|
event = 'play',
|
||||||
text = '> / ll',
|
text = '> / ll',
|
||||||
}),
|
}),
|
||||||
louder = UI.Button({
|
seek = UI.Button({
|
||||||
y = 7,
|
y = -4,
|
||||||
x = monitor.width - 15,
|
x = 12,
|
||||||
width = 3,
|
|
||||||
height = 3,
|
height = 3,
|
||||||
event = 'louder',
|
event = 'seek',
|
||||||
text = '+',
|
text = ' >> ',
|
||||||
}),
|
}),
|
||||||
quiet = UI.Button({
|
quiet = UI.Button({
|
||||||
y = 7,
|
y = -4,
|
||||||
x = monitor.width - 20,
|
x = -19,
|
||||||
event = 'quiet',
|
event = 'quiet',
|
||||||
width = 3,
|
width = 3,
|
||||||
height = 3,
|
height = 3,
|
||||||
text = '-',
|
text = '-',
|
||||||
}),
|
}),
|
||||||
|
louder = UI.Button({
|
||||||
|
y = -4,
|
||||||
|
x = -14,
|
||||||
|
width = 3,
|
||||||
|
height = 3,
|
||||||
|
event = 'louder',
|
||||||
|
text = '+',
|
||||||
|
}),
|
||||||
volumeDisplay = UI.Text({
|
volumeDisplay = UI.Text({
|
||||||
y = 3,
|
y = 3,
|
||||||
x = monitor.width - 9,
|
x = -9,
|
||||||
width = 4,
|
width = 4,
|
||||||
}),
|
}),
|
||||||
volume1 = UI.Window({
|
volume1 = UI.Window({
|
||||||
y = monitor.height - 1,
|
y = -2,
|
||||||
x = monitor.width - 8,
|
x = -9,
|
||||||
height = 1,
|
height = 1,
|
||||||
width = 1,
|
width = 1,
|
||||||
color = colors.white
|
color = colors.white
|
||||||
}),
|
}),
|
||||||
volume2 = UI.Window({
|
volume2 = UI.Window({
|
||||||
y = monitor.height - 2,
|
y = -3,
|
||||||
x = monitor.width - 7,
|
x = -8,
|
||||||
height = 2,
|
height = 2,
|
||||||
width = 1,
|
width = 1,
|
||||||
color = colors.white
|
color = colors.white
|
||||||
}),
|
}),
|
||||||
volume3 = UI.Window({
|
volume3 = UI.Window({
|
||||||
y = monitor.height - 3,
|
y = -4,
|
||||||
x = monitor.width - 6,
|
x = -7,
|
||||||
height = 3,
|
height = 3,
|
||||||
width = 1,
|
width = 1,
|
||||||
color = colors.yellow
|
color = colors.yellow
|
||||||
}),
|
}),
|
||||||
volume4 = UI.Window({
|
volume4 = UI.Window({
|
||||||
y = monitor.height - 4,
|
y = -5,
|
||||||
x = monitor.width - 5,
|
x = -6,
|
||||||
height = 4,
|
height = 4,
|
||||||
width = 1,
|
width = 1,
|
||||||
color = colors.yellow,
|
color = colors.yellow,
|
||||||
}),
|
}),
|
||||||
volume5 = UI.Window({
|
volume5 = UI.Window({
|
||||||
y = monitor.height - 5,
|
y = -6,
|
||||||
x = monitor.width - 4,
|
x = -5,
|
||||||
height = 5,
|
height = 5,
|
||||||
width = 1,
|
width = 1,
|
||||||
color = colors.orange,
|
color = colors.orange,
|
||||||
}),
|
}),
|
||||||
volume6 = UI.Window({
|
volume6 = UI.Window({
|
||||||
y = monitor.height - 6,
|
y = -7,
|
||||||
x = monitor.width - 3,
|
x = -4,
|
||||||
height = 6,
|
height = 6,
|
||||||
width = 1,
|
width = 1,
|
||||||
color = colors.orange,
|
color = colors.orange,
|
||||||
}),
|
}),
|
||||||
volume7 = UI.Window({
|
volume7 = UI.Window({
|
||||||
y = monitor.height - 7,
|
y = -8,
|
||||||
x = monitor.width - 2,
|
x = -3,
|
||||||
height = 7,
|
height = 7,
|
||||||
width = 1,
|
width = 1,
|
||||||
color = colors.red,
|
color = colors.red,
|
||||||
}),
|
}),
|
||||||
volume8 = UI.Window({
|
volume8 = UI.Window({
|
||||||
y = monitor.height - 8,
|
y = -9,
|
||||||
x = monitor.width - 1,
|
x = -2,
|
||||||
height = 8,
|
height = 8,
|
||||||
width = 1,
|
width = 1,
|
||||||
color = colors.red,
|
color = colors.red,
|
||||||
|
|||||||
@@ -282,13 +282,13 @@ local data = Util.readTable('/usr/config/shapes') or { }
|
|||||||
|
|
||||||
local page = UI.Page {
|
local page = UI.Page {
|
||||||
titleBar = UI.TitleBar { title = 'Shapes' },
|
titleBar = UI.TitleBar { title = 'Shapes' },
|
||||||
info = UI.Window { x = 5, y = 3, height = 1 },
|
info = UI.Window { x = 5, y = 3, height = 1 },
|
||||||
startCoord = UI.Button { x = 2, y = 6, text = 'Start ', event = 'startCoord' },
|
startCoord = UI.Button { x = 2, y = 6, text = 'Start ', event = 'startCoord' },
|
||||||
endCoord = UI.Button { x = 2, y = 8, text = 'End ', event = 'endCoord' },
|
endCoord = UI.Button { x = 2, y = 8, text = 'End ', event = 'endCoord' },
|
||||||
supplies = UI.Button { x = 2, y = 10, text = 'Supplies', event = 'supplies' },
|
supplies = UI.Button { x = 2, y = 10, text = 'Supplies', event = 'supplies' },
|
||||||
first = UI.Button { x = 2, y = 11, text = 'First', event = 'firstCoord' },
|
first = UI.Button { x = 2, y = 11, text = 'First', event = 'firstCoord' },
|
||||||
cancel = UI.Button { rx = 2, ry = -2, text = 'Abort', event = 'cancel' },
|
cancel = UI.Button { x = 2, y = -3, text = 'Abort', event = 'cancel' },
|
||||||
begin = UI.Button { rx = -7, ry = -2, text = 'Begin', event = 'begin' },
|
begin = UI.Button { x = -8, y = -3, text = 'Begin', event = 'begin' },
|
||||||
accelerators = { q = 'quit' },
|
accelerators = { q = 'quit' },
|
||||||
notification = UI.Notification(),
|
notification = UI.Notification(),
|
||||||
statusBar = UI.StatusBar(),
|
statusBar = UI.StatusBar(),
|
||||||
|
|||||||
@@ -22,52 +22,42 @@ end
|
|||||||
multishell.setTitle(multishell.getCurrent(), 'Storage Activity')
|
multishell.setTitle(multishell.getCurrent(), 'Storage Activity')
|
||||||
UI:configure('StorageActivity', ...)
|
UI:configure('StorageActivity', ...)
|
||||||
|
|
||||||
local changedPage = UI.Page({
|
local changedPage = UI.Page {
|
||||||
grid = UI.Grid({
|
grid = UI.Grid {
|
||||||
|
ey = -6,
|
||||||
columns = {
|
columns = {
|
||||||
{ heading = 'Qty', key = 'count', width = 5 },
|
{ heading = 'Qty', key = 'count', width = 5 },
|
||||||
{ heading = 'Change', key = 'change', width = 6 },
|
{ heading = 'Change', key = 'change', width = 6 },
|
||||||
{ heading = 'Name', key = 'displayName', width = UI.term.width - 15 },
|
{ heading = 'Name', key = 'displayName' },
|
||||||
},
|
},
|
||||||
sortColumn = 'displayName',
|
sortColumn = 'displayName',
|
||||||
rey = -6,
|
},
|
||||||
}),
|
buttons = UI.Window {
|
||||||
buttons = UI.Window({
|
y = -5, height = 5,
|
||||||
ry = -4,
|
|
||||||
height = 5,
|
|
||||||
backgroundColor = colors.gray,
|
backgroundColor = colors.gray,
|
||||||
prevButton = UI.Button({
|
prevButton = UI.Button {
|
||||||
|
x = 2, y = 2, height = 3, width = 5,
|
||||||
event = 'previous',
|
event = 'previous',
|
||||||
backgroundColor = colors.lightGray,
|
backgroundColor = colors.lightGray,
|
||||||
x = 2,
|
|
||||||
y = 2,
|
|
||||||
height = 3,
|
|
||||||
width = 5,
|
|
||||||
text = ' < '
|
text = ' < '
|
||||||
}),
|
},
|
||||||
resetButton = UI.Button({
|
resetButton = UI.Button {
|
||||||
|
x = 8, y = 2, height = 3, ex = -8,
|
||||||
event = 'reset',
|
event = 'reset',
|
||||||
backgroundColor = colors.lightGray,
|
backgroundColor = colors.lightGray,
|
||||||
x = 8,
|
|
||||||
y = 2,
|
|
||||||
height = 3,
|
|
||||||
rex = -8,
|
|
||||||
text = 'Reset'
|
text = 'Reset'
|
||||||
}),
|
},
|
||||||
nextButton = UI.Button({
|
nextButton = UI.Button {
|
||||||
|
x = -6, y = 2, height = 3, width = 5,
|
||||||
event = 'next',
|
event = 'next',
|
||||||
backgroundColor = colors.lightGray,
|
backgroundColor = colors.lightGray,
|
||||||
rx = -5,
|
|
||||||
y = 2,
|
|
||||||
height = 3,
|
|
||||||
width = 5,
|
|
||||||
text = ' > '
|
text = ' > '
|
||||||
})
|
},
|
||||||
}),
|
},
|
||||||
accelerators = {
|
accelerators = {
|
||||||
q = 'quit',
|
q = 'quit',
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
function changedPage.grid:getDisplayValues(row)
|
function changedPage.grid:getDisplayValues(row)
|
||||||
row = Util.shallowCopy(row)
|
row = Util.shallowCopy(row)
|
||||||
|
|||||||
4043
etc/recipes.db
4043
etc/recipes.db
File diff suppressed because it is too large
Load Diff
1
etc/scripts/abort
Normal file
1
etc/scripts/abort
Normal file
@@ -0,0 +1 @@
|
|||||||
|
turtle.abortAction()
|
||||||
Reference in New Issue
Block a user