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