Fixed comments.

This commit is contained in:
依瑪貓 2017-04-14 09:20:42 +08:00
parent 4c0d24c9d2
commit a9d3de29cc

View File

@ -45,7 +45,7 @@ def append_uno_path():
if os.path.exists(os.path.join(cand, "uno.py")): if os.path.exists(os.path.join(cand, "uno.py")):
sys.path.append(cand) sys.path.append(cand)
return return
# Finds uno.py for MS-Windows # Find uno.py for MS-Windows
cand = sys.executable cand = sys.executable
while cand != os.path.dirname(cand): while cand != os.path.dirname(cand):
cand = os.path.dirname(cand) cand = os.path.dirname(cand)
@ -109,7 +109,7 @@ def parse_args():
def presentation_doc(docfile): def presentation_doc(docfile):
"""Checks the supplied presentation document argument. """Check the supplied presentation document argument.
Arguments: Arguments:
docfile: The supplied presentation document argument. docfile: The supplied presentation document argument.
@ -227,14 +227,14 @@ class PresentationController:
Run OpenOffice/LibreOffice in server listening mode if it is Run OpenOffice/LibreOffice in server listening mode if it is
not running yet. not running yet.
""" """
# Obtains the local context # Obtain the local context
local_context = uno.getComponentContext() local_context = uno.getComponentContext()
# Obtains the local service manager # Obtain the local service manager
local_service_manager = local_context.getServiceManager() local_service_manager = local_context.getServiceManager()
# Obtains the URL resolver # Obtain the URL resolver
url_resolver = local_service_manager.createInstanceWithContext( url_resolver = local_service_manager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", local_context) "com.sun.star.bridge.UnoUrlResolver", local_context)
# Obtains the context # Obtain the context
url = ("uno:socket,host=localhost,port=%d;" url = ("uno:socket,host=localhost,port=%d;"
"urp;StarOffice.ComponentContext") % self.port "urp;StarOffice.ComponentContext") % self.port
while True: while True:
@ -244,9 +244,9 @@ class PresentationController:
self.__start_oo() self.__start_oo()
else: else:
break break
# Obtains the service manager # Obtain the service manager
self.service_manager = self.bootstrap_context.getServiceManager() self.service_manager = self.bootstrap_context.getServiceManager()
# Obtains the desktop service # Obtain the desktop service
self.desktop = self.service_manager.createInstanceWithContext( self.desktop = self.service_manager.createInstanceWithContext(
"com.sun.star.frame.Desktop", self.bootstrap_context) "com.sun.star.frame.Desktop", self.bootstrap_context)
@ -301,7 +301,7 @@ class PresentationController:
Returns: Returns:
The found soffice executable, or None if not found. The found soffice executable, or None if not found.
""" """
# Checkes soffice in the same directory of uno.py # Check soffice in the same directory of uno.py
# This works for Linux OpenOffice/LibreOffice local # This works for Linux OpenOffice/LibreOffice local
# installation, and OpenOffice on MacOSX. # installation, and OpenOffice on MacOSX.
soffice = os.path.join( soffice = os.path.join(
@ -338,7 +338,7 @@ class PresentationController:
if soffice.lower().find("libreoffice") != -1: if soffice.lower().find("libreoffice") != -1:
return True return True
# Checks the symbolic link at /usr/bin/soffice # Check the symbolic link at /usr/bin/soffice
if soffice == "/usr/bin/soffice" and os.path.islink(soffice): if soffice == "/usr/bin/soffice" and os.path.islink(soffice):
if os.readlink(soffice).lower().find("libreoffice") != -1: if os.readlink(soffice).lower().find("libreoffice") != -1:
return True return True