forked from openlp/openlp
Clean pdfcontroller from mupdf/ghostscript
This commit is contained in:
parent
2caf9c0f94
commit
04e3ef5d86
@ -20,14 +20,10 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openlp.core.common import is_win
|
|
||||||
from openlp.core.display.screens import ScreenList
|
from openlp.core.display.screens import ScreenList
|
||||||
from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument
|
from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument
|
||||||
|
|
||||||
|
|
||||||
if is_win():
|
|
||||||
from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import fitz
|
import fitz
|
||||||
PYMUPDF_AVAILABLE = True
|
PYMUPDF_AVAILABLE = True
|
||||||
@ -55,31 +51,16 @@ class PdfController(PresentationController):
|
|||||||
super(PdfController, self).__init__(plugin, 'Pdf', PdfDocument)
|
super(PdfController, self).__init__(plugin, 'Pdf', PdfDocument)
|
||||||
self.process = None
|
self.process = None
|
||||||
self.supports = ['pdf']
|
self.supports = ['pdf']
|
||||||
self.also_supports = []
|
self.also_supports = ['xps', 'oxps', 'epub', 'cbz', 'fb2']
|
||||||
# Determine whether mudraw or ghostscript is used
|
|
||||||
self.check_installed()
|
|
||||||
|
|
||||||
def check_available(self):
|
def check_available(self):
|
||||||
"""
|
"""
|
||||||
PdfController is able to run on this machine.
|
PdfController is able to run on this machine.
|
||||||
|
|
||||||
:return: True if program to open PDF-files was found, otherwise False.
|
:return: True if PyMuPDF is installed, otherwise False.
|
||||||
"""
|
"""
|
||||||
log.debug('check_available Pdf')
|
log.debug('check_available Pdf')
|
||||||
return self.check_installed()
|
return PYMUPDF_AVAILABLE
|
||||||
|
|
||||||
def check_installed(self):
|
|
||||||
"""
|
|
||||||
Check the viewer is installed.
|
|
||||||
|
|
||||||
:return: True if program to open PDF-files was found, otherwise False.
|
|
||||||
"""
|
|
||||||
log.debug('check_installed Pdf')
|
|
||||||
self.also_supports = []
|
|
||||||
if PYMUPDF_AVAILABLE:
|
|
||||||
self.also_supports = ['xps', 'oxps', 'epub', 'cbz', 'fb2']
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
"""
|
"""
|
||||||
@ -111,12 +92,6 @@ class PdfDocument(PresentationDocument):
|
|||||||
self.hidden = False
|
self.hidden = False
|
||||||
self.image_files = []
|
self.image_files = []
|
||||||
self.num_pages = -1
|
self.num_pages = -1
|
||||||
# Setup startupinfo options for check_output to avoid console popping up on windows
|
|
||||||
if is_win():
|
|
||||||
self.startupinfo = STARTUPINFO()
|
|
||||||
self.startupinfo.dwFlags |= STARTF_USESHOWWINDOW
|
|
||||||
else:
|
|
||||||
self.startupinfo = None
|
|
||||||
|
|
||||||
def load_presentation(self):
|
def load_presentation(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user