forked from openlp/openlp
Make the PdfController reload backend if setting changes.
This commit is contained in:
parent
d02377f74f
commit
e958c04659
@ -138,6 +138,9 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
self.display_type_combo_box.clear()
|
self.display_type_combo_box.clear()
|
||||||
for item in self.controllers:
|
for item in self.controllers:
|
||||||
|
# For PDF reload backend, since it can have changed
|
||||||
|
if self.controllers[item].name == 'Pdf':
|
||||||
|
self.controllers[item].check_available()
|
||||||
# load the drop down selection
|
# load the drop down selection
|
||||||
if self.controllers[item].enabled():
|
if self.controllers[item].enabled():
|
||||||
self.display_type_combo_box.addItem(item)
|
self.display_type_combo_box.addItem(item)
|
||||||
|
@ -57,10 +57,9 @@ class PdfController(PresentationController):
|
|||||||
self.process = None
|
self.process = None
|
||||||
PresentationController.__init__(self, plugin, 'Pdf', PdfDocument)
|
PresentationController.__init__(self, plugin, 'Pdf', PdfDocument)
|
||||||
self.supports = ['pdf']
|
self.supports = ['pdf']
|
||||||
self.mudrawbin = ''
|
self.also_supports = []
|
||||||
self.gsbin = ''
|
# Determine whether mudraw or ghostscript is used
|
||||||
if self.check_installed() and self.mudrawbin:
|
self.check_installed()
|
||||||
self.also_supports = ['xps']
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_binary(program_path):
|
def check_binary(program_path):
|
||||||
@ -110,16 +109,18 @@ class PdfController(PresentationController):
|
|||||||
:return: True if program to open PDF-files was found, otherwise False.
|
:return: True if program to open PDF-files was found, otherwise False.
|
||||||
"""
|
"""
|
||||||
log.debug('check_installed Pdf')
|
log.debug('check_installed Pdf')
|
||||||
|
self.mudrawbin = ''
|
||||||
|
self.gsbin = ''
|
||||||
|
self.also_supports = []
|
||||||
# Use the user defined program if given
|
# Use the user defined program if given
|
||||||
if (Settings().value('presentations/enable_pdf_program')):
|
if (Settings().value('presentations/enable_pdf_program')):
|
||||||
pdf_program = Settings().value('presentations/pdf_program')
|
pdf_program = Settings().value('presentations/pdf_program')
|
||||||
program_type = self.check_binary(pdf_program)
|
program_type = self.check_binary(pdf_program)
|
||||||
if program_type == 'gs':
|
if program_type == 'gs':
|
||||||
self.gsbin = pdf_program
|
self.gsbin = pdf_program
|
||||||
return True
|
|
||||||
elif program_type == 'mudraw':
|
elif program_type == 'mudraw':
|
||||||
self.mudrawbin = pdf_program
|
self.mudrawbin = pdf_program
|
||||||
return True
|
else:
|
||||||
# Fallback to autodetection
|
# Fallback to autodetection
|
||||||
application_path = AppLocation.get_directory(AppLocation.AppDir)
|
application_path = AppLocation.get_directory(AppLocation.AppDir)
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
@ -144,10 +145,13 @@ class PdfController(PresentationController):
|
|||||||
application_path = AppLocation.get_directory(AppLocation.AppDir)
|
application_path = AppLocation.get_directory(AppLocation.AppDir)
|
||||||
if os.path.isfile(application_path + '/../mudraw'):
|
if os.path.isfile(application_path + '/../mudraw'):
|
||||||
self.mudrawbin = application_path + '/../mudraw'
|
self.mudrawbin = application_path + '/../mudraw'
|
||||||
if not self.mudrawbin and not self.gsbin:
|
if self.mudrawbin:
|
||||||
return False
|
self.also_supports = ['xps']
|
||||||
else:
|
|
||||||
return True
|
return True
|
||||||
|
elif self.gsbin:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user