daboide Commit
Revision 648
Date: 2006-10-10 05:42:45 -0700 (Tue, 10 Oct 2006)
Author: ed

Changed:
U   trunk/ClassDesignerFormMixin.py

Log:
Fixed a lot of the code that handles import statements in the Class Designer. 
There are still some issue with code from embedded custom classes; I need to 
review these behaviors throroughly.


Diff:
Modified: trunk/ClassDesignerFormMixin.py
===================================================================
--- trunk/ClassDesignerFormMixin.py     2006-10-10 01:06:52 UTC (rev 647)
+++ trunk/ClassDesignerFormMixin.py     2006-10-10 12:42:45 UTC (rev 648)
@@ -325,8 +325,8 @@
                        self.app.saveAllProps = True
                        propDict = self.getClassDesignerDict(obj)
                        self.app.saveAllProps = False
-               
-               imp = self.app._classImportDict.get(self, "")
+
+               imp = self.app.getImportDict(self)
                if imp:
                        cd = propDict.get("code", {})
                        cd.update({"importStatements": imp})
@@ -352,10 +352,16 @@
                body = []
 
                for codeKey, mthds in cd.items():
+                       # Add the import statements first, if any
+                       try:
+                               code = mthds.pop("importStatements").strip()
+                               while not code.endswith("\n\n"):
+                                       code += "\n"
+                       except KeyError:
+                               code = ""
                        # Sort the methods alphabetically
                        mthNames = mthds.keys()
                        mthNames.sort()
-                       code = ""
                        for mthd in mthNames:
                                code += mthds[mthd].strip()
                                while not code.endswith("\n\n"):




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to