You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pf...@apache.org on 2012/08/01 01:04:43 UTC
svn commit: r1367813 - in
/incubator/ooo/trunk/main/scripting/examples/python: Capitalise.py
pythonSamples/TableSample.py
Author: pfg
Date: Tue Jul 31 23:04:42 2012
New Revision: 1367813
URL: http://svn.apache.org/viewvc?rev=1367813&view=rev
Log:
Python reindent.
Modified:
incubator/ooo/trunk/main/scripting/examples/python/Capitalise.py
incubator/ooo/trunk/main/scripting/examples/python/pythonSamples/TableSample.py
Modified: incubator/ooo/trunk/main/scripting/examples/python/Capitalise.py
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scripting/examples/python/Capitalise.py?rev=1367813&r1=1367812&r2=1367813&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scripting/examples/python/Capitalise.py (original)
+++ incubator/ooo/trunk/main/scripting/examples/python/Capitalise.py Tue Jul 31 23:04:42 2012
@@ -26,16 +26,16 @@ 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()
return newString;
-def capitalisePython( ):
+def capitalisePython( ):
"""Change the case of a selection, or current word from upper case, to first char upper case, to all lower case to upper case..."""
import string
@@ -51,7 +51,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();
@@ -74,7 +74,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
Modified: incubator/ooo/trunk/main/scripting/examples/python/pythonSamples/TableSample.py
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scripting/examples/python/pythonSamples/TableSample.py?rev=1367813&r1=1367812&r2=1367813&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scripting/examples/python/pythonSamples/TableSample.py (original)
+++ incubator/ooo/trunk/main/scripting/examples/python/pythonSamples/TableSample.py Tue Jul 31 23:04:42 2012
@@ -36,19 +36,19 @@ def insertTextIntoCell( table, cellName,
def createTable():
- """creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
+ """creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
-
+
# open a writer document
doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
-
+
text = doc.Text
cursor = text.createTextCursor()
text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
text.insertString( cursor, "Now we are in the second line\n" , 0 )
-
+
# create a text table
table = doc.createInstance( "com.sun.star.text.TextTable" )