resizing now works properly

This commit is contained in:
kepler155c
2017-09-29 22:29:40 -04:00
parent 71cdc6341e
commit db2dca444f
9 changed files with 2111 additions and 2108 deletions

View File

@@ -179,9 +179,9 @@ local mainPage = UI.Page({
}),
statusBar = UI.StatusBar({
columns = {
{ '', 'status', 4 },
{ '', 'fuelF', 5 },
{ '', 'distanceF', 4 },
{ key = 'status' },
{ key = 'fuelF', width = 5 },
{ key = 'distanceF', width = 4 },
},
autospace = true,
}),
@@ -347,7 +347,7 @@ local function nameDialog(f)
height = 6,
title = 'Enter Name',
form = UI.Form {
x = 2, rex = -2, y = 2,
x = 2, ex = -2, y = 2,
textEntry = UI.TextEntry({ y = 2, width = 20, limit = 20 })
},
})
@@ -470,7 +470,7 @@ function mainPage:eventHandler(event)
elseif event.type == 'grid_focus_row' then
local computer = self.computers:getSelected()
self.statusBar.values = { computer }
self.statusBar.values = computer
self.statusBar:draw()
elseif event.type == 'grid_select' then
@@ -498,15 +498,16 @@ function mainPage:eventHandler(event)
end
function mainPage.statusBar:draw()
local computer = self.values[1]
if computer then
if computer.fuel then
computer.fuelF = string.format("%dk", math.floor(computer.fuel/1000))
if self.values then
local computer = self.values
if computer then
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
if computer.distance then
computer.distanceF = Util.round(computer.distance, 1)
end
mainPage.statusBar:adjustWidth()
end
UI.StatusBar.draw(self)
end
@@ -558,7 +559,7 @@ Event.onInterval(1, function()
local selected = mainPage.computers:getSelected()
if selected then
local computer = _G.network[selected.id]
mainPage.statusBar.values = { computer }
mainPage.statusBar.values = computer
mainPage.statusBar:draw()
mainPage:sync()
end

View File

@@ -43,7 +43,7 @@ local page = UI.Page {
height = 4,
},
tabs = UI.Tabs {
x = 1, y = 5, rey = -2,
x = 1, y = 5, ey = -2,
scripts = UI.Grid {
tabTitle = 'Run',
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor,

View File

@@ -1375,7 +1375,7 @@ end
--[[-- blankPage --]]--
blankPage = UI.Page()
function blankPage:draw()
self:clear()
self:clear(colors.black)
self:setCursorPos(1, 1)
end

View File

@@ -431,7 +431,7 @@ local itemPage = UI.Page {
event = 'form_cancel',
},
form = UI.Form {
x = 1, y = 2, height = 10, rex = -1,
x = 1, y = 2, height = 10, ex = -1,
[1] = UI.TextEntry {
width = 7,
formLabel = 'Min', formKey = 'low', help = 'Craft if below min'
@@ -573,7 +573,7 @@ local listingPage = UI.Page {
{ text = 'Learn', event = 'learn' },
{ text = 'Forget', event = 'forget' },
{ text = 'Craft', event = 'craft' },
{ text = 'Refresh', event = 'refresh', rx = -8 },
{ text = 'Refresh', event = 'refresh', x = -9 },
},
},
grid = UI.Grid {
@@ -594,7 +594,7 @@ local listingPage = UI.Page {
value = 'Filter',
},
filter = UI.TextEntry {
x = 9, rex = -2,
x = 9, ex = -2,
limit = 50,
backgroundColor = colors.gray,
backgroundFocusColor = colors.gray,
@@ -797,11 +797,11 @@ local learnPage = UI.Dialog {
value = 'Place recipe in turtle'
},
accept = UI.Button {
rx = -13, ry = -2,
x = -14, y = -3,
text = 'Ok', event = 'accept',
},
cancel = UI.Button {
rx = -8, ry = -2,
x = -9, y = -3,
text = 'Cancel', event = 'cancel'
},
statusBar = UI.StatusBar {
@@ -844,12 +844,12 @@ local craftPage = UI.Dialog {
value = '1',
},
accept = UI.Button {
rx = -7, ry = -1,
x = -8, y = -2,
backgroundColor = colors.green,
text = '+', event = 'accept',
},
cancel = UI.Button {
rx = -3, ry = -1,
x = -4, y = -2,
backgroundColor = colors.red,
text = '\215', event = 'cancel'
},

View File

@@ -25,97 +25,97 @@ local page = UI.Page({
stationName = UI.Text({
y = 2,
x = 2,
width = monitor.width - 14,
ex = -14,
height = 3,
backgroundColor = colors.black,
}),
seek = UI.Button({
y = 7,
x = 13,
height = 3,
event = 'seek',
text = ' >> ',
}),
play = UI.Button({
y = 7,
y = -4,
x = 2,
height = 3,
event = 'play',
text = '> / ll',
}),
louder = UI.Button({
y = 7,
x = monitor.width - 15,
width = 3,
seek = UI.Button({
y = -4,
x = 12,
height = 3,
event = 'louder',
text = '+',
event = 'seek',
text = ' >> ',
}),
quiet = UI.Button({
y = 7,
x = monitor.width - 20,
y = -4,
x = -19,
event = 'quiet',
width = 3,
height = 3,
text = '-',
}),
louder = UI.Button({
y = -4,
x = -14,
width = 3,
height = 3,
event = 'louder',
text = '+',
}),
volumeDisplay = UI.Text({
y = 3,
x = monitor.width - 9,
x = -9,
width = 4,
}),
volume1 = UI.Window({
y = monitor.height - 1,
x = monitor.width - 8,
y = -2,
x = -9,
height = 1,
width = 1,
color = colors.white
}),
volume2 = UI.Window({
y = monitor.height - 2,
x = monitor.width - 7,
y = -3,
x = -8,
height = 2,
width = 1,
color = colors.white
}),
volume3 = UI.Window({
y = monitor.height - 3,
x = monitor.width - 6,
y = -4,
x = -7,
height = 3,
width = 1,
color = colors.yellow
}),
volume4 = UI.Window({
y = monitor.height - 4,
x = monitor.width - 5,
y = -5,
x = -6,
height = 4,
width = 1,
color = colors.yellow,
}),
volume5 = UI.Window({
y = monitor.height - 5,
x = monitor.width - 4,
y = -6,
x = -5,
height = 5,
width = 1,
color = colors.orange,
}),
volume6 = UI.Window({
y = monitor.height - 6,
x = monitor.width - 3,
y = -7,
x = -4,
height = 6,
width = 1,
color = colors.orange,
}),
volume7 = UI.Window({
y = monitor.height - 7,
x = monitor.width - 2,
y = -8,
x = -3,
height = 7,
width = 1,
color = colors.red,
}),
volume8 = UI.Window({
y = monitor.height - 8,
x = monitor.width - 1,
y = -9,
x = -2,
height = 8,
width = 1,
color = colors.red,

View File

@@ -282,13 +282,13 @@ local data = Util.readTable('/usr/config/shapes') or { }
local page = UI.Page {
titleBar = UI.TitleBar { title = 'Shapes' },
info = UI.Window { x = 5, y = 3, height = 1 },
startCoord = UI.Button { x = 2, y = 6, text = 'Start ', event = 'startCoord' },
endCoord = UI.Button { x = 2, y = 8, text = 'End ', event = 'endCoord' },
supplies = UI.Button { x = 2, y = 10, text = 'Supplies', event = 'supplies' },
first = UI.Button { x = 2, y = 11, text = 'First', event = 'firstCoord' },
cancel = UI.Button { rx = 2, ry = -2, text = 'Abort', event = 'cancel' },
begin = UI.Button { rx = -7, ry = -2, text = 'Begin', event = 'begin' },
info = UI.Window { x = 5, y = 3, height = 1 },
startCoord = UI.Button { x = 2, y = 6, text = 'Start ', event = 'startCoord' },
endCoord = UI.Button { x = 2, y = 8, text = 'End ', event = 'endCoord' },
supplies = UI.Button { x = 2, y = 10, text = 'Supplies', event = 'supplies' },
first = UI.Button { x = 2, y = 11, text = 'First', event = 'firstCoord' },
cancel = UI.Button { x = 2, y = -3, text = 'Abort', event = 'cancel' },
begin = UI.Button { x = -8, y = -3, text = 'Begin', event = 'begin' },
accelerators = { q = 'quit' },
notification = UI.Notification(),
statusBar = UI.StatusBar(),

View File

@@ -22,52 +22,42 @@ end
multishell.setTitle(multishell.getCurrent(), 'Storage Activity')
UI:configure('StorageActivity', ...)
local changedPage = UI.Page({
grid = UI.Grid({
local changedPage = UI.Page {
grid = UI.Grid {
ey = -6,
columns = {
{ heading = 'Qty', key = 'count', width = 5 },
{ heading = 'Change', key = 'change', width = 6 },
{ heading = 'Name', key = 'displayName', width = UI.term.width - 15 },
{ heading = 'Name', key = 'displayName' },
},
sortColumn = 'displayName',
rey = -6,
}),
buttons = UI.Window({
ry = -4,
height = 5,
},
buttons = UI.Window {
y = -5, height = 5,
backgroundColor = colors.gray,
prevButton = UI.Button({
prevButton = UI.Button {
x = 2, y = 2, height = 3, width = 5,
event = 'previous',
backgroundColor = colors.lightGray,
x = 2,
y = 2,
height = 3,
width = 5,
text = ' < '
}),
resetButton = UI.Button({
},
resetButton = UI.Button {
x = 8, y = 2, height = 3, ex = -8,
event = 'reset',
backgroundColor = colors.lightGray,
x = 8,
y = 2,
height = 3,
rex = -8,
text = 'Reset'
}),
nextButton = UI.Button({
},
nextButton = UI.Button {
x = -6, y = 2, height = 3, width = 5,
event = 'next',
backgroundColor = colors.lightGray,
rx = -5,
y = 2,
height = 3,
width = 5,
text = ' > '
})
}),
},
},
accelerators = {
q = 'quit',
}
})
}
function changedPage.grid:getDisplayValues(row)
row = Util.shallowCopy(row)

File diff suppressed because it is too large Load Diff

1
etc/scripts/abort Normal file
View File

@@ -0,0 +1 @@
turtle.abortAction()