[Uml-devel] [Bug 131790] python code generation not independent of diagram view
Oliver Kellogg
okellogg at users.sourceforge.net
Thu Aug 3 19:12:14 UTC 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=131790
okellogg users sourceforge net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From okellogg users sourceforge net 2006-08-03 21:12 -------
SVN commit 569409 by okellogg:
writeClass(): Patch from Egbert Voigt adds missing imports for superclasses.
BUG:131790
M +7 -0 ChangeLog
M +22 -7 umbrello/codegenerators/pythonwriter.cpp
--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #569408:569409
@ -1,3 +1,10 @
+Version 1.5.5
+
+* Bugs/wishes from http://bugs.kde.org:
+* Java import - importing interfaces - absent visibility treated as package
+ instead of public (131327)
+* Python code generation not independent of diagram view (131790)
+
Version 1.5.4
* Bugs/wishes from http://bugs.kde.org:
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.cpp #569408:569409
@ -87,7 +87,23 @
h<<str<<m_endl;
}
-
+ // generate import statement for superclasses and take packages into account
+ str = cleanName(c->getName());
+ QString pkg = cleanName(c->getPackage());
+ if (!pkg.isEmpty())
+ str.prepend(pkg + ".");
+ QStringList includesList = QStringList(str); //save imported classes
+ int i = superclasses.count();
+ for (UMLClassifier *classifier = superclasses.first();
+ classifier && i; classifier = superclasses.next(), i--) {
+ str = cleanName(classifier->getName());
+ pkg = cleanName(classifier->getPackage());
+ if (!pkg.isEmpty())
+ str.prepend(pkg + ".");
+ includesList.append(str);
+ h << "from " + str + " import *" << m_endl;
+ }
+
//write includes and take namespaces into account
UMLClassifierList includes;
findObjectsRelated(c,includes);
@ -99,16 +115,15 @
first = headerName.at(0);
first = first.upper();
headerName = headerName.replace(0, 1, first);
- if (headerName.find('/') > 0)
- h<<"from "<<headerName.replace(QChar('/'),QChar('.'))<<" import *"<<m_endl;
- else
- h<<"from "<<headerName<<" import *"<<m_endl;
+ str = headerName.replace(QChar('/'),QChar('.'));
+ if (includesList.findIndex(str) < 0) // not yet imported
+ h << "from " << str << " import *" << m_endl;
}
}
h<<m_endl;
- h<<"class "<<classname<<(superclasses.count() > 0 ? " (":"");
- int i = superclasses.count();
+ h << "class " << classname << (superclasses.count() > 0 ? " (" : "(object)");
+ i = superclasses.count();
for (UMLClassifier *obj = superclasses.first();
obj && i; obj = superclasses.next(), i--) {
More information about the umbrello-devel
mailing list