dabo Commit
Revision 5922
Date: 2010-07-11 07:56:58 -0700 (Sun, 11 Jul 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5922

Changed:
U   trunk/ide/ClassDesigner.py
U   trunk/ide/ClassDesignerComponents.py
U   trunk/ide/ClassDesignerControlMixin.py
U   trunk/ide/ClassDesignerEditor.py
U   trunk/ide/ClassDesignerFormMixin.py
U   trunk/ide/ClassDesignerPemForm.py
U   trunk/ide/ClassDesignerTreeSheet.py
U   trunk/ide/CxnEditor.py
U   trunk/ide/MenuDesignerForm.py
U   trunk/ide/ReportDesigner.py
U   trunk/ide/wizards/AppWizard/AppWizard.py

Log:
Converted more of the codebase from str() to ustr().

Diff:
Modified: trunk/ide/ClassDesigner.py
===================================================================
--- trunk/ide/ClassDesigner.py  2010-07-11 14:47:00 UTC (rev 5921)
+++ trunk/ide/ClassDesigner.py  2010-07-11 14:56:58 UTC (rev 5922)
@@ -7,6 +7,7 @@
 import inspect
 import dabo
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import dabo.dEvents as dEvents
 if __name__ == "__main__":
        dabo.ui.loadUI("wx")
@@ -1360,7 +1361,7 @@
                        if isinstance(val, basestring):
                                strVal = val
                        else:
-                               strVal = str(val)
+                               strVal = ustr(val)
                        if typ in (str, unicode) or ((typ is list) and 
isinstance(val, basestring)):
                                # Escape any single quotes, and then enclose
                                # the value in single quotes
@@ -1368,7 +1369,7 @@
                        try:
                                exec("obj.%s = %s" % (prop, strVal) )
                        except StandardError, e:
-                               raise PropertyUpdateException(str(e))
+                               raise PropertyUpdateException(ustr(e))
 
 
        def startPropEdit(self):
@@ -2971,7 +2972,7 @@
                ret = self._mixedControlClasses.get(base, None)
                if not ret:
                        # Create a pref key that is the Designer key plus the 
name of the control
-                       prefkey = self.BasePrefKey + "." + 
str(base).split(".")[-1].split("'")[0]
+                       prefkey = self.BasePrefKey + "." + 
ustr(base).split(".")[-1].split("'")[0]
                        class controlMix(cmix, base):
                                superControl = base
                                superMixin = cmix
@@ -2980,7 +2981,7 @@
                                                apply(base.__init__,(self,) + 
args, kwargs)
                                        parent = args[0]
                                        cmix.__init__(self, parent, **kwargs)
-                                       self.NameBase = 
str(self._baseClass).split(".")[-1].split("'")[0]
+                                       self.NameBase = 
ustr(self._baseClass).split(".")[-1].split("'")[0]
                                        self.BasePrefKey = prefkey
                        ret = controlMix
                        self._mixedControlClasses[base] = ret

Modified: trunk/ide/ClassDesignerComponents.py
===================================================================
--- trunk/ide/ClassDesignerComponents.py        2010-07-11 14:47:00 UTC (rev 
5921)
+++ trunk/ide/ClassDesignerComponents.py        2010-07-11 14:56:58 UTC (rev 
5922)
@@ -3,6 +3,7 @@
 import dabo
 dabo.ui.loadUI("wx")
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dabo.dObject import dObject
 import dabo.dEvents as dEvents
 import dabo.ui.dialogs as dlgs
@@ -481,14 +482,14 @@
                """Return a string representing the item's class. Can
                be overridden by subclasses.
                """
-               return str(self.BaseClass).split("'")[1].split(".")[-1]
+               return ustr(self.BaseClass).split("'")[1].split(".")[-1]
 
 
        def getClassName(self):
                """Return a string representing the item's class name. Can
                be overridden by subclasses.
                """
-               return str(self.__class__).split("'")[1].split(".")[-1]
+               return ustr(self.__class__).split("'")[1].split(".")[-1]
 
 
 class LayoutPanel(dabo.ui.dPanel, LayoutSaverMixin):
@@ -781,7 +782,7 @@
                try:
                        cs.setItemProp(self, "ColSpan", val)
                except dabo.ui.GridSizerSpanException, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
 
 
        def _getSzRowExpand(self):
@@ -801,7 +802,7 @@
                try:
                        cs.setItemProp(self, "RowSpan", val)
                except dabo.ui.GridSizerSpanException, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
 
 
        def _getSzProp(self):
@@ -1406,7 +1407,7 @@
                try:
                        self.ControllingSizer.setItemProp(self, "ColSpan", val)
                except dabo.ui.GridSizerSpanException, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
 
 
        def _getSzRowExpand(self):
@@ -1425,7 +1426,7 @@
                try:
                        self.ControllingSizer.setItemProp(self, "RowSpan", val)
                except dabo.ui.GridSizerSpanException, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
 
 
        def _getSzProp(self):
@@ -1917,7 +1918,7 @@
                try:
                        self.ControllingSizer.setItemProp(self, "ColSpan", val)
                except dabo.ui.GridSizerSpanException, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
 
 
        def _getSzRowExpand(self):
@@ -1936,7 +1937,7 @@
                try:
                        self.ControllingSizer.setItemProp(self, "RowSpan", val)
                except dabo.ui.GridSizerSpanException, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
 
 
        def _getSzProp(self):

Modified: trunk/ide/ClassDesignerControlMixin.py
===================================================================
--- trunk/ide/ClassDesignerControlMixin.py      2010-07-11 14:47:00 UTC (rev 
5921)
+++ trunk/ide/ClassDesignerControlMixin.py      2010-07-11 14:56:58 UTC (rev 
5922)
@@ -2,6 +2,7 @@
 import os
 import dabo
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import dabo.dEvents as dEvents
 import dabo.dColors as dColors
 import dabo.ui.dialogs as dlgs
@@ -1229,7 +1230,7 @@
                try:
                        self.ControllingSizer.setItemProp(self, "ColSpan", val)
                except dui.GridSizerSpanException, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
 
 
        def _getSzRowExpand(self):
@@ -1248,7 +1249,7 @@
                try:
                        self.ControllingSizer.setItemProp(self, "RowSpan", val)
                except dui.GridSizerSpanException, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
 
 
        def _getSzProp(self):
@@ -1311,7 +1312,7 @@
                elif isinstance(self, dlgs.WizardPage):
                        ret = "WizardPage", self.Caption
                else:
-                       ret = (str(self.Name), self._baseClass)
+                       ret = (ustr(self.Name), self._baseClass)
                return ret
 
 

Modified: trunk/ide/ClassDesignerEditor.py
===================================================================
--- trunk/ide/ClassDesignerEditor.py    2010-07-11 14:47:00 UTC (rev 5921)
+++ trunk/ide/ClassDesignerEditor.py    2010-07-11 14:56:58 UTC (rev 5922)
@@ -5,6 +5,7 @@
 dui = dabo.ui
 import dabo.dEvents as dEvents
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import ClassDesignerMenu
 
 
@@ -46,7 +47,7 @@
                        dabo.ErrorLog.write(_("Bad object ref returned to 
_makeContainingClassIntoSelf()"))
                        return None
                try:
-                       args = "dabo.ui.%s" % 
str(obj.BaseClass).split("'")[1].split(".")[-1]
+                       args = "dabo.ui.%s" % 
ustr(obj.BaseClass).split("'")[1].split(".")[-1]
                        classdef = "import dabo\nclass self(%s): pass" % args
                        exec classdef in self._namespaces
                except:

Modified: trunk/ide/ClassDesignerFormMixin.py
===================================================================
--- trunk/ide/ClassDesignerFormMixin.py 2010-07-11 14:47:00 UTC (rev 5921)
+++ trunk/ide/ClassDesignerFormMixin.py 2010-07-11 14:56:58 UTC (rev 5922)
@@ -7,6 +7,7 @@
 import codecs
 import dabo
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import dabo.dEvents as dEvents
 import ClassDesignerPropSheet
 import dabo.dConstants as kons
@@ -414,7 +415,7 @@
                                if isinstance(ch, (dui.dForm, dui.dToolForm,
                                                dui.dDialog, dui.dStatusBar, 
LayoutPanel)):
                                        continue
-                               elif str(ch).startswith("<wx."):
+                               elif ustr(ch).startswith("<wx."):
                                        # These are low-level items, such as 
scrollbars, and do not need
                                        # to be included.
                                        continue
@@ -677,7 +678,7 @@
                        seed = obj.classID
                except:
                        # Use the hash function to generate the base for class 
IDs
-                       seed = str(abs(obj.__hash__()))
+                       seed = ustr(abs(obj.__hash__()))
                # Create the property dictionary
                ret = obj.getDesignerDict(classID=seed, 
propsToExclude=propsToExclude)
                # We don't want to save the controlling sizer's info

Modified: trunk/ide/ClassDesignerPemForm.py
===================================================================
--- trunk/ide/ClassDesignerPemForm.py   2010-07-11 14:47:00 UTC (rev 5921)
+++ trunk/ide/ClassDesignerPemForm.py   2010-07-11 14:56:58 UTC (rev 5922)
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 import dabo
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import dabo.dEvents as dEvents
 from ClassDesignerPropSheet import PropSheet
 from ClassDesignerTreeSheet import TreeSheet
@@ -226,7 +227,7 @@
                                        if hasattr(ob, "Name"):
                                                lbl = ob.Name
                                        else:
-                                               lbl = str(ob.__class__)
+                                               lbl = ustr(ob.__class__)
                self.txtObj.Value = lbl
                self.PropSheet.select(obj)
                self.MethodList.clear()

Modified: trunk/ide/ClassDesignerTreeSheet.py
===================================================================
--- trunk/ide/ClassDesignerTreeSheet.py 2010-07-11 14:47:00 UTC (rev 5921)
+++ trunk/ide/ClassDesignerTreeSheet.py 2010-07-11 14:56:58 UTC (rev 5922)
@@ -3,6 +3,7 @@
 dabo.ui.loadUI("wx")
 import dabo.dEvents as dEvents
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dabo.ui import dKeys
 from ClassDesignerComponents import LayoutPanel
 from ClassDesignerComponents import LayoutBasePanel
@@ -188,7 +189,7 @@
 
        def _getDisplayName(self, obj):
                """Create the name displayed on the tree for a given object."""
-               ret = str(obj)
+               ret = ustr(obj)
                if isinstance(obj, (dui.dSizer, dui.dBorderSizer, 
dui.dGridSizer)):
                        ornt = obj.Orientation
                        if ornt in ("r", "c"):
@@ -243,7 +244,7 @@
                and returns just the actual class name (i.e., in this
                case, 'dTextBox').
                """
-               ret = str(cls)
+               ret = ustr(cls)
                if ret.startswith("<class 'dabo."):
                        # Just include the class name
                        ret = ret.split("'")[1].split(".")[-1]

Modified: trunk/ide/CxnEditor.py
===================================================================
--- trunk/ide/CxnEditor.py      2010-07-11 14:47:00 UTC (rev 5921)
+++ trunk/ide/CxnEditor.py      2010-07-11 14:56:58 UTC (rev 5922)
@@ -8,6 +8,7 @@
 import dabo.dEvents as dEvents
 import dabo.dConstants as k
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dabo.lib.connParser import createXML
 from dabo.lib.connParser import importConnections
 import dabo.lib.utils as utils
@@ -371,7 +372,7 @@
                        currDbType = self.connDict[self.currentConn]["dbtype"]
                else:
                        currDbType = u"MySQL"
-               newName = u"Connection_" + str(len(self.connDict.keys()) + 1)
+               newName = u"Connection_" + ustr(len(self.connDict.keys()) + 1)
                self.connDict[newName] = {
                                "dbtype" : currDbType,
                                "name" : newName,
@@ -444,7 +445,7 @@
                                self.connFile = f
 
                if self.connFile is not None:
-                       self.connFile = str(self.connFile)
+                       self.connFile = ustr(self.connFile)
                        # Read the XML into a local dictionary
                        self.connDict = importConnections(self.connFile)
                        # Save a copy for comparison

Modified: trunk/ide/MenuDesignerForm.py
===================================================================
--- trunk/ide/MenuDesignerForm.py       2010-07-11 14:47:00 UTC (rev 5921)
+++ trunk/ide/MenuDesignerForm.py       2010-07-11 14:56:58 UTC (rev 5922)
@@ -4,6 +4,7 @@
 import dabo
 dabo.ui.loadUI("wx")
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import dabo.dEvents as dEvents
 import dabo.lib.xmltodict as xtd
 from ClassDesignerExceptions import PropertyUpdateException
@@ -179,7 +180,7 @@
                try:
                        exec("obj.%s = %s" % (prop, strVal) )
                except StandardError, e:
-                       raise PropertyUpdateException(str(e))
+                       raise PropertyUpdateException(ustr(e))
                self.PropForm.updatePropGrid()
                # This is necessary to force a redraw when some props change.
                self.select(obj)

Modified: trunk/ide/ReportDesigner.py
===================================================================
--- trunk/ide/ReportDesigner.py 2010-07-11 14:47:00 UTC (rev 5921)
+++ trunk/ide/ReportDesigner.py 2010-07-11 14:56:58 UTC (rev 5922)
@@ -7,6 +7,7 @@
 from dabo.dReportWriter import dReportWriter
 from dabo.lib.reportWriter import *
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dabo.ui import dKeys
 import ClassDesignerPropSheet
 
@@ -434,7 +435,7 @@
                                        for obj in objs:
                                                copyObj = obj.getMemento()
                                                parentBand = 
rdc.getParentBand(obj)
-                                               parentBandInfo = 
[str(type(parentBand)).split(".")[-1][:-2], None]
+                                               parentBandInfo = 
[ustr(type(parentBand)).split(".")[-1][:-2], None]
                                                if "Group" in parentBandInfo[0]:
                                                        group = 
parentBand.parent
                                                        parentBandInfo[1] = 
group.get("expr")
@@ -604,7 +605,7 @@
 
                        if selBand and selBand.getProp("Height") is not None:
                                # Resize the pasted-into band to accomodate the 
new object, if necessary:
-                               selBand.setProp("Height", 
str(max(selBand.getProp("Height"), max_y_needed)))
+                               selBand.setProp("Height", 
ustr(max(selBand.getProp("Height"), max_y_needed)))
 
                        self.ActiveEditor.propsChanged(reinit=reInit)
                        self.SelectedObjects = selectedObjects
@@ -1550,7 +1551,7 @@
                                if imageFile is not None:
                                        if not os.path.exists(imageFile):
                                                imageFile = 
os.path.join(self._rw.HomeDirectory, imageFile)
-                                       imageFile = str(imageFile)
+                                       imageFile = ustr(imageFile)
 
                                if imageFile is not None:
                                        if os.path.exists(imageFile) and not 
os.path.isdir(imageFile):
@@ -1639,7 +1640,7 @@
                        try:
                                vale = eval(val)
                        except:
-                               vale = "?: %s" % str(val)
+                               vale = "?: %s" % ustr(val)
                else:
                        vale = val
                return vale
@@ -1650,7 +1651,7 @@
 
                If setting more than one property, self.setProps() is faster.
                """
-               self.ReportObject.setProp(prop, str(val))
+               self.ReportObject.setProp(prop, ustr(val))
                if sendPropsChanged:
                        self.Parent.propsChanged()
 

Modified: trunk/ide/wizards/AppWizard/AppWizard.py
===================================================================
--- trunk/ide/wizards/AppWizard/AppWizard.py    2010-07-11 14:47:00 UTC (rev 
5921)
+++ trunk/ide/wizards/AppWizard/AppWizard.py    2010-07-11 14:56:58 UTC (rev 
5922)
@@ -6,6 +6,7 @@
 import traceback
 import dabo
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import dabo.dEvents as dEvents
 import dabo.dConstants as k
 dabo.ui.loadUI("wx")
@@ -258,7 +259,7 @@
                                try:
                                        ctl.Value = val
                                except ValueError, e:
-                                       if "string must be present in the 
choices" in str(e).lower():
+                                       if "string must be present in the 
choices" in ustr(e).lower():
                                                # Not sure why the saved 
profile dbType is empty. No time to
                                                # find out why now, but at 
least the AW won't crash anymore.
                                                pass



_______________________________________________
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]

Reply via email to