Bug 158739 - Python Import Classes does not import Attributes
Summary: Python Import Classes does not import Attributes
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-03 21:39 UTC by Mike Smiley
Modified: 2016-09-02 08:59 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.20.1 (KDE Applications 16.08.1)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Smiley 2008-03-03 21:39:54 UTC
Version:           1.5.8 (using KDE 3.5.8)
Installed from:    Unlisted Binary Package
OS:                Linux

Not sure if this is a bug or a wishlist item, but using the Code->Import Classes facility does not import class attributes from Python code for me.

Steps to test:
1. create class
2. add attribute(s)
3. export code as Python
4. new Umbrello project
5. Code->Import Classes, browse to exported code above
6. no attribute(s)

I tested with the above method as well as with my own code that correctly shows attributes with gaphor application.
Comment 1 Oliver Kellogg 2012-05-24 18:54:56 UTC
Certainly doable - but finding out the data type of an attribute might be hard.
Comment 2 Ralf Habacker 2016-09-01 17:30:07 UTC
Git commit 2d452ec81ad95e4788505f21cb4e0de50fed8505 by Ralf Habacker.
Committed on 01/09/2016 at 17:29.
Pushed by habacker into branch 'Applications/16.08'.

Fix 'Python Import Classes does not import Attributes'.

This commit adds support for parsing class attributes and
includes related test cases. Attribute types are estimated
from the initialisation value.
For supported types see test/import/python/types.py, for
supported visibilities test/import/python/visibility.py
FIXED-IN:2.20.1 (KDE Applications 16.08.1)

A  +10   -0    test/import/python/types.py
A  +19   -0    test/import/python/visibility.py
M  +11   -0    umbrello/codeimport/nativeimportbase.cpp
M  +1    -0    umbrello/codeimport/nativeimportbase.h
M  +44   -0    umbrello/codeimport/pythonimport.cpp

http://commits.kde.org/umbrello/2d452ec81ad95e4788505f21cb4e0de50fed8505
Comment 3 Ralf Habacker 2016-09-02 08:59:21 UTC
Git commit 43d647747fe4720c9f5e63d4fdda0c1368b05ed9 by Ralf Habacker.
Committed on 02/09/2016 at 05:40.
Pushed by habacker into branch 'Applications/16.08'.

Refactor python assignment parser into separate method supporting class variables.

Instance variables will be handled by this method too.

M  +10   -7    test/import/python/types.py
M  +54   -41   umbrello/codeimport/pythonimport.cpp
M  +2    -0    umbrello/codeimport/pythonimport.h

http://commits.kde.org/umbrello/43d647747fe4720c9f5e63d4fdda0c1368b05ed9
Comment 4 Ralf Habacker 2016-09-02 08:59:22 UTC
Git commit f8becb1075451f046230d3c41fd50e1d606258e4 by Ralf Habacker.
Committed on 02/09/2016 at 08:59.
Pushed by habacker into branch 'Applications/16.08'.

Add support for parsing python instance variables.

Instance variables are parsed from __init__ method
only according to python 3 tutorial.

M  +14   -0    test/import/python/types.py
M  +29   -1    umbrello/codeimport/pythonimport.cpp

http://commits.kde.org/umbrello/f8becb1075451f046230d3c41fd50e1d606258e4
Comment 5 Ralf Habacker 2016-09-02 08:59:23 UTC
Git commit dac2d69cba81cc00a47ba4d4e5bb462066ab6ced by Ralf Habacker.
Committed on 02/09/2016 at 05:40.
Pushed by habacker into branch 'Applications/16.08'.

Add 'list' to python code generator list of default data types.

This type is required by python import, which uses the generator
data type list too.

M  +1    -0    umbrello/codegenerators/python/pythonwriter.cpp

http://commits.kde.org/umbrello/dac2d69cba81cc00a47ba4d4e5bb462066ab6ced