27 QToolTip, |
27 QToolTip, |
28 QVBoxLayout, |
28 QVBoxLayout, |
29 QWidget, |
29 QWidget, |
30 ) |
30 ) |
31 |
31 |
32 from eric7 import Preferences, Utilities |
32 from eric7 import Preferences |
33 from eric7.EricWidgets.EricApplication import ericApp |
33 from eric7.EricWidgets.EricApplication import ericApp |
|
34 from eric7.SystemUtilities import FileSystemUtilities |
34 |
35 |
35 |
36 |
36 class PreviewerHTML(QWidget): |
37 class PreviewerHTML(QWidget): |
37 """ |
38 """ |
38 Class implementing a previewer widget for HTML, Markdown and ReST files. |
39 Class implementing a previewer widget for HTML, Markdown and ReST files. |
252 @param html processed HTML text ready to be shown |
253 @param html processed HTML text ready to be shown |
253 @type str |
254 @type str |
254 @param rootPath path of the web site root |
255 @param rootPath path of the web site root |
255 @type str |
256 @type str |
256 """ |
257 """ |
257 self.__previewedPath = Utilities.normcasepath( |
258 self.__previewedPath = FileSystemUtilities.normcasepath( |
258 Utilities.fromNativeSeparators(filePath) |
259 FileSystemUtilities.fromNativeSeparators(filePath) |
259 ) |
260 ) |
260 self.__saveScrollBarPositions() |
261 self.__saveScrollBarPositions() |
261 self.previewView.page().loadFinished.connect(self.__restoreScrollBarPositions) |
262 self.previewView.page().loadFinished.connect(self.__restoreScrollBarPositions) |
262 if not filePath: |
263 if not filePath: |
263 filePath = "/" |
264 filePath = "/" |
550 incMatch = incRe.search(txt) |
551 incMatch = incRe.search(txt) |
551 if incMatch is None: |
552 if incMatch is None: |
552 break |
553 break |
553 |
554 |
554 if incMatch.group(1) == "virtual": |
555 if incMatch.group(1) == "virtual": |
555 incFile = Utilities.normjoinpath(docRoot, incMatch.group(2)) |
556 incFile = FileSystemUtilities.normjoinpath(docRoot, incMatch.group(2)) |
556 elif incMatch.group(1) == "file": |
557 elif incMatch.group(1) == "file": |
557 incFile = Utilities.normjoinpath(baseDir, incMatch.group(2)) |
558 incFile = FileSystemUtilities.normjoinpath(baseDir, incMatch.group(2)) |
558 else: |
559 else: |
559 incFile = "" |
560 incFile = "" |
560 if os.path.exists(incFile): |
561 if os.path.exists(incFile): |
561 try: |
562 try: |
562 with open(incFile, "r") as f: |
563 with open(incFile, "r") as f: |