diff --git a/sys/apis/ui.lua b/sys/apis/ui.lua index 712b600..361484d 100644 --- a/sys/apis/ui.lua +++ b/sys/apis/ui.lua @@ -263,6 +263,7 @@ function Manager:click(target, code, button, x, y) if clickEvent.element.focus then target:setFocus(clickEvent.element) end +_G._p = clickEvent self:inputEvent(clickEvent.element, clickEvent) target:sync() diff --git a/sys/apis/ui/components/ActiveLayer.lua b/sys/apis/ui/components/ActiveLayer.lua index 8f84a4e..94354fe 100644 --- a/sys/apis/ui/components/ActiveLayer.lua +++ b/sys/apis/ui/components/ActiveLayer.lua @@ -5,11 +5,13 @@ UI.ActiveLayer = class(UI.Window) UI.ActiveLayer.defaults = { UIElement = 'ActiveLayer', } -function UI.ActiveLayer:setParent() - self:layout(self) - self.canvas = self:addLayer() - - UI.Window.setParent(self) +function UI.ActiveLayer:layout() + UI.Window.layout(self) + if not self.canvas then + self.canvas = self:addLayer() + else + self.canvas:resize(self.width, self.height) + end end function UI.ActiveLayer:enable(...) diff --git a/sys/apis/ui/components/Embedded.lua b/sys/apis/ui/components/Embedded.lua index 626516f..ad4db59 100644 --- a/sys/apis/ui/components/Embedded.lua +++ b/sys/apis/ui/components/Embedded.lua @@ -32,6 +32,13 @@ function UI.Embedded:setParent() self.win.clear() end +function UI.Embedded:layout() + UI.Window.layout(self) + if self.win then + self.win.reposition(self.x, self.y, self.width, self.height) + end +end + function UI.Embedded:draw() self.canvas:dirty() end diff --git a/sys/apps/system/kiosk.lua b/sys/apps/system/kiosk.lua index d75bec2..56fe588 100644 --- a/sys/apps/system/kiosk.lua +++ b/sys/apps/system/kiosk.lua @@ -1,5 +1,6 @@ local UI = require('ui') +local colors = _G.colors local device = _G.device local peripheral = _G.peripheral local settings = _G.settings @@ -8,7 +9,7 @@ local tab = UI.Tab { tabTitle = 'Kiosk', description = 'Kiosk options', form = UI.Form { - x = 2, + x = 2, ex = -2, manualControls = true, monitor = UI.Chooser { formLabel = 'Monitor', formKey = 'monitor', @@ -22,6 +23,11 @@ local tab = UI.Tab { }, help = 'Adjust text scaling', }, + labelText = UI.TextArea { + x = 2, ex = -2, y = 5, + textColor = colors.yellow, + value = 'Settings apply to kiosk mode selected during startup' + }, }, } diff --git a/sys/apps/system/network.lua b/sys/apps/system/network.lua index 4f2199e..11f3c00 100644 --- a/sys/apps/system/network.lua +++ b/sys/apps/system/network.lua @@ -1,3 +1,4 @@ +local Ansi = require('ansi') local Config = require('config') local UI = require('ui') @@ -6,17 +7,20 @@ local device = _G.device local tab = UI.Tab { tabTitle = 'Network', description = 'Networking options', - form = UI.Form { - x = 2, - manualControls = true, - modem = UI.Chooser { - formLabel = 'Modem', formKey = 'modem', - nochoice = 'auto', - }, - update = UI.Button { - x = 9, y = 4, - text = 'Update', event = 'form_complete', - }, + info = UI.TextArea { + x = 3, y = 4, + value = string.format( +[[%sSet the primary modem used for wireless communications.%s + +Reboot to take effect.]], Ansi.yellow, Ansi.reset) + }, + label = UI.Text { + x = 3, y = 2, + value = 'Modem', + }, + modem = UI.Chooser { + x = 10, ex = -3, y = 2, + nochoice = 'auto', }, } @@ -34,19 +38,19 @@ function tab:enable() end end - self.form.modem.choices = choices - self.form.modem.width = width + 4 + self.modem.choices = choices + --self.modem.width = width + 4 local config = Config.load('os') - self.form.modem.value = config.wirelessModem or 'auto' + self.modem.value = config.wirelessModem or 'auto' UI.Tab.enable(self) end function tab:eventHandler(event) - if event.type == 'form_complete' then + if event.type == 'choice_change' then local config = Config.load('os') - config.wirelessModem = self.form.modem.value + config.wirelessModem = self.modem.value Config.update('os', config) self:emit({ type = 'success_message', message = 'reboot to take effect' }) return true diff --git a/sys/apps/system/password.lua b/sys/apps/system/password.lua index 4c45616..5f705a6 100644 --- a/sys/apps/system/password.lua +++ b/sys/apps/system/password.lua @@ -2,18 +2,20 @@ local Security = require('security') local SHA1 = require('sha1') local UI = require('ui') +local colors = _G.colors + local passwordTab = UI.Tab { tabTitle = 'Password', description = 'Wireless network password', oldPass = UI.TextEntry { - x = 2, y = 2, ex = -2, + x = 3, ex = -3, y = 2, limit = 32, mask = true, shadowText = 'old password', inactive = not Security.getPassword(), }, newPass = UI.TextEntry { - y = 3, x = 2, ex = -2, + x = 3, ex = -3, y = 3, limit = 32, mask = true, shadowText = 'new password', @@ -22,13 +24,13 @@ local passwordTab = UI.Tab { }, }, button = UI.Button { - x = 2, y = 5, + x = 3, y = 5, text = 'Update', event = 'update_password', }, info = UI.TextArea { - x = 2, ex = -2, - y = 7, + x = 3, ex = -3, y = 7, + textColor = colors.yellow, inactive = true, value = 'Add a password to enable other computers to connect to this one.', }