tests: Minor changes to the wibox template.

This commit is contained in:
Emmanuel Lepage Vallee 2016-10-09 01:32:31 -04:00
parent ffead7dcda
commit 9e01c92ea2
4 changed files with 20 additions and 15 deletions

View File

@ -8,9 +8,9 @@ local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3, forced_num_cols = 3,
forced_num_rows = 2, forced_num_rows = 2,
homogeneous = true, homogeneous = true,
}, 6, "add_widget_at", {wibox.widget( --DOC_HIDE }, 6, "add_widget_at", {--DOC_HIDE
generic_widget("__new__",beautiful.bg_highlight) --DOC_HIDE generic_widget("__new__",beautiful.bg_highlight) --DOC_HIDE
), 1, 4, 1, 1 --DOC_HIDE , 1, 4, 1, 1 --DOC_HIDE
}) --DOC_HIDE }) --DOC_HIDE
return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE

View File

@ -1,13 +1,13 @@
local generic_widget = ... --DOC_NO_USAGE --DOC_HIDE local generic_widget = ... --DOC_NO_USAGE --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE local wibox = require("wibox") --DOC_HIDE
local first = wibox.widget(generic_widget( "first" )) --DOC_HIDE local first = generic_widget( "first" ) --DOC_HIDE
local second = wibox.widget(generic_widget( "second" )) --DOC_HIDE local second = generic_widget( "second" ) --DOC_HIDE
local third = wibox.widget(generic_widget( "t\nh\ni\nr\nd" )) --DOC_HIDE local third = generic_widget( "t\nh\ni\nr\nd" ) --DOC_HIDE
local fourth = wibox.widget(generic_widget( "fourth" )) --DOC_HIDE local fourth = generic_widget( "fourth" ) --DOC_HIDE
local fifth = wibox.widget(generic_widget( "fifth" )) --DOC_HIDE local fifth = generic_widget( "fifth" ) --DOC_HIDE
local lorem = wibox.widget(generic_widget("Lorem ipsum dolor sit amet, consectetur " .. --DOC_HIDE local lorem = generic_widget("Lorem ipsum dolor sit amet, consectetur " .. --DOC_HIDE
"adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")) --DOC_HIDE "adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.") --DOC_HIDE
local l = wibox.widget { local l = wibox.widget {
homogeneous = true, homogeneous = true,

View File

@ -13,8 +13,8 @@ local w = wibox.widget {
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
w:add_widget_at(wibox.widget( w:add_widget_at(
generic_widget("fifth",beautiful.bg_highlight) generic_widget("fifth",beautiful.bg_highlight)
), 1, 1, 1, 2) , 1, 1, 1, 2)
return w, w:fit({dpi=96}, 9999, 9999) return w, w:fit({dpi=96}, 9999, 9999)

View File

@ -8,7 +8,7 @@ local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibil
-- Create a generic rectangle widget to show layout disposition -- Create a generic rectangle widget to show layout disposition
local function generic_widget(text, col) local function generic_widget(text, col)
return { return wibox.widget {
{ {
{ {
draw = function(_, _, cr, width, height) draw = function(_, _, cr, width, height)
@ -21,15 +21,20 @@ local function generic_widget(text, col)
end, end,
widget = wibox.widget.base.make_widget widget = wibox.widget.base.make_widget
}, },
text and { {
id = "text",
align = "center", align = "center",
valign = "center", valign = "center",
text = text, text = text or "foobar",
widget = wibox.widget.textbox widget = wibox.widget.textbox
} or nil, } or nil,
widget = wibox.layout.stack widget = wibox.layout.stack
}, },
margins = 5, margins = 5,
set_text = function(self, text2)
self:get_children_by_id("text")[1]:set_text(text2)
end,
is_widget = true,
widget = wibox.container.margin, widget = wibox.container.margin,
} }
end end
@ -61,7 +66,7 @@ local function generic_before_after(layout, layout_args, count, method, method_a
local l = wibox.layout(args) local l = wibox.layout(args)
for j=1, count or 3 do for j=1, count or 3 do
l:add(wibox.widget(generic_widget(names[j] or "N/A"))) l:add(generic_widget(names[j] or "N/A"))
end end
ls[i] = l ls[i] = l