Summary: | Generated python code does not have attributes or a constructor | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | Sean Engelhardt <omniasoltemperat> |
Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | ralf.habacker, xelzifesch |
Priority: | NOR | ||
Version: | 2.17.0 (KDE Applications 15.08.0) | ||
Target Milestone: | 2.18 (KDE Applications 15.12) | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
test case
Test Case with inheritance in Umbrello Test case as image The human-class generated by umbrello Test Case with inheritance in Umbrello (CORRECTED version. Cannot delete the old one) Test case as image (CORRECTED version) The human-class generated by umbrello (CORRECTED version) The human-class I expected (CORRECTED version) |
Description
Sean Engelhardt
2015-11-19 23:33:13 UTC
I can confirm this behaviour. The software is not usable for Python developers right now, unfortunately. Created attachment 96216 [details]
test case
From the appended test case I get the following generated python code: --------------------------------------------- from new_class_1 import * class MyClass(object): """ :version: :author: """ """ ATTRIBUTES my_attribute (private) """ def __init__(self): """ @return : @author """ pass --------------------------------------------- I can see an __init__() method and a doc string refering to the attribute 'my_attribute (private)'. From the initial comment I guess you want to say, that 1. non-static attributes having an initial value should be initialized in the constructor. 2. If there is no constructor defined in the model, the generator should add a constructor, in which non-static attributes could be initialized. 3. static attributes having an initial value should be initialized in the class scope Hello.
> 1. non-static attributes having an initial value should be initialized in the constructor.
> 2. If there is no constructor defined in the model, the generator should add a constructor,
> in which non-static attributes could be initialized.
> 3. static attributes having an initial value should be initialized in the class scope
This is quite accurate. Besides, it must not be necessary to define the __init__ in UML. This would not be a PIM (Platform indipendant model) anymore.
I will attach my Testcase, the code I get and the code I expected.
Created attachment 96230 [details]
Test Case with inheritance in Umbrello
Created attachment 96231 [details]
Test case as image
Created attachment 96232 [details]
The human-class generated by umbrello
Created attachment 96233 [details]
Test Case with inheritance in Umbrello (CORRECTED version. Cannot delete the old one)
Created attachment 96234 [details]
Test case as image (CORRECTED version)
(In reply to Sean Engelhardt from comment #8) > Created attachment 96233 [details] > Test Case with inheritance in Umbrello (CORRECTED version. Cannot delete the > old one) In the bugtracker upload page, you will find the following text: Obsoletes: (optional) Check each existing attachment made obsolete by your new attachment. Added the Code again in paste.kde.org for 1 yr. Sorry for spamming with the attachments, cannot add multiple attachments at once. Human Generated: https://paste.kde.org/p9kdujmqu Human Expected: https://paste.kde.org/poe1nlco8 As Mentioned before, it is basically the constructor which is quite a problem. Its the same when you try to import your code, but this is the topic for another ticket. (Nobody wants to see a __init__ in the PIM) Created attachment 96235 [details]
The human-class generated by umbrello (CORRECTED version)
In case you are able to compile umbrello from git: here (https://gitlab.com/umbrello/test/commits/272972-python-attribute-code-generator) is a branch based on Applications/15.12 containing some related patches, which may fix your issues or could be used as a starting point. Please give it a try. Created attachment 96236 [details] The human-class I expected (CORRECTED version) This is what I expected, but this is maybe not the ideal case. The ideal case would be following the pep8 guidelines see https://www.python.org/dev/peps/pep-0008/ for details > In case you are able to compile umbrello from git:
This is currently not that easy. I still struggle to compile QT since they threw out QtWebKit from GIT. But I will give that a try after the Xmas season.
(In reply to Sean Engelhardt from comment #4) > Hello. > > > 1. non-static attributes having an initial value should be initialized in the constructor. > > 2. If there is no constructor defined in the model, the generator should add a constructor, > > in which non-static attributes could be initialized. > > 3. static attributes having an initial value should be initialized in the class scope > > This is quite accurate. Besides, it must not be necessary to define the > __init__ in UML. This would not be a PIM (Platform indipendant model) > anymore. Umbrello in the current state only supports class attributes and operations. If a class is name MyClass, the constructor has to be modeled by adding a method named MyClass(). (In reply to Ralf Habacker from comment #13) > In case you are able to compile umbrello from git: here > (https://gitlab.com/umbrello/test/commits/272972-python-attribute-code- > generator) is a branch based on Applications/15.12 containing some related > patches, which may fix your issues or could be used as a starting point. > Please give it a try. Did you find any time to take a look ? To have the fixes in 2.18.1 (KDE Applications 15.12.1) it is required to get this into 2016 Jan 6 (see https://techbase.kde.org/Schedules/Applications/15.12_Release_Schedule#Thursday.2C_January_7.2C_2016:_KDE_Applications_15.12.1_tagging) Hi.
> Did you find any time to take a look ?
> To have the fixes in 2.18.1 (KDE Applications 15.12.1) it is required to get this into 2016
> Jan 6 (see ... )
unfortunately I will be pretty busy until 2016-01-15.
I need to finish my paper for "Model Driven Architecture" (master program) until Feb. 15, so I will Definitly take a look at this again before KDE Applications 15.12.2 tagging.
(In reply to Sean Engelhardt from comment #14) > The ideal case would be following the pep8 guidelines > > see https://www.python.org/dev/peps/pep-0008/ for details This is better handled by a different bug covering generated code style Hi. Unfortunately I cannot manage to Build Umbrello on my Arch Linux machine. Umbrello depends too much on KDE4 librarys, which are not available on Arch anymore. what I did: git clone https://gitlab.com/umbrello/test.git and then like the INSTALL told, cd umbrello mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=$HOME/umbrello -DCMAKE_BUILD_TYPE=Debug ../ The error is: --- CMake Error at pics/global/CMakeLists.txt:2 (kde4_install_icons): Unknown CMake command "kde4_install_icons". CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as cmake_minimum_required(VERSION 3.4) should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it. -- Configuring incomplete, errors occurred! (In reply to Sean Engelhardt from comment #20) > Hi. > > Unfortunately I cannot manage to Build Umbrello on my Arch Linux machine. > Umbrello depends too much on KDE4 librarys, which are not available on Arch > anymore. You can build this branch also for KF5 with cmake -DBUILD_KF5=1 <umbrello-source-dir> Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved. |