eric6/UI/CodeDocumentationViewer.py

changeset 7526
92ef4bd9d2c5
parent 7360
9190402e4505
child 7717
f32d7965a17e
equal deleted inserted replaced
7525:6d1f954947bc 7526:92ef4bd9d2c5
15 QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QSizePolicy, 15 QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QSizePolicy,
16 QLineEdit, QTextBrowser, QToolTip 16 QLineEdit, QTextBrowser, QToolTip
17 ) 17 )
18 18
19 from E5Gui.E5TextEditSearchWidget import E5TextEditSearchWidget 19 from E5Gui.E5TextEditSearchWidget import E5TextEditSearchWidget
20 from E5Gui.E5Application import e5App
20 21
21 import Preferences 22 import Preferences
22 23
23 from .CodeDocumentationViewerTemplate import ( 24 from .CodeDocumentationViewerTemplate import (
24 prepareDocumentationViewerHtmlDocument, 25 prepareDocumentationViewerHtmlDocument,
27 ) 28 )
28 29
29 from .data import codeDocumentationViewer_rc # __IGNORE_WARNING__ 30 from .data import codeDocumentationViewer_rc # __IGNORE_WARNING__
30 31
31 32
32 # TODO: complete the support for color schemes as soon as Qt 5.14 is released
33 class DocumentationViewerWidget(QWidget): 33 class DocumentationViewerWidget(QWidget):
34 """ 34 """
35 Class implementing a rich text documentation viewer. 35 Class implementing a rich text documentation viewer.
36 """ 36 """
37 EmpytDocument_Light = (
38 '''<!DOCTYPE html>\n'''
39 '''<html lang="EN">\n'''
40 '''<head>\n'''
41 '''<style type="text/css">\n'''
42 '''html {background-color: #ffffff;}\n'''
43 '''body {background-color: #ffffff;\n'''
44 ''' color: #000000;\n'''
45 ''' margin: 0px 10px 10px 10px;\n'''
46 '''}\n'''
47 '''</style'''
48 '''</head>\n'''
49 '''<body>\n'''
50 '''</body>\n'''
51 '''</html>'''
52 )
53 EmpytDocument_Dark = (
54 '''<!DOCTYPE html>\n'''
55 '''<html lang="EN">\n'''
56 '''<head>\n'''
57 '''<style type="text/css">\n'''
58 '''html {background-color: #262626;}\n'''
59 '''body {background-color: #262626;\n'''
60 ''' color: #ffffff;\n'''
61 ''' margin: 0px 10px 10px 10px;\n'''
62 '''}\n'''
63 '''</style'''
64 '''</head>\n'''
65 '''<body>\n'''
66 '''</body>\n'''
67 '''</html>'''
68 )
69
37 def __init__(self, parent=None): 70 def __init__(self, parent=None):
38 """ 71 """
39 Constructor 72 Constructor
40 73
41 @param parent reference to the parent widget 74 @param parent reference to the parent widget
111 Public method to clear the shown contents. 144 Public method to clear the shown contents.
112 """ 145 """
113 if self.__viewerType == "QTextEdit": 146 if self.__viewerType == "QTextEdit":
114 self.__contents.clear() 147 self.__contents.clear()
115 else: 148 else:
116 self.__contents.setHtml("") 149 if e5App().usesDarkPalette():
150 self.__contents.setHtml(self.EmpytDocument_Dark)
151 else:
152 self.__contents.setHtml(self.EmpytDocument_Light)
117 153
118 154
119 class CodeDocumentationViewer(QWidget): 155 class CodeDocumentationViewer(QWidget):
120 """ 156 """
121 Class implementing a widget to show some source code information provided 157 Class implementing a widget to show some source code information provided

eric ide

mercurial