forked from openlp/openlp
Refactor OOo song imports
This commit is contained in:
parent
934d26bd0a
commit
0a52af1869
@ -77,18 +77,24 @@ class OooImport(SongImport):
|
|||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
self.open_ooo_file(filename)
|
self.open_ooo_file(filename)
|
||||||
if self.document:
|
if self.document:
|
||||||
if self.document.supportsService(
|
self.process_ooo_document()
|
||||||
"com.sun.star.presentation.PresentationDocument"):
|
|
||||||
self.process_pres()
|
|
||||||
if self.document.supportsService(
|
|
||||||
"com.sun.star.text.TextDocument"):
|
|
||||||
self.process_doc()
|
|
||||||
self.close_ooo_file()
|
self.close_ooo_file()
|
||||||
self.close_ooo()
|
self.close_ooo()
|
||||||
self.import_wizard.progressBar.setMaximum(1)
|
self.import_wizard.progressBar.setMaximum(1)
|
||||||
self.import_wizard.incrementProgressBar(u'', 1)
|
self.import_wizard.incrementProgressBar(u'', 1)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def process_ooo_document(self):
|
||||||
|
"""
|
||||||
|
Handle the import process for OpenOffice files. This method facilitates
|
||||||
|
allowing subclasses to handle specific types of OpenOffice files.
|
||||||
|
"""
|
||||||
|
if self.document.supportsService(
|
||||||
|
"com.sun.star.presentation.PresentationDocument"):
|
||||||
|
self.process_pres()
|
||||||
|
if self.document.supportsService("com.sun.star.text.TextDocument"):
|
||||||
|
self.process_doc()
|
||||||
|
|
||||||
def start_ooo(self):
|
def start_ooo(self):
|
||||||
"""
|
"""
|
||||||
Start OpenOffice.org process
|
Start OpenOffice.org process
|
||||||
|
@ -75,23 +75,11 @@ class SofImport(OooImport):
|
|||||||
"""
|
"""
|
||||||
OooImport.__init__(self, master_manager, **kwargs)
|
OooImport.__init__(self, master_manager, **kwargs)
|
||||||
|
|
||||||
def do_import(self):
|
def process_ooo_document(self):
|
||||||
self.stop_import_flag = False
|
"""
|
||||||
self.start_ooo()
|
Handle the import process for SoF files.
|
||||||
for filename in self.filenames:
|
"""
|
||||||
if self.stop_import_flag:
|
self.process_sof_file()
|
||||||
self.import_wizard.incrementProgressBar(u'Import cancelled', 0)
|
|
||||||
return
|
|
||||||
filename = unicode(filename)
|
|
||||||
if os.path.isfile(filename):
|
|
||||||
self.open_ooo_file(filename)
|
|
||||||
if self.document:
|
|
||||||
self.process_sof_file()
|
|
||||||
self.close_ooo_file()
|
|
||||||
self.close_ooo()
|
|
||||||
self.import_wizard.progressBar.setMaximum(1)
|
|
||||||
self.import_wizard.incrementProgressBar(u'', 1)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def process_sof_file(self):
|
def process_sof_file(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user