daboide Commit
Revision 642
Date: 2006-10-04 17:27:06 -0700 (Wed, 04 Oct 2006)
Author: ed
Changed:
U trunk/ClassDesigner.py
U trunk/ClassDesignerComponents.py
Log:
Improved the handling of relative pathing. Incorporated the changes made to the
dabo.lib.utils routines into the code for both saving paths and re-creating
those values when creating objects from XML-based files.
Diff:
Modified: trunk/ClassDesigner.py
===================================================================
--- trunk/ClassDesigner.py 2006-09-30 13:50:22 UTC (rev 641)
+++ trunk/ClassDesigner.py 2006-10-05 00:27:06 UTC (rev 642)
@@ -448,6 +448,9 @@
else:
atts = {}
nm = "ClassDesignerForm"
+
+ # Convert any paths in the atts
+ dabo.lib.utils.resolveAttributePathing(atts, pth)
if self._reuseMainForm():
# Original form hasn't changed, so just use it.
frm = self.MainForm
@@ -498,7 +501,9 @@
# Add the class to the form
kids = clsd
# Add the child objects recursively
+ self._basePath = pth
obj = self.recreateChildren(frm.mainPanel, kids, None, False)
+ self._basePath = None
if obj:
self.select(obj)
# Show it!
@@ -516,6 +521,8 @@
chld = [chld]
for dct in chld:
atts = dct["attributes"]
+ # Convert any paths in the atts
+ dabo.lib.utils.resolveAttributePathing(atts,
self._basePath)
clsname = self._extractKey(atts, "designerClass", "")
# See if this is a saved class inserted into another
design
if os.path.exists(clsname) and atts.has_key("classID"):
@@ -1219,6 +1226,12 @@
# and assign the result to the NameBase property, and
# delete the Name property.
atts = dct["attributes"]
+ # Convert any paths in the atts
+ try:
+ pth = obj.Form._classFile
+ except:
+ pth = None
+ dabo.lib.utils.resolveAttributePathing(atts, pth)
nm = obj.Name
while nm[-1].isdigit():
nm = nm[:-1]
@@ -2335,6 +2348,12 @@
to itself and any children.
"""
atts = dct["attributes"]
+ # Convert any paths in the atts
+ try:
+ pth = obj.Form._classFile
+ except:
+ pth = None
+ dabo.lib.utils.resolveAttributePathing(atts, pth)
code = dct.get("code", {})
sizerInfo = self._extractKey(atts, "sizerInfo", "{}")
if isinstance(sizerInfo, basestring):
Modified: trunk/ClassDesignerComponents.py
===================================================================
--- trunk/ClassDesignerComponents.py 2006-09-30 13:50:22 UTC (rev 641)
+++ trunk/ClassDesignerComponents.py 2006-10-05 00:27:06 UTC (rev 642)
@@ -119,6 +119,18 @@
continue
if prop == "RegID" and not val:
continue
+
+
+ if isinstance(val, basestring) and os.path.exists(val):
+ # It's a path; convert it to a relative path
+ if isinstance(self, dabo.ui.dForm):
+ ref = self._classFile
+ else:
+ ref = self.Form._classFile
+ ref = os.path.abspath(ref)
+ val = dabo.lib.utils.getPathAttributePrefix() +
\
+
dabo.lib.utils.relativePath(val, ref)
+
# If it hasn't changed from the default, skip it
if not allProps:
if defVals.has_key(prop):
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev