forked from openlp/openlp
Change OpenOffice to use pipes not sockets to resolve slow networking issue. Fix option parsing unicode problem for python 2.5
bzr-revno: 1044
This commit is contained in:
commit
9539e0fb22
22
openlp.pyw
22
openlp.pyw
@ -162,18 +162,18 @@ def main():
|
|||||||
the PyQt4 Application.
|
the PyQt4 Application.
|
||||||
"""
|
"""
|
||||||
# Set up command line options.
|
# Set up command line options.
|
||||||
usage = u'Usage: %prog [options] [qt-options]'
|
usage = 'Usage: %prog [options] [qt-options]'
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
parser.add_option(u'-e', u'--no-error-form', dest=u'no_error_form',
|
parser.add_option('-e', '--no-error-form', dest='no_error_form',
|
||||||
action=u'store_true', help=u'Disable the error notification form.')
|
action='store_true', help='Disable the error notification form.')
|
||||||
parser.add_option(u'-l', u'--log-level', dest=u'loglevel',
|
parser.add_option('-l', '--log-level', dest='loglevel',
|
||||||
default=u'warning', metavar=u'LEVEL', help=u'Set logging to LEVEL '
|
default='warning', metavar='LEVEL', help='Set logging to LEVEL '
|
||||||
u'level. Valid values are "debug", "info", "warning".')
|
'level. Valid values are "debug", "info", "warning".')
|
||||||
parser.add_option(u'-p', u'--portable', dest=u'portable',
|
parser.add_option('-p', '--portable', dest='portable',
|
||||||
action=u'store_true', help=u'Specify if this should be run as a '
|
action='store_true', help='Specify if this should be run as a '
|
||||||
u'portable app, off a USB flash drive (not implemented).')
|
'portable app, off a USB flash drive (not implemented).')
|
||||||
parser.add_option(u'-s', u'--style', dest=u'style',
|
parser.add_option('-s', '--style', dest='style',
|
||||||
help=u'Set the Qt4 style (passed directly to Qt4).')
|
help='Set the Qt4 style (passed directly to Qt4).')
|
||||||
# Set up logging
|
# Set up logging
|
||||||
log_path = AppLocation.get_directory(AppLocation.CacheDir)
|
log_path = AppLocation.get_directory(AppLocation.CacheDir)
|
||||||
if not os.path.exists(log_path):
|
if not os.path.exists(log_path):
|
||||||
|
@ -74,6 +74,7 @@ class ImpressController(PresentationController):
|
|||||||
self.process = None
|
self.process = None
|
||||||
self.desktop = None
|
self.desktop = None
|
||||||
self.manager = None
|
self.manager = None
|
||||||
|
self.uno_connection_type = u'pipe' #u'socket'
|
||||||
|
|
||||||
def check_available(self):
|
def check_available(self):
|
||||||
"""
|
"""
|
||||||
@ -98,7 +99,14 @@ class ImpressController(PresentationController):
|
|||||||
self.manager._FlagAsMethod(u'Bridge_GetValueObject')
|
self.manager._FlagAsMethod(u'Bridge_GetValueObject')
|
||||||
else:
|
else:
|
||||||
# -headless
|
# -headless
|
||||||
cmd = u'openoffice.org -nologo -norestore -minimized -invisible -nofirststartwizard -accept="socket,host=localhost,port=2002;urp;"'
|
if self.uno_connection_type == u'pipe':
|
||||||
|
cmd = u'openoffice.org -nologo -norestore -minimized ' \
|
||||||
|
+ u'-invisible -nofirststartwizard ' \
|
||||||
|
+ u'-accept=pipe,name=openlp_pipe;urp;'
|
||||||
|
else:
|
||||||
|
cmd = u'openoffice.org -nologo -norestore -minimized ' \
|
||||||
|
+ u'-invisible -nofirststartwizard ' \
|
||||||
|
+ u'-accept=socket,host=localhost,port=2002;urp;'
|
||||||
self.process = QtCore.QProcess()
|
self.process = QtCore.QProcess()
|
||||||
self.process.startDetached(cmd)
|
self.process.startDetached(cmd)
|
||||||
self.process.waitForStarted()
|
self.process.waitForStarted()
|
||||||
@ -120,8 +128,14 @@ class ImpressController(PresentationController):
|
|||||||
while ctx is None and loop < 3:
|
while ctx is None and loop < 3:
|
||||||
try:
|
try:
|
||||||
log.debug(u'get UNO Desktop Openoffice - resolve')
|
log.debug(u'get UNO Desktop Openoffice - resolve')
|
||||||
ctx = resolver.resolve(u'uno:socket,host=localhost,port=2002;'
|
if self.uno_connection_type == u'pipe':
|
||||||
u'urp;StarOffice.ComponentContext')
|
ctx = resolver.resolve(u'uno:' \
|
||||||
|
+ u'pipe,name=openlp_pipe;' \
|
||||||
|
+ u'urp;StarOffice.ComponentContext')
|
||||||
|
else:
|
||||||
|
ctx = resolver.resolve(u'uno:' \
|
||||||
|
+ u'socket,host=localhost,port=2002;' \
|
||||||
|
+ u'urp;StarOffice.ComponentContext')
|
||||||
except:
|
except:
|
||||||
log.exception(u'Unable to find running instance ')
|
log.exception(u'Unable to find running instance ')
|
||||||
self.start_process()
|
self.start_process()
|
||||||
|
@ -59,6 +59,7 @@ class OooImport(SongImport):
|
|||||||
self.document = None
|
self.document = None
|
||||||
self.process_started = False
|
self.process_started = False
|
||||||
self.filenames = kwargs[u'filenames']
|
self.filenames = kwargs[u'filenames']
|
||||||
|
self.uno_connection_type = u'pipe' #u'socket'
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'song_stop_import'), self.stop_import)
|
QtCore.SIGNAL(u'song_stop_import'), self.stop_import)
|
||||||
|
|
||||||
@ -106,8 +107,14 @@ class OooImport(SongImport):
|
|||||||
loop = 0
|
loop = 0
|
||||||
while ctx is None and loop < 5:
|
while ctx is None and loop < 5:
|
||||||
try:
|
try:
|
||||||
ctx = resolver.resolve(u'uno:socket,host=localhost,' \
|
if self.uno_connection_type == u'pipe':
|
||||||
+ 'port=2002;urp;StarOffice.ComponentContext')
|
ctx = resolver.resolve(u'uno:' \
|
||||||
|
+ u'pipe,name=openlp_pipe;' \
|
||||||
|
+ u'urp;StarOffice.ComponentContext')
|
||||||
|
else:
|
||||||
|
ctx = resolver.resolve(u'uno:' \
|
||||||
|
+ u'socket,host=localhost,port=2002;' \
|
||||||
|
+ u'urp;StarOffice.ComponentContext')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.start_ooo_process()
|
self.start_ooo_process()
|
||||||
@ -123,9 +130,14 @@ class OooImport(SongImport):
|
|||||||
self.manager._FlagAsMethod(u'Bridge_GetStruct')
|
self.manager._FlagAsMethod(u'Bridge_GetStruct')
|
||||||
self.manager._FlagAsMethod(u'Bridge_GetValueObject')
|
self.manager._FlagAsMethod(u'Bridge_GetValueObject')
|
||||||
else:
|
else:
|
||||||
|
if self.uno_connection_type == u'pipe':
|
||||||
cmd = u'openoffice.org -nologo -norestore -minimized ' \
|
cmd = u'openoffice.org -nologo -norestore -minimized ' \
|
||||||
+ u'-invisible -nofirststartwizard ' \
|
+ u'-invisible -nofirststartwizard ' \
|
||||||
+ '-accept="socket,host=localhost,port=2002;urp;"'
|
+ u'-accept=pipe,name=openlp_pipe;urp;'
|
||||||
|
else:
|
||||||
|
cmd = u'openoffice.org -nologo -norestore -minimized ' \
|
||||||
|
+ u'-invisible -nofirststartwizard ' \
|
||||||
|
+ u'-accept=socket,host=localhost,port=2002;urp;'
|
||||||
process = QtCore.QProcess()
|
process = QtCore.QProcess()
|
||||||
process.startDetached(cmd)
|
process.startDetached(cmd)
|
||||||
process.waitForStarted()
|
process.waitForStarted()
|
||||||
|
0
resources/images/about-new.bmp
Executable file → Normal file
0
resources/images/about-new.bmp
Executable file → Normal file
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
1
resources/openlp.desktop
Normal file → Executable file
1
resources/openlp.desktop
Normal file → Executable file
@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env xdg-open
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Encoding=UTF-8
|
Encoding=UTF-8
|
||||||
Name=OpenLP
|
Name=OpenLP
|
||||||
|
Loading…
Reference in New Issue
Block a user