Add a `gen_vertical_space` function to keep spacing from missalignment.

This commit is contained in:
Aire-One 2019-10-03 17:42:16 +02:00 committed by Emmanuel Lepage Vallee
parent 4abb05c590
commit dd69936bed
1 changed files with 10 additions and 5 deletions

View File

@ -368,6 +368,14 @@ local function wrap_timeline(w, dot)
} }
end end
local function gen_vertical_space(spacing)
return wibox.widget {
draw = function() end,
fit = function() return 1, spacing end,
widget = wibox.widget.base.make_widget()
}
end
local function gen_label(text) local function gen_label(text)
return wibox.widget { return wibox.widget {
gen_vertical_line { gen_vertical_line {
@ -663,6 +671,7 @@ local function gen_timeline(args)
for _, event in ipairs(history) do for _, event in ipairs(history) do
local ret = event.callback() local ret = event.callback()
if event.event == "event" then if event.event == "event" then
l:add(wrap_timeline(gen_vertical_space(5)))
l:add(wrap_timeline(wibox.widget { l:add(wrap_timeline(wibox.widget {
markup = "<u><b>"..event.description.."</b></u>", markup = "<u><b>"..event.description.."</b></u>",
widget = wibox.widget.textbox widget = wibox.widget.textbox
@ -675,11 +684,7 @@ local function gen_timeline(args)
end end
-- Spacing. -- Spacing.
l:add(wrap_timeline( wibox.widget { l:add(wrap_timeline(gen_vertical_space(10)))
draw = function() end,
fit = function() return 1, 10 end,
widget = wibox.widget.base.make_widget()
}))
l:add(gen_label("End")) l:add(gen_label("End"))