CodeDocumentationViewer: improved the clean() method to respect current color scheme type.

Sun, 12 Apr 2020 14:45:14 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 12 Apr 2020 14:45:14 +0200
changeset 7526
92ef4bd9d2c5
parent 7525
6d1f954947bc
child 7527
b2ae47eaf0ae

CodeDocumentationViewer: improved the clean() method to respect current color scheme type.

eric6/UI/CodeDocumentationViewer.py file | annotate | diff | comparison | revisions
--- a/eric6/UI/CodeDocumentationViewer.py	Sun Apr 12 13:06:07 2020 +0200
+++ b/eric6/UI/CodeDocumentationViewer.py	Sun Apr 12 14:45:14 2020 +0200
@@ -17,6 +17,7 @@
 )
 
 from E5Gui.E5TextEditSearchWidget import E5TextEditSearchWidget
+from E5Gui.E5Application import e5App
 
 import Preferences
 
@@ -29,11 +30,43 @@
 from .data import codeDocumentationViewer_rc    # __IGNORE_WARNING__
 
 
-# TODO: complete the support for color schemes as soon as Qt 5.14 is released
 class DocumentationViewerWidget(QWidget):
     """
     Class implementing a rich text documentation viewer.
     """
+    EmpytDocument_Light = (
+        '''<!DOCTYPE html>\n'''
+        '''<html lang="EN">\n'''
+        '''<head>\n'''
+        '''<style type="text/css">\n'''
+        '''html {background-color: #ffffff;}\n'''
+        '''body {background-color: #ffffff;\n'''
+        '''      color: #000000;\n'''
+        '''      margin: 0px 10px 10px 10px;\n'''
+        '''}\n'''
+        '''</style'''
+        '''</head>\n'''
+        '''<body>\n'''
+        '''</body>\n'''
+        '''</html>'''
+    )
+    EmpytDocument_Dark = (
+        '''<!DOCTYPE html>\n'''
+        '''<html lang="EN">\n'''
+        '''<head>\n'''
+        '''<style type="text/css">\n'''
+        '''html {background-color: #262626;}\n'''
+        '''body {background-color: #262626;\n'''
+        '''      color: #ffffff;\n'''
+        '''      margin: 0px 10px 10px 10px;\n'''
+        '''}\n'''
+        '''</style'''
+        '''</head>\n'''
+        '''<body>\n'''
+        '''</body>\n'''
+        '''</html>'''
+    )
+    
     def __init__(self, parent=None):
         """
         Constructor
@@ -113,7 +146,10 @@
         if self.__viewerType == "QTextEdit":
             self.__contents.clear()
         else:
-            self.__contents.setHtml("")
+            if e5App().usesDarkPalette():
+                self.__contents.setHtml(self.EmpytDocument_Dark)
+            else:
+                self.__contents.setHtml(self.EmpytDocument_Light)
 
     
 class CodeDocumentationViewer(QWidget):

eric ide

mercurial