eric7/UI/Previewers/PreviewerHTML.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8318
962bce857696
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
20 from PyQt6.QtGui import QCursor 20 from PyQt6.QtGui import QCursor
21 from PyQt6.QtWidgets import ( 21 from PyQt6.QtWidgets import (
22 QWidget, QVBoxLayout, QLabel, QCheckBox, QSizePolicy, QToolTip 22 QWidget, QVBoxLayout, QLabel, QCheckBox, QSizePolicy, QToolTip
23 ) 23 )
24 24
25 from E5Gui.E5Application import e5App 25 from E5Gui.EricApplication import ericApp
26 26
27 import Utilities 27 import Utilities
28 import Preferences 28 import Preferences
29 29
30 30
198 self.__setHtml(fn, self.tr( 198 self.__setHtml(fn, self.tr(
199 "<p>No preview available for this type of file.</p>")) 199 "<p>No preview available for this type of file.</p>"))
200 return 200 return
201 201
202 if fn: 202 if fn:
203 project = e5App().getObject("Project") 203 project = ericApp().getObject("Project")
204 if project.isProjectFile(fn): 204 if project.isProjectFile(fn):
205 rootPath = project.getProjectPath() 205 rootPath = project.getProjectPath()
206 else: 206 else:
207 rootPath = os.path.dirname(os.path.abspath(fn)) 207 rootPath = os.path.dirname(os.path.abspath(fn))
208 else: 208 else:
744 mermaid = ( 744 mermaid = (
745 "<script type='text/javascript' id='Mermaid-script'" 745 "<script type='text/javascript' id='Mermaid-script'"
746 " src='https://unpkg.com/mermaid@8/dist/mermaid.min.js'>\n" 746 " src='https://unpkg.com/mermaid@8/dist/mermaid.min.js'>\n"
747 "</script>\n" 747 "</script>\n"
748 ) 748 )
749 if e5App().usesDarkPalette(): 749 if ericApp().usesDarkPalette():
750 mermaid_initialize = ( 750 mermaid_initialize = (
751 "<script>mermaid.initialize({" 751 "<script>mermaid.initialize({"
752 "theme: 'dark', " 752 "theme: 'dark', "
753 "startOnLoad:true" 753 "startOnLoad:true"
754 "});</script>" 754 "});</script>"
768 body = markdown.markdown(text, extensions=extensions, 768 body = markdown.markdown(text, extensions=extensions,
769 output_format=htmlFormat.lower()) 769 output_format=htmlFormat.lower())
770 style = ( 770 style = (
771 (PreviewerHTMLStyles.css_markdown_dark + 771 (PreviewerHTMLStyles.css_markdown_dark +
772 PreviewerHTMLStyles.css_pygments_dark) 772 PreviewerHTMLStyles.css_pygments_dark)
773 if e5App().usesDarkPalette() else 773 if ericApp().usesDarkPalette() else
774 (PreviewerHTMLStyles.css_markdown_light + 774 (PreviewerHTMLStyles.css_markdown_light +
775 PreviewerHTMLStyles.css_pygments_light) 775 PreviewerHTMLStyles.css_pygments_light)
776 ) 776 )
777 777
778 if htmlFormat == "xhtml1": 778 if htmlFormat == "xhtml1":

eric ide

mercurial