dabo Commit
Revision 5229
Date: 2009-05-20 23:16:14 -0700 (Wed, 20 May 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5229
Changed:
U trunk/dabo/lib/DesignerXmlConverter.py
Log:
Fixed the issue with the previous change breaking DaboDemo. I had thought it
had something to do with the nested spllitter rendering, but it turns out that
the unique naming method caused the sizers to not size themselves properly.
IOW, merely changing the name of the generated classes from something like
'dPanel_0a509f2a67' to 'dPanel_1464064343' fixed the problem!
I have no clue why this works, and why the previous method didn't, but I'm not
worrying about it for now.
Diff:
Modified: trunk/dabo/lib/DesignerXmlConverter.py
===================================================================
--- trunk/dabo/lib/DesignerXmlConverter.py 2009-05-19 18:26:35 UTC (rev
5228)
+++ trunk/dabo/lib/DesignerXmlConverter.py 2009-05-21 06:16:14 UTC (rev
5229)
@@ -7,7 +7,7 @@
from datetime import datetime
import os
import re
-from hashlib import md5
+import random
import dabo
dabo.ui.loadUI("wx")
import dabo.dEvents as dEvents
@@ -35,7 +35,7 @@
# Expression for substituing default parameters
self.prmDefPat = re.compile(r"([^=]+)=?.*")
# Added to ensure unique object names
- self._generatedNames = []
+ self._generatedNames = [""]
# Holds the class file we will create in order to aid
introspection
self._classFileName = self.Application.getTempFile("py")
self._codeImportAs = "_daboCode"
@@ -461,7 +461,7 @@
code = kid.get("code", {})
grandkids1 = kid.get("children")
p1nm = self.createInnerClass(nm,
kidCleanAtts, code, custProps)
- self.classText += LINESEP + (
+ self.classText += (LINESEP +
"""
%(splitName)s.createPanes(self.getCustControlClass('%(p1nm)s'), pane=1)""" %
locals())
kid = kids[1]
kidCleanAtts =
self.cleanAttributes(kid.get("attributes", {}))
@@ -469,7 +469,7 @@
code = kid.get("code", {})
grandkids2 = kid.get("children")
p2nm = self.createInnerClass(nm,
kidCleanAtts, code, custProps)
- self.classText += LINESEP + (
+ self.classText += (LINESEP +
"""
%(splitName)s.createPanes(self.getCustControlClass('%(p2nm)s'), pane=2)""" %
locals())
hasGK = grandkids1 or grandkids2
if hasGK:
@@ -657,7 +657,8 @@
def uniqename(self, nm):
ret = ""
while not ret or ret in self._generatedNames:
- ret = "%s_%s" % (nm,
md5(str(datetime.utcnow())).hexdigest()[:10])
+ # The empty string is always in the list, so it will
run at least once.
+ ret = "%s_%s" % (nm, random.randint(0,99999))
self._generatedNames.append(ret)
return ret
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]