better colors

This commit is contained in:
kepler155c
2017-09-28 18:53:29 -04:00
parent 3c494e82de
commit 71cdc6341e
9 changed files with 53 additions and 127 deletions

View File

@@ -173,7 +173,6 @@ local getSourceListing = function(source)
end end
local appPage = UI.Page({ local appPage = UI.Page({
backgroundColor = UI.ViewportWindow.defaults.backgroundColor,
menuBar = UI.MenuBar({ menuBar = UI.MenuBar({
showBackButton = not pocket, showBackButton = not pocket,
buttons = { buttons = {

View File

@@ -70,7 +70,6 @@ local methodsPage = UI.Page {
viewportConsole = UI.ViewportWindow { viewportConsole = UI.ViewportWindow {
y = 8, y = 8,
height = UI.term.height - 8, height = UI.term.height - 8,
backgroundColor = colors.brown,
}, },
statusBar = UI.StatusBar { statusBar = UI.StatusBar {
status = 'q to return', status = 'q to return',

View File

@@ -150,6 +150,7 @@ local function getListing(t, path)
end end
local mainPage = UI.Page({ local mainPage = UI.Page({
backgroundColor = colors.black,
menuBar = UI.MenuBar({ menuBar = UI.MenuBar({
buttons = { buttons = {
{ text = 'Groups', event = 'groups' }, { text = 'Groups', event = 'groups' },
@@ -159,7 +160,7 @@ local mainPage = UI.Page({
}), }),
computers = UI.ScrollingGrid({ computers = UI.ScrollingGrid({
y = 2, y = 2,
height = UI.term.height-3, height = UI.term.height-2,
columns = { columns = {
{ heading = 'Label', key = 'label', width = width }, { heading = 'Label', key = 'label', width = width },
}, },
@@ -171,7 +172,7 @@ local mainPage = UI.Page({
{ heading = 'Name', key = 'label', width = width }, { heading = 'Name', key = 'label', width = width },
}, },
sortColumn = 'label', sortColumn = 'label',
height = UI.term.height - 3, height = UI.term.height - 2,
width = width, width = width,
x = UI.term.width - width + 1, x = UI.term.width - width + 1,
y = 2, y = 2,
@@ -190,6 +191,7 @@ local mainPage = UI.Page({
}) })
local editorPage = UI.Page({ local editorPage = UI.Page({
backgroundColor = colors.black,
menuBar = UI.MenuBar({ menuBar = UI.MenuBar({
showBackButton = true, showBackButton = true,
buttons = { buttons = {
@@ -342,10 +344,11 @@ local function nameDialog(f)
local dialog = UI.Dialog({ local dialog = UI.Dialog({
-- x = (UI.term.width - 28) / 2, -- x = (UI.term.width - 28) / 2,
width = 22, width = 22,
height = 6,
title = 'Enter Name', title = 'Enter Name',
form = UI.Form { form = UI.Form {
x = 2, rex = -2, y = 2, x = 2, rex = -2, y = 2,
textEntry = UI.TextEntry({ y = 3, width = 20, limit = 20 }) textEntry = UI.TextEntry({ y = 2, width = 20, limit = 20 })
}, },
}) })
@@ -392,12 +395,16 @@ function groupsPage:eventHandler(event)
end) end)
elseif event.type == 'delete' then elseif event.type == 'delete' then
fs.delete(fs.combine(GROUPS_PATH, self.grid:getSelected().label)) if self.grid:getSelected() then
self:draw() fs.delete(fs.combine(GROUPS_PATH, self.grid:getSelected().label))
self:draw()
end
elseif event.type == 'edit' then elseif event.type == 'edit' then
editorPage.groupName = self.grid:getSelected().label if self.grid:getSelected() then
UI:setPage(editorPage) editorPage.groupName = self.grid:getSelected().label
UI:setPage(editorPage)
end
end end
return UI.Page.eventHandler(self, event) return UI.Page.eventHandler(self, event)

View File

@@ -38,17 +38,9 @@ local policies = {
} }
local page = UI.Page { local page = UI.Page {
--[[
policy = UI.Chooser {
x = 2, y = 8,
choices = {
{ name = ' None ', value = 'none' },
{ name = ' Safe ', value = 'turtleSafe' },
},
},
]]
coords = UI.Window { coords = UI.Window {
x = 2, y = 2, height = 3, rex = -2, backgroundColor = colors.black,
height = 4,
}, },
tabs = UI.Tabs { tabs = UI.Tabs {
x = 1, y = 5, rey = -2, x = 1, y = 5, rey = -2,
@@ -63,7 +55,7 @@ local page = UI.Page {
autospace = true, autospace = true,
}, },
turtles = UI.Grid { turtles = UI.Grid {
tabTitle = 'Sel', tabTitle = 'Select',
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor, backgroundColor = UI.TabBar.defaults.selectedBackgroundColor,
columns = { columns = {
{ heading = 'label', key = 'label' }, { heading = 'label', key = 'label' },
@@ -86,6 +78,7 @@ local page = UI.Page {
disableHeader = true, disableHeader = true,
sortColumn = 'index', sortColumn = 'index',
}, },
--[[
policy = UI.Grid { policy = UI.Grid {
tabTitle = 'Mod', tabTitle = 'Mod',
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor, backgroundColor = UI.TabBar.defaults.selectedBackgroundColor,
@@ -97,8 +90,10 @@ local page = UI.Page {
sortColumn = 'label', sortColumn = 'label',
autospace = true, autospace = true,
}, },
]]
action = UI.Window { action = UI.Window {
tabTitle = 'Act', tabTitle = 'Action',
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor,
moveUp = UI.Button { moveUp = UI.Button {
x = 5, y = 2, x = 5, y = 2,
text = '/\\', text = '/\\',
@@ -177,14 +172,14 @@ end
function page.coords:draw() function page.coords:draw()
local t = self.parent.turtle local t = self.parent.turtle
self:clear()
if t then if t then
self:clear() self:setCursorPos(2, 2)
self:setCursorPos(1, 1)
local ind = 'GPS' local ind = 'GPS'
if not t.point.gps then if not t.point.gps then
ind = 'REL' ind = 'REL'
end end
self:print(string.format('%s : %d,%d,%d\nFuel: %s\n', self:print(string.format('%s : %d,%d,%d\n Fuel: %s\n',
ind, t.point.x, t.point.y, t.point.z, Util.toBytes(t.fuel))) ind, t.point.x, t.point.y, t.point.z, Util.toBytes(t.fuel)))
end end
end end
@@ -305,7 +300,7 @@ function page.tabs.tabBar:selectTab(tabTitle)
if tabTitle then if tabTitle then
config.tab = tabTitle config.tab = tabTitle
Config.update('Turtles', config) Config.update('Turtles', config)
return UI.TabBar.selectTab(self, tab) return UI.TabBar.selectTab(self, tabTitle)
end end
end end
@@ -356,10 +351,10 @@ UI:setPage(page)
local lookup = { local lookup = {
Run = page.tabs.scripts, Run = page.tabs.scripts,
Sel = page.tabs.turtles, Select = page.tabs.turtles,
Inv = page.tabs.inventory, Inv = page.tabs.inventory,
Mod = page.tabs.policy, -- Mod = page.tabs.policy,
Act = page.tabs.action, Action = page.tabs.action,
} }
if lookup[options.tab.value] then if lookup[options.tab.value] then

View File

@@ -104,7 +104,7 @@ function subDB:seedDB()
[ "minecraft:powered_comparator:0" ] = "minecraft:comparator:0", [ "minecraft:powered_comparator:0" ] = "minecraft:comparator:0",
[ "minecraft:piston_head:0" ] = "minecraft:air:0", [ "minecraft:piston_head:0" ] = "minecraft:air:0",
[ "minecraft:piston_extension:0" ] = "minecraft:air:0", [ "minecraft:piston_extension:0" ] = "minecraft:air:0",
[ "minecraft:minecraft:portal:0" ] = "minecraft:air:0", [ "minecraft:portal:0" ] = "minecraft:air:0",
[ "minecraft:double_wooden_slab:0" ] = "minecraft:planks:0", [ "minecraft:double_wooden_slab:0" ] = "minecraft:planks:0",
[ "minecraft:double_wooden_slab:1" ] = "minecraft:planks:1", [ "minecraft:double_wooden_slab:1" ] = "minecraft:planks:1",
[ "minecraft:double_wooden_slab:2" ] = "minecraft:planks:2", [ "minecraft:double_wooden_slab:2" ] = "minecraft:planks:2",
@@ -1423,7 +1423,6 @@ end
--[[-- substitutionPage --]]-- --[[-- substitutionPage --]]--
substitutionPage = UI.Page { substitutionPage = UI.Page {
backgroundColor = colors.gray,
titleBar = UI.TitleBar { titleBar = UI.TitleBar {
previousPage = true, previousPage = true,
title = 'Substitute a block' title = 'Substitute a block'
@@ -1454,7 +1453,6 @@ substitutionPage.menuBar:add({
filterLabel = UI.Text({ filterLabel = UI.Text({
value = 'Search', value = 'Search',
x = UI.term.width-14, x = UI.term.width-14,
textColor = colors.black,
}), }),
filter = UI.TextEntry({ filter = UI.TextEntry({
x = UI.term.width-7, x = UI.term.width-7,
@@ -1474,7 +1472,7 @@ function substitutionPage.info:draw()
self:clear() self:clear()
self:setCursorPos(1, 1) self:setCursorPos(1, 1)
self:print(' Replace ' .. inName .. '\n') self:print(' Replace ' .. inName .. '\n')
self:print(' ' .. sub.id .. ':' .. sub.dmg .. '\n', nil, colors.yellow) --self:print(' ' .. sub.id .. ':' .. sub.dmg .. '\n', nil, colors.yellow)
self:print(' With ' .. outName) self:print(' With ' .. outName)
end end
@@ -1860,7 +1858,7 @@ end
--[[-- startPage --]]-- --[[-- startPage --]]--
local wy = 2 local wy = 2
local my = 4 local my = 3
if UI.term.width < 30 then if UI.term.width < 30 then
wy = 9 wy = 9
@@ -1895,6 +1893,7 @@ local startPage = UI.Page {
x = 2, x = 2,
y = my, y = my,
height = 7, height = 7,
backgroundColor = UI.Page.defaults.backgroundColor,
menuItems = { menuItems = {
{ prompt = 'Set starting level', event = 'startLevel' }, { prompt = 'Set starting level', event = 'startLevel' },
{ prompt = 'Set starting block', event = 'startBlock' }, { prompt = 'Set starting block', event = 'startBlock' },
@@ -2161,6 +2160,6 @@ else
turtle.setPolicy(turtle.policies.digAttack) turtle.setPolicy(turtle.policies.digAttack)
turtle.setPoint(SUPPLIES_PT) turtle.setPoint(SUPPLIES_PT)
turtle.point.heading = 0 turtle.point.heading = 0
Event.pullEvents() UI:pullEvents()
end) end)
end end

View File

@@ -425,26 +425,19 @@ local function saveResources()
end end
local itemPage = UI.Page { local itemPage = UI.Page {
backgroundColor = colors.lightGray,
titleBar = UI.TitleBar { titleBar = UI.TitleBar {
title = 'Limit Resource', title = 'Limit Resource',
previousPage = true, previousPage = true,
event = 'form_cancel', event = 'form_cancel',
backgroundColor = colors.green
}, },
form = UI.Form { form = UI.Form {
x = 2, y = 3, height = 8, rex = -4, x = 1, y = 2, height = 10, rex = -1,
margin = 1,
[1] = UI.TextEntry { [1] = UI.TextEntry {
width = 7, width = 7,
backgroundColor = colors.gray,
backgroundFocusColor = colors.gray,
formLabel = 'Min', formKey = 'low', help = 'Craft if below min' formLabel = 'Min', formKey = 'low', help = 'Craft if below min'
}, },
[2] = UI.TextEntry { [2] = UI.TextEntry {
width = 7, width = 7,
backgroundColor = colors.gray,
backgroundFocusColor = colors.gray,
formLabel = 'Max', formKey = 'limit', help = 'Eject if above max' formLabel = 'Max', formKey = 'limit', help = 'Eject if above max'
}, },
[3] = UI.Chooser { [3] = UI.Chooser {
@@ -577,9 +570,10 @@ end
local listingPage = UI.Page { local listingPage = UI.Page {
menuBar = UI.MenuBar { menuBar = UI.MenuBar {
buttons = { buttons = {
{ 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 },
}, },
}, },
grid = UI.Grid { grid = UI.Grid {
@@ -593,20 +587,17 @@ local listingPage = UI.Page {
sortColumn = 'displayName', sortColumn = 'displayName',
}, },
statusBar = UI.StatusBar { statusBar = UI.StatusBar {
backgroundColor = colors.gray, --backgroundColor = colors.gray,
width = UI.term.width, width = UI.term.width,
filterText = UI.Text { filterText = UI.Text {
x = 2, width = 6, x = 2,
value = 'Filter', value = 'Filter',
}, },
filter = UI.TextEntry { filter = UI.TextEntry {
x = 9, width = 19, x = 9, rex = -2,
limit = 50, limit = 50,
}, backgroundColor = colors.gray,
refresh = UI.Button { backgroundFocusColor = colors.gray,
x = 31, width = 8,
text = 'Refresh',
event = 'refresh',
}, },
}, },
accelerators = { accelerators = {
@@ -798,7 +789,6 @@ end
local learnPage = UI.Dialog { local learnPage = UI.Dialog {
height = 7, width = UI.term.width - 6, height = 7, width = UI.term.width - 6,
backgroundColor = colors.lightGray,
title = 'Learn Recipe', title = 'Learn Recipe',
idField = UI.Text { idField = UI.Text {
x = 5, x = 5,
@@ -845,7 +835,6 @@ end
local craftPage = UI.Dialog { local craftPage = UI.Dialog {
height = 6, width = UI.term.width - 10, height = 6, width = UI.term.width - 10,
backgroundColor = colors.lightGray,
title = 'Enter amount to craft', title = 'Enter amount to craft',
idField = UI.TextEntry { idField = UI.TextEntry {
x = 15, x = 15,
@@ -853,8 +842,6 @@ local craftPage = UI.Dialog {
width = 10, width = 10,
limit = 6, limit = 6,
value = '1', value = '1',
backgroundColor = colors.black,
backgroundFocusColor = colors.black,
}, },
accept = UI.Button { accept = UI.Button {
rx = -7, ry = -1, rx = -7, ry = -1,
@@ -864,7 +851,6 @@ local craftPage = UI.Dialog {
cancel = UI.Button { cancel = UI.Button {
rx = -3, ry = -1, rx = -3, ry = -1,
backgroundColor = colors.red, backgroundColor = colors.red,
backgroundFocusColor = colors.red,
text = '\215', event = 'cancel' text = '\215', event = 'cancel'
}, },
} }

View File

@@ -18,6 +18,8 @@ UI:configure('Music', ...)
local monitor = UI.term local monitor = UI.term
UI.Button.defaults.backgroundFocusColor = colors.gray
local page = UI.Page({ local page = UI.Page({
volume = 15, volume = 15,
stationName = UI.Text({ stationName = UI.Text({
@@ -25,7 +27,7 @@ local page = UI.Page({
x = 2, x = 2,
width = monitor.width - 14, width = monitor.width - 14,
height = 3, height = 3,
backgroundColor = colors.brown, backgroundColor = colors.black,
}), }),
seek = UI.Button({ seek = UI.Button({
y = 7, y = 7,

View File

@@ -735,9 +735,14 @@
}, },
"skull": { "skull": {
"id": 144, "id": 144,
"name": "Mob Head", "name": ["Skeleton Skull",
"Wither Skeleton Skull",
"Zombie Head",
"Human Head",
"Creeper Head",
"Dragon Head"]
"place": "mobhead", "place": "mobhead",
}, },
"anvil": { "anvil": {
"id": 145, "id": 145,
"name": ["Anvil", "name": ["Anvil",
@@ -1461,10 +1466,6 @@
"id": 295, "id": 295,
"name": "Wheat Seeds", "name": "Wheat Seeds",
}, },
"wheat": {
"id": 296,
"name": "Wheat"
},
"bread": { "bread": {
"id": 297, "id": 297,
"name": "Bread" "name": "Bread"
@@ -1574,10 +1575,6 @@
"id": 323, "id": 323,
"name": "Sign", "name": "Sign",
}, },
"wooden_door": {
"id": 324,
"name": "Oak Door"
},
"bucket": { "bucket": {
"id": 325, "id": 325,
"name": "Bucket" "name": "Bucket"
@@ -1598,10 +1595,6 @@
"id": 329, "id": 329,
"name": "Saddle" "name": "Saddle"
}, },
"iron_door": {
"id": 330,
"name": "Iron Door"
},
"redstone": { "redstone": {
"id": 331, "id": 331,
"name": "Redstone Dust", "name": "Redstone Dust",
@@ -1630,10 +1623,6 @@
"id": 337, "id": 337,
"name": "Clay" "name": "Clay"
}, },
"reeds": {
"id": 338,
"name": "Sugar Canes"
},
"paper": { "paper": {
"id": 339, "id": 339,
"name": "Paper" "name": "Paper"
@@ -1713,10 +1702,6 @@
"id": 353, "id": 353,
"name": "Sugar" "name": "Sugar"
}, },
"cake": {
"id": 354,
"name": "Cake"
},
"bed-block": { "bed-block": {
"id": 355, "id": 355,
"name": "Bed", "name": "Bed",
@@ -1787,10 +1772,6 @@
"id": 371, "id": 371,
"name": "Gold Nugget" "name": "Gold Nugget"
}, },
"nether_wart": {
"id": 372,
"name": "Nether Wart"
},
"potion": { "potion": {
"id": 373, "id": 373,
"name": "Potion" "name": "Potion"
@@ -1815,14 +1796,6 @@
"id": 378, "id": 378,
"name": "Magma Cream" "name": "Magma Cream"
}, },
"brewing_stand": {
"id": 379,
"name": "Brewing Stand"
},
"cauldron": {
"id": 380,
"name": "Cauldron"
},
"ender_eye": { "ender_eye": {
"id": 381, "id": 381,
"name": "Eye of Ender" "name": "Eye of Ender"
@@ -1859,10 +1832,6 @@
"id": 389, "id": 389,
"name": "Item Frame" "name": "Item Frame"
}, },
"flower_pot": {
"id": 390,
"name": "Flower Pot"
},
"carrot": { "carrot": {
"id": 391, "id": 391,
"name": "Carrot", "name": "Carrot",
@@ -1887,15 +1856,6 @@
"id": 396, "id": 396,
"name": "Golden Carrot" "name": "Golden Carrot"
}, },
"skull": {
"id": 397,
"name": ["Skeleton Skull",
"Wither Skeleton Skull",
"Zombie Head",
"Human Head",
"Creeper Head",
"Dragon Head"]
},
"carrot_on_a_stick": { "carrot_on_a_stick": {
"id": 398, "id": 398,
"name": "Carrot on a Stick" "name": "Carrot on a Stick"
@@ -2009,26 +1969,6 @@
"id": 425, "id": 425,
"name": "Banner", "name": "Banner",
}, },
"spruce_door": {
"id": 427,
"name": "Spruce Door"
},
"birch_door": {
"id": 428,
"name": "Birch Door"
},
"jungle_door": {
"id": 429,
"name": "Jungle Door"
},
"acacia_door": {
"id": 430,
"name": "Acacia Door"
},
"dark_oak_door": {
"id": 431,
"name": "Dark Oak Door"
},
"chorus_fruit": { "chorus_fruit": {
"id": 432, "id": 432,
"name": "Chorus Fruit" "name": "Chorus Fruit"

View File

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