Handle LibreOffice and SOffice commands on linux

Fixed imports conflict on merge.

bzr-revno: 2453
This commit is contained in:
2014-12-07 08:20:30 +00:00 committed by Tim Bentley
commit 24a8f67fd0
1 changed files with 8 additions and 2 deletions

View File

@ -36,6 +36,7 @@ import locale
import os import os
import re import re
import time import time
from shutil import which
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import sys import sys
import urllib.request import urllib.request
@ -426,13 +427,18 @@ def get_uno_command():
""" """
Returns the UNO command to launch an openoffice.org instance. Returns the UNO command to launch an openoffice.org instance.
""" """
COMMAND = 'soffice' for command in ['libreoffice', 'soffice']:
if which(command):
break
else:
raise FileNotFoundError('Command not found')
OPTIONS = '--nologo --norestore --minimized --nodefault --nofirststartwizard' OPTIONS = '--nologo --norestore --minimized --nodefault --nofirststartwizard'
if UNO_CONNECTION_TYPE == 'pipe': if UNO_CONNECTION_TYPE == 'pipe':
CONNECTION = '"--accept=pipe,name=openlp_pipe;urp;"' CONNECTION = '"--accept=pipe,name=openlp_pipe;urp;"'
else: else:
CONNECTION = '"--accept=socket,host=localhost,port=2002;urp;"' CONNECTION = '"--accept=socket,host=localhost,port=2002;urp;"'
return '%s %s %s' % (COMMAND, OPTIONS, CONNECTION) return '%s %s %s' % (command, OPTIONS, CONNECTION)
def get_uno_instance(resolver): def get_uno_instance(resolver):