dabo Commit
Revision 5921
Date: 2010-07-11 07:47:00 -0700 (Sun, 11 Jul 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5921
Changed:
U trunk/demo/Modules.py
U trunk/demo/samples/dPageStyled.py
U trunk/demo/samples/games/Minesweeper.py
U trunk/demo/samples/games/bubblet/BubbleBizobj.py
U trunk/demo/samples/games/bubblet/BubbletForm.py
U trunk/demo/samples/games/bubblet/StatsForm.py
U trunk/demo/samples/games/cardlib.py
Log:
Converted more of the codebase from str() to ustr().
Diff:
Modified: trunk/demo/Modules.py
===================================================================
--- trunk/demo/Modules.py 2010-07-10 17:25:01 UTC (rev 5920)
+++ trunk/demo/Modules.py 2010-07-11 14:47:00 UTC (rev 5921)
@@ -25,8 +25,10 @@
import dabo.lib.utils as utils
import dabo.dEvents as dEvents
from dabo.dLocalize import _
+from dabo.lib.utils import ustr
+
class ModuleDictWrapper:
"""Emulates a module with a dynamically compiled __dict__"""
def __init__(self, dict):
@@ -235,7 +237,7 @@
self.traceback.append( (filename, lineno, "",
line) )
excValue = msg
try:
- self.exception_details = str(excValue)
+ self.exception_details = ustr(excValue)
except:
self.exception_details = "<unprintable %s object>" &
type(excValue).__name__
@@ -244,7 +246,7 @@
def __str__(self):
ret = "Type %s \n \
Traceback: %s \n \
- Details : %s" % ( str(self.exception_type),
str(self.traceback), self.exception_details )
+ Details : %s" % (ustr(self.exception_type),
ustr(self.traceback), self.exception_details)
return ret
#---------------------------------------------------------------------------
@@ -295,7 +297,7 @@
#Add the traceback data
for tbNum in range(len(traceback)):
data = traceback[tbNum]
- lst.append( (os.path.basename(data[0]), str(data[1]),
str(data[2]), str(data[3])) )
+ lst.append( (os.path.basename(data[0]), ustr(data[1]),
ustr(data[2]), ustr(data[3])))
# Check whether this entry is from the demo module
pth = os.path.split(data[0])[0]
Modified: trunk/demo/samples/dPageStyled.py
===================================================================
--- trunk/demo/samples/dPageStyled.py 2010-07-10 17:25:01 UTC (rev 5920)
+++ trunk/demo/samples/dPageStyled.py 2010-07-11 14:47:00 UTC (rev 5921)
@@ -3,6 +3,7 @@
dabo.ui.loadUI("wx")
import dabo.dEvents as dEvents
from dabo.dLocalize import _
+from dabo.lib.utils import ustr
class TestPanel(dabo.ui.dPanel):
@@ -136,7 +137,7 @@
if newcolor:
self.pgf.ActiveTabColor = newcolor
self.update()
- self.Form.logit("ActiveTabColor changed to '%s'" %
str(newcolor))
+ self.Form.logit("ActiveTabColor changed to '%s'" %
ustr(newcolor))
def onSetTabAreaColor(self, evt):
curr = self.pgf.TabAreaColor
@@ -144,7 +145,7 @@
if newcolor:
self.pgf.TabAreaColor = newcolor
self.update()
- self.Form.logit("TabAreaColor changed to '%s'" %
str(newcolor))
+ self.Form.logit("TabAreaColor changed to '%s'" %
ustr(newcolor))
def onSetActiveTabTextColor(self, evt):
curr = self.pgf.ActiveTabTextColor
@@ -152,7 +153,7 @@
if newcolor:
self.pgf.ActiveTabTextColor = newcolor
self.update()
- self.Form.logit("ActiveTabTextColor changed to '%s'" %
str(newcolor))
+ self.Form.logit("ActiveTabTextColor changed to '%s'" %
ustr(newcolor))
def onSetInactiveTabTextColor(self, evt):
curr = self.pgf.InactiveTabTextColor
@@ -160,7 +161,7 @@
if newcolor:
self.pgf.InactiveTabTextColor = newcolor
self.update()
- self.Form.logit("InactiveTabTextColor changed to '%s'"
% str(newcolor))
+ self.Form.logit("InactiveTabTextColor changed to '%s'"
% ustr(newcolor))
Modified: trunk/demo/samples/games/Minesweeper.py
===================================================================
--- trunk/demo/samples/games/Minesweeper.py 2010-07-10 17:25:01 UTC (rev
5920)
+++ trunk/demo/samples/games/Minesweeper.py 2010-07-11 14:47:00 UTC (rev
5921)
@@ -24,6 +24,7 @@
import dabo.lib.StopWatch as StopWatch
dabo.ui.loadUI("wx")
from dabo.dLocalize import _
+from dabo.lib.utils import ustr
import dabo.dEvents as dEvents
# import dabo.lib.datanav as datanav
from dabo.lib import specParser
@@ -362,7 +363,7 @@
# recursively clear all adjacent 0 squares
self.clearZeros(o.square)
else:
- o.Caption = str(a)
+ o.Caption = ustr(a)
o.Enabled = False
o.unbindEvent(dabo.dEvents.Hit)
self._firstHit = False
@@ -381,7 +382,7 @@
elif bd[sq]["adjacent"] == 0:
o.Visible = False
else:
- o.Caption = str(bd[sq]["adjacent"])
+ o.Caption = ustr(bd[sq]["adjacent"])
o.Enabled = False
@@ -397,7 +398,7 @@
self.clearZeros(sq)
else:
if bd[sq]["obj"].Visible and
bd[sq]["adjacent"] > 0:
- bd[sq]["obj"].Caption =
str(bd[sq]["adjacent"])
+ bd[sq]["obj"].Caption =
ustr(bd[sq]["adjacent"])
bd[sq]["obj"].State = "UnMarked"
bd[sq]["obj"].Enabled = False
@@ -843,7 +844,7 @@
self.Application.PreferenceManager.playername = biz.Record.playername
break
except
dabo.dException.BusinessRuleViolation, e:
- dabo.ui.exclaim(str(e))
+ dabo.ui.exclaim(ustr(e))
dlg.show()
if not dlg.Accepted:
break
Modified: trunk/demo/samples/games/bubblet/BubbleBizobj.py
===================================================================
--- trunk/demo/samples/games/bubblet/BubbleBizobj.py 2010-07-10 17:25:01 UTC
(rev 5920)
+++ trunk/demo/samples/games/bubblet/BubbleBizobj.py 2010-07-11 14:47:00 UTC
(rev 5921)
@@ -2,6 +2,7 @@
import dabo
import dabo.biz as biz
from dabo.dLocalize import _
+from dabo.lib.utils import ustr
import random
import time
import os
@@ -45,7 +46,7 @@
else:
self.unselectBubbles()
self.selectBubbles(bubble)
- self.Message = _("Bubble Points: ") + str(
self.BubbleScore )
+ self.Message = _("Bubble Points: ") +
ustr(self.BubbleScore)
return ret
Modified: trunk/demo/samples/games/bubblet/BubbletForm.py
===================================================================
--- trunk/demo/samples/games/bubblet/BubbletForm.py 2010-07-10 17:25:01 UTC
(rev 5920)
+++ trunk/demo/samples/games/bubblet/BubbletForm.py 2010-07-11 14:47:00 UTC
(rev 5921)
@@ -5,6 +5,7 @@
dui = dabo.ui
import dabo.dEvents as dEvents
from dabo.dLocalize import _
+from dabo.lib.utils import ustr
from BubblePanel import BubblePanel
from BubbleBizobj import BubbleBizobj
from StatsForm import StatsForm
@@ -174,7 +175,7 @@
def _setScore(self, score):
if self._score != score:
self._score = score
- self.scoreLabel.Caption = str(score)
+ self.scoreLabel.Caption = ustr(score)
Bizobj = property(_getBizobj, None, None,
_("Reference to the form's bizobj"))
Modified: trunk/demo/samples/games/bubblet/StatsForm.py
===================================================================
--- trunk/demo/samples/games/bubblet/StatsForm.py 2010-07-10 17:25:01 UTC
(rev 5920)
+++ trunk/demo/samples/games/bubblet/StatsForm.py 2010-07-11 14:47:00 UTC
(rev 5921)
@@ -2,7 +2,10 @@
import dabo
dabo.ui.loadUI("wx")
from dabo.dLocalize import _
+from dabo.lib.utils import ustr
+
+
class StatsForm(dabo.ui.dDialog):
def beforeInit(self):
self._games = 0
@@ -20,23 +23,23 @@
lb = dabo.ui.dLabel(self, Caption="Number of Games:",
FontSize=16, ForeColor=(0,0,128))
sz.append(lb, halign="right")
- lb = dabo.ui.dLabel(self, Caption=str(self.Games), FontSize=16)
+ lb = dabo.ui.dLabel(self, Caption=ustr(self.Games), FontSize=16)
sz.append(lb, halign="left")
lb = dabo.ui.dLabel(self, Caption="Average:",
FontSize=16, ForeColor = (0,0,128))
sz.append(lb, halign="right")
if self.Games > 0:
- avg = str( round( (float(self.Points) / self.Games), 4)
)
+ avg = ustr(round((float(self.Points) / self.Games), 4))
else:
avg = 0
- lb = dabo.ui.dLabel(self, Caption=str(avg), FontSize=16)
+ lb = dabo.ui.dLabel(self, Caption=ustr(avg), FontSize=16)
sz.append(lb, halign="left")
lb = dabo.ui.dLabel(self, Caption="High Game:",
FontSize=16, ForeColor=(0,0,128))
sz.append(lb, halign="right")
- lb = dabo.ui.dLabel(self, Caption=str(self.HighGame),
FontSize=16)
+ lb = dabo.ui.dLabel(self, Caption=ustr(self.HighGame),
FontSize=16)
sz.append(lb, halign="left")
# OK, that does it for the display fields. Now add an OK button
Modified: trunk/demo/samples/games/cardlib.py
===================================================================
--- trunk/demo/samples/games/cardlib.py 2010-07-10 17:25:01 UTC (rev 5920)
+++ trunk/demo/samples/games/cardlib.py 2010-07-11 14:47:00 UTC (rev 5921)
@@ -2,6 +2,7 @@
import dabo
dabo.ui.loadUI("wx")
from dabo.dLocalize import _
+from dabo.lib.utils import ustr
class Card(dabo.ui.dBitmap):
@@ -21,7 +22,7 @@
else:
rank = self.Rank
suit = self.Suit.lower()
- pic = "%s/%s%s" % (self.Parent.DeckDirectory,
suit, str(rank))
+ pic = "%s/%s%s" % (self.Parent.DeckDirectory,
suit, ustr(rank))
self.Picture = pic
@@ -40,7 +41,7 @@
elif rank == 13:
ret = "King"
else:
- ret = str(rank)
+ ret = ustr(rank)
suitNames = {"S" : "Spades", "D" : "Diamonds", "H" :
"Hearts", "C" : "Clubs"}
ret += " of %s" % suitNames[suit]
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]