1
0
mirror of https://github.com/kepler155c/opus synced 2024-12-25 16:10:26 +00:00

ui improvements

This commit is contained in:
kepler155c@gmail.com 2018-10-23 22:33:40 -04:00
parent a59fef30f0
commit adc5eb286d

View File

@ -1232,7 +1232,8 @@ function UI.Page:setFocus(child)
self.focused = child self.focused = child
if not child.focused then if not child.focused then
child.focused = true child.focused = true
self:emit({ type = 'focus_change', focused = child }) child:emit({ type = 'focus_change', focused = child })
--self:emit({ type = 'focus_change', focused = child })
end end
child:focus() child:focus()
@ -2304,13 +2305,13 @@ function UI.Wizard:add(pages)
end end
end end
function UI.Wizard:enable() function UI.Wizard:enable(...)
self.enabled = true self.enabled = true
for _,child in ipairs(self.children) do for _,child in ipairs(self.children) do
if not child.index then if not child.index then
child:enable() child:enable(...)
elseif child.index == 1 then elseif child.index == 1 then
child:enable() child:enable(...)
else else
child:disable() child:disable()
end end
@ -2415,12 +2416,12 @@ function UI.SlideOut:enable()
self.enabled = false self.enabled = false
end end
function UI.SlideOut:show() function UI.SlideOut:show(...)
self:addTransition('expandUp') self:addTransition('expandUp')
self.canvas:setVisible(true) self.canvas:setVisible(true)
self.enabled = true self.enabled = true
for _,child in pairs(self.children) do for _,child in pairs(self.children) do
child:enable() child:enable(...)
end end
self:draw() self:draw()
self:capture(self) self:capture(self)
@ -2973,7 +2974,7 @@ function UI.Chooser:draw()
value = choice.name value = choice.name
end end
self:write(1, 1, '<', bg, colors.black) self:write(1, 1, '<', bg, colors.black)
self:write(2, 1, ' ' .. Util.widthify(value, self.width-4) .. ' ', bg) self:write(2, 1, ' ' .. Util.widthify(tostring(value), self.width-4) .. ' ', bg)
self:write(self.width, 1, '>', bg, colors.black) self:write(self.width, 1, '>', bg, colors.black)
end end
@ -3257,7 +3258,8 @@ function UI.Form:save()
end end
for _,child in pairs(self.children) do for _,child in pairs(self.children) do
if child.formKey then if child.formKey then
if child.pruneEmpty and type(child.value) == 'string' and #child.value == 0 then if (child.pruneEmpty and type(child.value) == 'string' and #child.value == 0) or
(child.pruneEmpty and type(child.value) == 'boolean' and not child.value) then
self.values[child.formKey] = nil self.values[child.formKey] = nil
else else
self.values[child.formKey] = child.value self.values[child.formKey] = child.value