forked from openlp/openlp
Fix SoF/OOo imports
This commit is contained in:
parent
31d2ca5a2b
commit
b522247094
@ -96,7 +96,7 @@ class OooImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
self.start_ooo_process()
|
self.start_ooo_process()
|
||||||
self.desktop = self.manager.createInstance(
|
self.desktop = self.ooo_manager.createInstance(
|
||||||
u'com.sun.star.frame.Desktop')
|
u'com.sun.star.frame.Desktop')
|
||||||
else:
|
else:
|
||||||
context = uno.getComponentContext()
|
context = uno.getComponentContext()
|
||||||
@ -118,9 +118,9 @@ class OooImport(SongImport):
|
|||||||
def start_ooo_process(self):
|
def start_ooo_process(self):
|
||||||
try:
|
try:
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
self.manager = Dispatch(u'com.sun.star.ServiceManager')
|
self.ooo_manager = Dispatch(u'com.sun.star.ServiceManager')
|
||||||
self.manager._FlagAsMethod(u'Bridge_GetStruct')
|
self.ooo_manager._FlagAsMethod(u'Bridge_GetStruct')
|
||||||
self.manager._FlagAsMethod(u'Bridge_GetValueObject')
|
self.ooo_manager._FlagAsMethod(u'Bridge_GetValueObject')
|
||||||
else:
|
else:
|
||||||
cmd = get_uno_command()
|
cmd = get_uno_command()
|
||||||
process = QtCore.QProcess()
|
process = QtCore.QProcess()
|
||||||
@ -134,6 +134,7 @@ class OooImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
Open the passed file in OpenOffice.org Impress
|
Open the passed file in OpenOffice.org Impress
|
||||||
"""
|
"""
|
||||||
|
self.filepath = filepath
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
url = filepath.replace(u'\\', u'/')
|
url = filepath.replace(u'\\', u'/')
|
||||||
url = url.replace(u':', u'|').replace(u' ', u'%20')
|
url = url.replace(u':', u'|').replace(u' ', u'%20')
|
||||||
@ -191,7 +192,6 @@ class OooImport(SongImport):
|
|||||||
if slidetext.strip() == u'':
|
if slidetext.strip() == u'':
|
||||||
slidetext = u'\f'
|
slidetext = u'\f'
|
||||||
text += slidetext
|
text += slidetext
|
||||||
song = SongImport(self.manager)
|
|
||||||
songs = SongImport.process_songs_text(self.manager, text)
|
songs = SongImport.process_songs_text(self.manager, text)
|
||||||
for song in songs:
|
for song in songs:
|
||||||
song.finish()
|
song.finish()
|
||||||
|
@ -55,13 +55,14 @@ class SongImport(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
QtCore.QObject.__init__(self)
|
QtCore.QObject.__init__(self)
|
||||||
if kwargs.has_key(u'filename'):
|
if kwargs:
|
||||||
self.import_source = kwargs[u'filename']
|
if kwargs.has_key(u'filename'):
|
||||||
elif kwargs.has_key(u'filenames'):
|
self.import_source = kwargs[u'filename']
|
||||||
self.import_source = kwargs[u'filenames']
|
elif kwargs.has_key(u'filenames'):
|
||||||
else:
|
self.import_source = kwargs[u'filenames']
|
||||||
raise KeyError(u'Keyword arguments "filename[s]" not supplied.')
|
else:
|
||||||
log.debug(self.import_source)
|
raise KeyError(u'Keyword arguments "filename[s]" not supplied.')
|
||||||
|
log.debug(self.import_source)
|
||||||
self.song = None
|
self.song = None
|
||||||
self.stop_import_flag = False
|
self.stop_import_flag = False
|
||||||
self.set_defaults()
|
self.set_defaults()
|
||||||
@ -146,12 +147,12 @@ class SongImport(QtCore.QObject):
|
|||||||
def process_verse_text(self, text):
|
def process_verse_text(self, text):
|
||||||
lines = text.split(u'\n')
|
lines = text.split(u'\n')
|
||||||
if text.lower().find(self.copyright_string) >= 0 \
|
if text.lower().find(self.copyright_string) >= 0 \
|
||||||
or text.find(SongStrings.CopyrightSymbol) >= 0:
|
or text.find(unicode(SongStrings.CopyrightSymbol)) >= 0:
|
||||||
copyright_found = False
|
copyright_found = False
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if (copyright_found or
|
if (copyright_found or
|
||||||
line.lower().find(self.copyright_string) >= 0 or
|
line.lower().find(self.copyright_string) >= 0 or
|
||||||
line.find(SongStrings.CopyrightSymbol) >= 0):
|
line.find(unicode(SongStrings.CopyrightSymbol)) >= 0):
|
||||||
copyright_found = True
|
copyright_found = True
|
||||||
self.add_copyright(line)
|
self.add_copyright(line)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user