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
local appPage = UI.Page({
backgroundColor = UI.ViewportWindow.defaults.backgroundColor,
menuBar = UI.MenuBar({
showBackButton = not pocket,
buttons = {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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