dabo Commit
Revision 5919
Date: 2010-07-10 10:24:55 -0700 (Sat, 10 Jul 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5919

Changed:
U   trunk/dabo/ui/uiwx/dLinePlot.py
U   trunk/dabo/ui/uiwx/dListControl.py
U   trunk/dabo/ui/uiwx/dMenu.py
U   trunk/dabo/ui/uiwx/dPageFrame.py
U   trunk/dabo/ui/uiwx/dPageFrameMixin.py
U   trunk/dabo/ui/uiwx/dPemMixin.py
U   trunk/dabo/ui/uiwx/dSpinner.py
U   trunk/dabo/ui/uiwx/dTextBoxMixin.py
U   trunk/dabo/ui/uiwx/dTreeView.py

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


Diff:
Modified: trunk/dabo/ui/uiwx/dLinePlot.py
===================================================================
--- trunk/dabo/ui/uiwx/dLinePlot.py     2010-07-10 17:14:21 UTC (rev 5918)
+++ trunk/dabo/ui/uiwx/dLinePlot.py     2010-07-10 17:24:55 UTC (rev 5919)
@@ -18,6 +18,7 @@
 import dControlMixin as cm
 from dabo.ui import makeDynamicProperty
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 
 
 class _TraceMixin(object):
@@ -26,7 +27,7 @@
                return self.attributes['legend']
        
        def _setCaption(self, val):
-               self.attributes['legend'] = str(val)
+               self.attributes['legend'] = ustr(val)
        
        
        def _getPoints(self):

Modified: trunk/dabo/ui/uiwx/dListControl.py
===================================================================
--- trunk/dabo/ui/uiwx/dListControl.py  2010-07-10 17:14:21 UTC (rev 5918)
+++ trunk/dabo/ui/uiwx/dListControl.py  2010-07-10 17:24:55 UTC (rev 5919)
@@ -7,6 +7,7 @@
 import dControlItemMixin as dcm
 import dabo.dEvents as dEvents
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dabo.ui import makeDynamicProperty
 
 
@@ -305,7 +306,7 @@
                a reference to it that is retrievable via the key value.
                """
                if key is None:
-                       key = str(img)
+                       key = ustr(img)
                if isinstance(img, basestring):
                        img = dabo.ui.strToBmp(img)
                il = self.GetImageList(wx.IMAGE_LIST_NORMAL)
@@ -608,6 +609,7 @@
        def _getSortColumn(self):
                return self._sortColumn
 
+       @dabo.ui.deadCheck
        def _setSortColumn(self, val):
                if self._constructed():
                        self._sortColumn = val

Modified: trunk/dabo/ui/uiwx/dMenu.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenu.py 2010-07-10 17:14:21 UTC (rev 5918)
+++ trunk/dabo/ui/uiwx/dMenu.py 2010-07-10 17:24:55 UTC (rev 5919)
@@ -7,6 +7,7 @@
 import dPemMixin as pm
 import dIcons
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import dabo.dEvents as dEvents
 from dabo.ui import makeDynamicProperty
 from dabo.lib.utils import cleanMenuCaption
@@ -355,7 +356,7 @@
 
 
        def _getItemID(self,typ):
-               typ = str(typ).lower()
+               typ = ustr(typ).lower()
                ret = wx.ID_DEFAULT
                if typ == "exit":
                        ret = wx.ID_EXIT
@@ -367,7 +368,7 @@
                
 
        def _getItemType(self, typ):
-               typ = str(typ).lower()[:3]
+               typ = ustr(typ).lower()[:3]
                ret = NormalItemType
                if typ in ("che", "chk"):
                        ret = CheckItemType

Modified: trunk/dabo/ui/uiwx/dPageFrame.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrame.py    2010-07-10 17:14:21 UTC (rev 5918)
+++ trunk/dabo/ui/uiwx/dPageFrame.py    2010-07-10 17:24:55 UTC (rev 5919)
@@ -8,6 +8,7 @@
        dabo.ui.loadUI("wx")
 import dabo.dEvents as dEvents
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dPageFrameMixin import dPageFrameMixin
 import dabo.dColors as dColors
 
@@ -484,7 +485,7 @@
                                return "Top"
 
                def _setTabPosition(self, val):
-                       lowval = str(val).lower()[0]
+                       lowval = ustr(val).lower()[0]
                        self._delWindowStyleFlag(self._tabposBottom)
 
                        if lowval == "t":
@@ -522,7 +523,7 @@
                        self._delWindowStyleFlag(fnb.FNB_VC71)
                        self._delWindowStyleFlag(fnb.FNB_FANCY_TABS)
                        self._delWindowStyleFlag(fnb.FNB_FF2)
-                       lowval = str(val).lower()
+                       lowval = ustr(val).lower()
                        flags = {"default": "", "vc8": fnb.FNB_VC8, "vc71": 
fnb.FNB_VC71,
                                        "fancy": fnb.FNB_FANCY_TABS, "firefox": 
fnb.FNB_FF2}
                        cleanStyles = {"default": "Default", "vc8": "VC8", 
"vc71": "VC71",

Modified: trunk/dabo/ui/uiwx/dPageFrameMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrameMixin.py       2010-07-10 17:14:21 UTC (rev 
5918)
+++ trunk/dabo/ui/uiwx/dPageFrameMixin.py       2010-07-10 17:24:55 UTC (rev 
5919)
@@ -9,6 +9,7 @@
 from dPage import dPage
 import dabo.dEvents as dEvents
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dabo.ui import makeDynamicProperty
        
 
@@ -96,7 +97,7 @@
                a reference to it that is retrievable via the key value.
                """
                if key is None:
-                       key = str(img)
+                       key = ustr(img)
                if isinstance(img, basestring):
                        img = dabo.ui.strToBmp(img)
                il = self.GetImageList()
@@ -386,7 +387,7 @@
                        return "Top"
 
        def _setTabPosition(self, val):
-               val = str(val)
+               val = ustr(val)
 
                self._delWindowStyleFlag(self._tabposTop)
                self._delWindowStyleFlag(self._tabposBottom)

Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2010-07-10 17:14:21 UTC (rev 5918)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2010-07-10 17:24:55 UTC (rev 5919)
@@ -7,6 +7,7 @@
 from wx._core import PyAssertionError
 import dabo
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dabo.ui.dPemMixinBase import dPemMixinBase
 import dabo.dEvents as dEvents
 import dabo.dException as dException
@@ -2321,7 +2322,17 @@
                                                raise NameError("Name '%s' is 
already in use." % name)
                                        else:
                                                for window in 
parent.GetChildren():
-                                                       if 
str(window.GetName()) == str(name) and window != self:
+                                                       if window is self:
+                                                               continue
+                                                       try:
+                                                               winname = 
window.GetName()
+                                                       except AttributeError:
+                                                               try:
+                                                                       winname 
= window._name
+                                                               except 
AttributeError:
+                                                                       # Not 
an object with a Name, so ignore
+                                                                       continue
+                                                       if ustr(winname) == 
ustr(name):
                                                                raise 
NameError("Name '%s' is already in use." % name)
                                        
                        else:
@@ -2331,7 +2342,7 @@
                                pass
 
        
-                       name = str(name)
+                       name = ustr(name)
                        self._name = name
                        try:
                                self.SetName(name)

Modified: trunk/dabo/ui/uiwx/dSpinner.py
===================================================================
--- trunk/dabo/ui/uiwx/dSpinner.py      2010-07-10 17:14:21 UTC (rev 5918)
+++ trunk/dabo/ui/uiwx/dSpinner.py      2010-07-10 17:24:55 UTC (rev 5919)
@@ -12,6 +12,7 @@
 import dDataControlMixin as dcm
 import dabo.dEvents as dEvents
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 from dabo.ui import makeDynamicProperty
 from dabo.ui import makeProxyProperty
 
@@ -26,7 +27,7 @@
                                *args, **kwargs)
 
 
-class dSpinner(dabo.ui.dDataPanel):
+class dSpinner(dabo.ui.dDataPanel, wx.Control):
        """Control for allowing a user to increment a value by discreet steps 
across a range
        of valid values.
        """
@@ -93,12 +94,12 @@
 
        def _toDec(self, val):
                """Convenience method for converting various types to 
decimal."""
-               return decimal(str(val))
+               return decimal(ustr(val))
 
 
        def _toFloat(self, val):
                """Convenience method for converting various types to float."""
-               return float(str(val))
+               return float(ustr(val))
 
 
        def _coerceTypes(self, newVal, minn, maxx, margin):

Modified: trunk/dabo/ui/uiwx/dTextBoxMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dTextBoxMixin.py 2010-07-10 17:14:21 UTC (rev 5918)
+++ trunk/dabo/ui/uiwx/dTextBoxMixin.py 2010-07-10 17:24:55 UTC (rev 5919)
@@ -6,6 +6,7 @@
 import wx
 import wx.lib.masked as masked
 import dabo.lib.dates
+from dabo.lib.utils import ustr
 
 import decimal
 numericTypes = (int, long, decimal.Decimal, float)
@@ -449,18 +450,18 @@
                                
                        if retVal is None:
                                raise ValueError(_("String not in ISO 8601 
format."))
-               elif str(dataType) == "<type 'DateTime'>":
+               elif ustr(dataType) == "<type 'DateTime'>":
                        # mx DateTime type. MySQLdb will use this if mx is 
installed.
                        try:
                                import mx.DateTime
-                               retVal = mx.DateTime.DateTimeFrom(str(strVal))
+                               retVal = mx.DateTime.DateTimeFrom(ustr(strVal))
                        except ImportError:
                                raise ValueError(_("Can't import mx.DateTime"))
-               elif str(dataType) == "<type 'DateTimeDelta'>":
+               elif ustr(dataType) == "<type 'DateTimeDelta'>":
                        # mx TimeDelta type. MySQLdb will use this for Time 
columns if mx is installed.
                        try:
                                import mx.DateTime
-                               retVal = mx.DateTime.TimeFrom(str(strVal))
+                               retVal = mx.DateTime.TimeFrom(ustr(strVal))
                        except ImportError:
                                raise ValueError(_("Can't import mx.DateTime"))
                elif (dataType == decimal.Decimal) and self.StrictNumericEntry:
@@ -537,7 +538,7 @@
                        strVal = self.NoneDisplay
                else:
                        # convert all other data types to string:
-                       strVal = str(value)   # (floats look like 25.55)
+                       strVal = ustr(value)   # (floats look like 25.55)
                        #strVal = repr(value) # (floats look like 
25.55000000000001)
                return strVal
        

Modified: trunk/dabo/ui/uiwx/dTreeView.py
===================================================================
--- trunk/dabo/ui/uiwx/dTreeView.py     2010-07-10 17:14:21 UTC (rev 5918)
+++ trunk/dabo/ui/uiwx/dTreeView.py     2010-07-10 17:24:55 UTC (rev 5919)
@@ -7,6 +7,7 @@
 import dControlMixin as dcm
 import dabo.dEvents as dEvents
 from dabo.dLocalize import _
+from dabo.lib.utils import ustr
 import dabo.dColors as dColors
 from dabo.dObject import dObject
 from dabo.ui import makeDynamicProperty
@@ -576,7 +577,7 @@
                        if il.GetImageCount():
                                wd, ht = il.GetSize(0)
                if key is None:
-                       key = str(img)
+                       key = ustr(img)
                if isinstance(img, basestring):
                        img = dabo.ui.strToBmp(img, width=wd, height=ht)
                idx = il.Add(img)



_______________________________________________
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