updates for environment handling changes

This commit is contained in:
kepler155c@gmail.com
2020-05-11 17:26:43 -06:00
parent 759e4e2b95
commit ad32dcc2df
17 changed files with 200 additions and 149 deletions

View File

@@ -57,7 +57,7 @@ local function downloadApp(app)
end
local function runApp(app, checkExists, ...)
local env = shell.makeEnv()
local env = shell.makeEnv(_ENV)
local path, fn
local args = { ... }
@@ -83,9 +83,8 @@ local function runApp(app, checkExists, ...)
end
end
multishell.openTab({
multishell.openTab(_ENV, {
title = app.name,
env = env,
path = path,
fn = fn,
focused = true,

View File

@@ -67,7 +67,7 @@ local page = UI.Page {
self.menuBar:draw()
elseif event.type == 'grid_select' then
multishell.openTab({
multishell.openTab(_ENV, {
path = 'sys/apps/Lua.lua',
args = { event.selected },
focused = true,

View File

@@ -223,7 +223,7 @@ page = UI.Page {
fn = 'turtle.turnRight',
},
info = UI.TextArea {
x = 15, y = 2,
x = 15, y = 1,
inactive = true,
},
showBlocks = function(self)
@@ -240,13 +240,13 @@ page = UI.Page {
return string.format('%s\n%s\n%s', bu, bf, bd)
]]
local s, m = self:runFunction(script, true)
local s, m = page:runFunction(script, true)
self.info:setText(s or m)
end,
eventHandler = function(self, event)
if event.type == 'button_press' then
if event.button.fn then
self:runFunction(event.button.fn, event.button.nowrap)
page:runFunction(event.button.fn, event.button.nowrap)
self:showBlocks()
end
return true

View File

@@ -24,6 +24,7 @@ _G._syslog = function(...)
local oldTerm = term.redirect(mon)
Util.print(...)
term.redirect(oldTerm)
oldDebug(...)
end
repeat

View File

@@ -1024,7 +1024,7 @@ actions = {
else
local fn, msg = load(_concat(tLines, '\n'), fileInfo.path)
if fn then
multishell.openTab({
multishell.openTab(_ENV, {
fn = fn,
focused = true,
title = fs.getName(fileInfo.path),
@@ -1544,5 +1544,5 @@ local s, m = pcall(function() UI:start() end)
if not s then
actions.save('/crash.txt')
print('Editor has crashed. File saved as /crash.txt')
error(m)
error(m, -1)
end

View File

@@ -1,4 +1,3 @@
_G.requireInjector(_ENV)
local config = require('opus.config').load('gps')
if config.home then
if turtle.enableGPS() then

View File

@@ -1,8 +1,6 @@
local turtle = _G.turtle
turtle.run(function()
_G.requireInjector(_ENV)
local GPS = require('opus.gps')
if not turtle.enableGPS() then

View File

@@ -1,4 +1,3 @@
_G.requireInjector(_ENV)
local Config = require('opus.config')
local pt = turtle.enableGPS()
if pt then

View File

@@ -1,7 +1,4 @@
local function summon(id)
_G.requireInjector(_ENV)
local GPS = require('opus.gps')
local Point = require('opus.point')
local Socket = require('opus.socket')

View File

@@ -61,7 +61,7 @@ end
if options.daemon then
_G.device.keyboard.addHotkey('control-P', function()
multishell.openTab({
multishell.openTab(_ENV, {
path = 'sys/apps/shell.lua',
args = { arg[0], '--noResize', '--rawOutput', 'recorder.gif' },
})