mirror of
https://github.com/kepler155c/opus
synced 2025-03-30 04:06:56 +00:00
optional label for checkboxes
This commit is contained in:
parent
8c794d9107
commit
dc915337a0
@ -3069,12 +3069,18 @@ UI.Checkbox.defaults = {
|
|||||||
backgroundColor = colors.black,
|
backgroundColor = colors.black,
|
||||||
backgroundFocusColor = colors.lightGray,
|
backgroundFocusColor = colors.lightGray,
|
||||||
height = 1,
|
height = 1,
|
||||||
width = 3,
|
|
||||||
accelerators = {
|
accelerators = {
|
||||||
space = 'checkbox_toggle',
|
space = 'checkbox_toggle',
|
||||||
mouse_click = 'checkbox_toggle',
|
mouse_click = 'checkbox_toggle',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function UI.Checkbox:setParent()
|
||||||
|
if not self.width and not self.ex then
|
||||||
|
self.width = (self.label and #self.label or 0) + 3
|
||||||
|
end
|
||||||
|
UI.Window.setParent(self)
|
||||||
|
end
|
||||||
|
|
||||||
function UI.Checkbox:draw()
|
function UI.Checkbox:draw()
|
||||||
local bg = self.backgroundColor
|
local bg = self.backgroundColor
|
||||||
if self.focused then
|
if self.focused then
|
||||||
@ -3084,10 +3090,15 @@ function UI.Checkbox:draw()
|
|||||||
self.value = nil -- TODO: fix form
|
self.value = nil -- TODO: fix form
|
||||||
end
|
end
|
||||||
local text = string.format('[%s]', not self.value and ' ' or self.checkedIndicator)
|
local text = string.format('[%s]', not self.value and ' ' or self.checkedIndicator)
|
||||||
self:write(1, 1, text, bg)
|
local x = 1
|
||||||
self:write(1, 1, self.leftMarker, self.backgroundColor, self.textColor)
|
if self.label then
|
||||||
self:write(2, 1, not self.value and ' ' or self.checkedIndicator, bg)
|
self:write(1, 1, self.label)
|
||||||
self:write(3, 1, self.rightMarker, self.backgroundColor, self.textColor)
|
x = #self.label + 2
|
||||||
|
end
|
||||||
|
self:write(x, 1, text, bg)
|
||||||
|
self:write(x, 1, self.leftMarker, self.backgroundColor, self.textColor)
|
||||||
|
self:write(x + 1, 1, not self.value and ' ' or self.checkedIndicator, bg)
|
||||||
|
self:write(x + 2, 1, self.rightMarker, self.backgroundColor, self.textColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
function UI.Checkbox:focus()
|
function UI.Checkbox:focus()
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
if _G.device.wireless_modem then
|
|
||||||
|
|
||||||
_G.requireInjector(_ENV)
|
|
||||||
local Config = require('config')
|
|
||||||
|
|
||||||
local kernel = _G.kernel
|
|
||||||
|
|
||||||
local config = { }
|
|
||||||
Config.load('gps', config)
|
|
||||||
|
|
||||||
if config.host and type(config.host) == 'table' then
|
|
||||||
kernel.run({
|
|
||||||
title = 'GPS Daemon',
|
|
||||||
hidden = true,
|
|
||||||
path = '/rom/programs/gps',
|
|
||||||
args = { 'host', config.host.x, config.host.y, config.host.z },
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user