Fixed scope bugs
This commit is contained in:
@ -28,7 +28,7 @@ function P:set_tooltip(text)
|
||||
end
|
||||
|
||||
function P:new()
|
||||
widget = {}
|
||||
local widget = {}
|
||||
setmetatable(widget, self)
|
||||
self.__index = self
|
||||
|
||||
|
@ -2,7 +2,9 @@ local widget_types = {
|
||||
arc = require("classes/backlight/arc_widget")
|
||||
}
|
||||
|
||||
local P = {}
|
||||
local P = {
|
||||
name = "backlight"
|
||||
}
|
||||
|
||||
|
||||
---
|
||||
@ -82,13 +84,12 @@ function P:backlight_set(value)
|
||||
self:_update_widget()
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Create new
|
||||
---
|
||||
function P:new(args)
|
||||
-- Arguments
|
||||
b = {
|
||||
local b = {
|
||||
update_interval = args.update_interal or 5,
|
||||
min_value = args.min_value or 1,
|
||||
max_value = args.max_value or 100,
|
||||
@ -99,24 +100,21 @@ function P:new(args)
|
||||
-- if this is false, ui will show an error and most methods will
|
||||
-- do nothing. Updated in _get_status()
|
||||
}
|
||||
setmetatable(b, self)
|
||||
self.__index = self
|
||||
|
||||
b.widget = widget_types[b.widget_type]:new()
|
||||
|
||||
b.widget.widget:connect_signal("button::press",
|
||||
function(_, _, _, button, mods)
|
||||
-- Scroll up
|
||||
if (button == 4) then
|
||||
if (button == 4) then -- Scroll up
|
||||
b:backlight_up()
|
||||
-- Scroll down
|
||||
elseif (button == 5) then
|
||||
elseif (button == 5) then -- Scroll down
|
||||
b:backlight_down()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
setmetatable(b, self)
|
||||
self.__index = self
|
||||
|
||||
-- This timer keeps mute and volume status up-to-date.
|
||||
b.timer = gears.timer {
|
||||
timeout = b.update_interval,
|
||||
|
Reference in New Issue
Block a user