mirror of
https://github.com/kepler155c/opus
synced 2025-01-01 03:10:28 +00:00
remove dependency on device global
This commit is contained in:
parent
bd9b2825be
commit
04af12b452
@ -8,7 +8,6 @@ local Util = require('util')
|
||||
local _rep = string.rep
|
||||
local _sub = string.sub
|
||||
local colors = _G.colors
|
||||
local device = _G.device
|
||||
local fs = _G.fs
|
||||
local os = _G.os
|
||||
local peripheral = _G.peripheral
|
||||
@ -914,9 +913,9 @@ UI.Device.defaults = {
|
||||
function UI.Device:postInit()
|
||||
self.device = self.device or term.current()
|
||||
|
||||
if self.deviceType then
|
||||
self.device = device[self.deviceType]
|
||||
end
|
||||
--if self.deviceType then
|
||||
-- self.device = device[self.deviceType]
|
||||
--end
|
||||
|
||||
if not self.device.setTextScale then
|
||||
self.device.setTextScale = function() end
|
||||
@ -1197,6 +1196,7 @@ end
|
||||
|
||||
loadComponents()
|
||||
|
||||
UI.theme = { }
|
||||
UI:loadTheme('usr/config/ui.theme')
|
||||
if Util.getVersion() >= 1.76 then
|
||||
UI:loadTheme('sys/etc/ext.theme')
|
||||
|
@ -404,6 +404,10 @@ function Util.readFile(fname)
|
||||
end
|
||||
end
|
||||
|
||||
function Util.backupFile(fname)
|
||||
fs.copy(fname, fname .. '.bak')
|
||||
end
|
||||
|
||||
function Util.writeFile(fname, data)
|
||||
if not fname or not data then error('Util.writeFile: invalid parameters', 2) end
|
||||
local file = io.open(fname, "w")
|
||||
|
@ -1,7 +1,6 @@
|
||||
local UI = require('ui')
|
||||
|
||||
local colors = _G.colors
|
||||
local device = _G.device
|
||||
local peripheral = _G.peripheral
|
||||
local settings = _G.settings
|
||||
|
||||
@ -34,11 +33,9 @@ local tab = UI.Tab {
|
||||
function tab:enable()
|
||||
local choices = { }
|
||||
|
||||
for _,v in pairs(device) do
|
||||
if v.type == 'monitor' then
|
||||
table.insert(choices, { name = v.side, value = v.side })
|
||||
end
|
||||
end
|
||||
peripheral.find('monitor', function(side)
|
||||
table.insert(choices, { name = side, value = side })
|
||||
end)
|
||||
|
||||
self.form.monitor.choices = choices
|
||||
self.form.monitor.value = settings.get('kiosk.monitor')
|
||||
|
Loading…
Reference in New Issue
Block a user