No 'label' or 'icon' property when defined in custom class
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 491
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
My custom class: https://github.com/ExpidusOS/shell/blob/master/share/expidus-shell/expidus/widgets/app-button.lua
local lgi = require('lgi')
local Gtk = lgi.Gtk
local GObject = lgi.GObject
local Expidus = lgi.package('Expidus')
Expidus:class('AppButton', Gtk.FlowBoxChild)
Expidus.AppButton._property.label = GObject.ParamSpecString('label', 'Application label', 'Label', 'App', { 'READABLE', 'WRITABLE', 'CONSTRUCT' })
Expidus.AppButton._property.icon = GObject.ParamSpecString('icon', 'Application icon', 'Icon', 'app-icon-unknown', { 'READABLE', 'WRITABLE', 'CONSTRUCT' })
function Expidus.AppButton:_init()
end
function Expidus.AppButton:_class_init()
end
return Expidus.AppButton
Code that calls my class: https://github.com/ExpidusOS/shell/blob/master/share/expidus-shell/expidus/launcher.lua
ExpidusAppButton{
label = entry.label,
icon = entry.icon
}
Result:
2020-11-03 19:57:07 E: awesome: Error during a protected call: ./expidus/launcher.lua:55: Expidus.AppButton: no `label'
stack traceback:
[C]: in function 'error'
/usr/share/lua/5.3/lgi/component.lua:160: in function </usr/share/lua/5.3/lgi/component.lua:156>
[C]: in metamethod '__newindex'
./expidus/launcher.lua:55: in upvalue 'callback'
/usr/share/awesome/lib/menubar/menu_gen.lua:128: in function </usr/share/awesome/lib/menubar/menu_gen.lua:93>
(...tail calls...)
/usr/share/awesome/lib/menubar/utils.lua:409: in function </usr/share/awesome/lib/menubar/utils.lua:406>
[C]: in function 'xpcall'
/usr/share/awesome/lib/gears/protected_call.lua:36: in function </usr/share/awesome/lib/gears/protected_call.lua:35>
(...tail calls...)
Note that I've reduced the calling code down so I don't have the entire file pasted.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with share/expidus-shell/expidus/widgets/app-button.lua and share/expidus-shell/expidus/launcher.lua to reproduce the custom-class initialization, then inspect /usr/share/lua/5.3/lgi/component.lua around the reported property assignment. Done means custom label and icon properties are accepted when ExpidusAppButton is constructed, without the reported no-property error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100