diff --git a/sys/apis/ui.lua b/sys/apis/ui.lua index 70b6dbc..cafd5aa 100644 --- a/sys/apis/ui.lua +++ b/sys/apis/ui.lua @@ -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') diff --git a/sys/apis/util.lua b/sys/apis/util.lua index d016feb..53ee6cd 100644 --- a/sys/apis/util.lua +++ b/sys/apis/util.lua @@ -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") diff --git a/sys/apps/system/kiosk.lua b/sys/apps/system/kiosk.lua index 56fe588..89a24e2 100644 --- a/sys/apps/system/kiosk.lua +++ b/sys/apps/system/kiosk.lua @@ -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')