The promised attachment. "This time fer shur, Rocky!"
#!/usr/bin/python
import os
import sys
from ldtp import *
import threading
# Give names to some strings
# window title of a localbuilt LibreOffice
ttlLo = '*LibreOffice*[OOO*'
# window title of our LibreOffice
ttlLoOurs = "Untitled 1 - LibreOffice Writer [OOO*"
# TODO: (*) Are these strings robust "enough"?
# (*) Why exclude an installed LibreOffice? Hmm?
# command to run our LibreOffice
loCmd = "/home/terry/lo_hacking/git/libo/install/program/soffice.bin " \
"--norestore " \
"--writer " \
"2>/dev/null 1>/dev/null" # Hide messages. Questionable.
# TODO: (*) This is completely peculiar to my (tje, 2012-10-15)
# setup. How do this better? If this script were part
# of LO, then it could calculate a location relative to
# its own directory, but even that is bad in that it
# makes it hard to move the script from one place to
# another; it would be particularly hard to move it to
# a different level below SRCDIR.
# (*) For testing, it is confusing to see all the console
# output.things.
# We want our own invocation of master build, not somebody else's.
# ... not somebody else's invocation
if guiexist ( ttlLo ) :
print "FAIL: It seems localbuilt LibreOffice is already running. " \
"That's no good."
sys.exit()
# ... but our own, if you please.
# TODO: This is transcribed with little understanding from
# the python tutorial. Better read some more, Terry.
class AsyncLo( threading.Thread ) :
def __init__( self ) :
threading.Thread.__init__( self )
def run( self ) :
os.system( loCmd )
print "Finished our asynchronous LibreOffice" # debug
background = AsyncLo()
background.start ()
waittillguiexist ( ttlLoOurs )
print "The main program continues to run in the foreground." # debug
# TODO: Actual work, if there were any, would go here.
# Clean up
# In the python interactive interpreter, I can select both levels
# of menu in one call. In this script, not. Is this a question
# of timing, or sump'n? Should the tutorial mention this?
selectmenuitem ( ttlLoOurs, 'mnuFile' )
selectmenuitem ( ttlLoOurs, 'mnuExit LibreOffice' )
background.join ()
sys.exit ()
_______________________________________________
List Name: Libreoffice-qa mailing list
Mail address: [email protected]
Change settings: http://lists.freedesktop.org/mailman/listinfo/libreoffice-qa
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://lists.freedesktop.org/archives/libreoffice-qa/