scripting: Capitalise.py example: fix Python 3 syntax errors

Change-Id: I000e32ed1701c657046ae3b7f836012a7fd56fe4
This commit is contained in:
Michael Stahl
2012-11-25 16:05:34 +01:00
parent 6af846d0a1
commit 0e7db6c33b

View File

@@ -22,10 +22,10 @@ def getNewString( theString ) :
return ""
# should we tokenize on "."?
if theString[0].isupper() and len(theString)>=2 and theString[1].isupper() :
# first two chars are UC => first UC, rest LC
# first two chars are UC => first UC, rest LC
newString=theString[0:1].upper() + theString[1:].lower();
elif theString[0].isupper():
# first char UC => all to LC
# first char UC => all to LC
newString=theString.lower()
else: # all to UC.
newString=theString.upper()
@@ -47,7 +47,7 @@ def capitalisePython( ):
count = xIndexAccess.getCount();
if(count>=1): #ie we have a selection
i=0
while i < count :
while i < count :
xTextRange = xIndexAccess.getByIndex(i);
#print "string: " + xTextRange.getString();
theString = xTextRange.getString();
@@ -70,7 +70,7 @@ def capitalisePython( ):
if newString:
xTextRange.setString(newString);
xSelectionSupplier.select(xTextRange);
i+= 1
i+= 1
# lists the scripts, that shall be visible inside OOo. Can be omited, if