Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance behaviour is broken with atom 0.9.0 #519

Closed
gabrielcnr opened this issue Feb 28, 2023 · 1 comment
Closed

Inheritance behaviour is broken with atom 0.9.0 #519

gabrielcnr opened this issue Feb 28, 2023 · 1 comment

Comments

@gabrielcnr
Copy link
Contributor

I updated atom in my environment today from 0.8.2 to 0.9.0 (latest) using the packages from conda-forge.

The behaviour for the inheritance of enaml defined types seem to have been broken on the latest version.

I tried to code a little example that reproduces the issue:

from enaml.widgets.api import *

enamldef UpperLabel(Label):
    attr lower_text
    text << lower_text.upper()

enamldef UpperLabel2(UpperLabel):
    attr some_text
    lower_text << some_text.strip()

enamldef Main(Window):
    Container:
        UpperLabel2:
            some_text << 'Hello World   '

Before this used to work fine and display a widget with the label HELLO WORLD.

It works in an environment with:

enaml 0.15.2
atom 0.8.2
python 3.10.9

However it the gives the following error if you bump atom==0.9.0:

Traceback (most recent call last):
  File "/Users/greis/dev/conda/envs/enaml-bug/bin/enaml-run", line 11, in <module>
    sys.exit(main())
  File "/Users/greis/dev/conda/envs/enaml-bug/lib/python3.10/site-packages/enaml/runner.py", line 61, in main
    exec(code, ns)
  File "enamlbug.enaml", line 1, in
    from enaml.widgets.api import *
  File "enamlbug.enaml", line 1, in UpperLabel2
    from enaml.widgets.api import *
  File "enamlbug.enaml", line 11, in UpperLabel2
    lower_text << some_text.strip()
TypeError: 'lower_text' is not a declarative member
@MatthieuDartiailh
Copy link
Member

You need to update enaml to 0.16.0. Atom 0.9.0 fixed a nasty inheritance bug and to do so had to modify how a member can be added to a class after its definition. Enaml 0.16.0 uses the new way and should work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants