eric7/HelpViewer/HelpViewerWidget.py

branch
eric7
changeset 9172
4bac907a4c74
parent 8902
ba9b8c6e4928
--- a/eric7/HelpViewer/HelpViewerWidget.py	Wed Jun 22 17:53:08 2022 +0200
+++ b/eric7/HelpViewer/HelpViewerWidget.py	Thu Jun 23 17:54:29 2022 +0200
@@ -24,6 +24,7 @@
     WEBENGINE_AVAILABLE = False
 
 from EricWidgets import EricFileDialog, EricMessageBox
+from EricWidgets.EricApplication import ericApp
 from EricWidgets.EricTextEditSearchWidget import (
     EricTextEditSearchWidget, EricTextEditType
 )
@@ -46,6 +47,39 @@
     """
     MaxHistoryItems = 20    # max. number of history items to be shown
     
+    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: 10px 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: 10px 10px 10px 10px;\n'''
+        '''}\n'''
+        '''</style'''
+        '''</head>\n'''
+        '''<body>\n'''
+        '''</body>\n'''
+        '''</html>'''
+    )
+    
     def __init__(self, parent=None):
         """
         Constructor
@@ -429,6 +463,8 @@
         if urlStr:
             url = QUrl(urlStr)
             self.openUrl(url)
+        else:
+            self.openUrl(QUrl("about:blank"))
     
     def activate(self, searchWord=None, url=None):
         """
@@ -481,7 +517,9 @@
         """
         Private slot to add a new empty page.
         """
-        self.addPage()
+        urlStr = self.__helpSelector.currentData()
+        url = QUrl(urlStr) if bool(urlStr) else None
+        self.addPage(url=url)
     
     def addPage(self, url=None, background=False):
         """
@@ -1284,3 +1322,16 @@
         @rtype int
         """
         return self.__helpStack.count()
+    
+    @classmethod
+    def emptyDocument(cls):
+        """
+        Class method to get the HTML code for an empty page.
+        
+        @return HTML code for an empty page.
+        @rtype str
+        """
+        if ericApp().usesDarkPalette():
+            return cls.EmpytDocument_Dark
+        else:
+            return cls.EmpytDocument_Light

eric ide

mercurial