--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eric7/HelpViewer/HelpViewerWidget.py Wed Oct 06 20:00:29 2021 +0200 @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing an embedded viewer for QtHelp and local HTML files. +""" + +from PyQt6.QtWidgets import ( + QWidget, QVBoxLayout, QComboBox, QSizePolicy, QStackedWidget +) + + +class HelpViewerWidget(QWidget): + """ + Class implementing an embedded viewer for QtHelp and local HTML files. + """ + def __init__(self, parent=None): + """ + Constructor + + @param parent reference to the parent widget (defaults to None) + @type QWidget (optional) + """ + super().__init__(parent) + self.setObjectName("HelpViewerWidget") + + self.__layout = QVBoxLayout() + self.__layout.setObjectName("MainLayout") + self.__layout.setContentsMargins(0, 3, 0, 0) + + self.__helpSelector = QComboBox(self) + self.__helpSelector.setSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) + self.__layout.addWidget(self.__helpSelector) + self.__populateHelpSelector() + + self.__helpStack = QStackedWidget(self) + self.__helpStack.setSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) + self.__layout.addWidget(self.__helpStack) + + self.__helpNavigationStack = QStackedWidget(self) + self.__helpNavigationStack.setSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) + self.__layout.addWidget(self.__helpNavigationStack) + self.__populateNavigationStack() + + self.setLayout(self.__layout) + + def __populateNavigationStack(self): + """ + Private method to populate the stack of navigation widgets. + """ + # TODO: not yet implemented + + def __populateHelpSelector(self): + """ + Private method to populate the help selection combo box. + """ + # TODO: not yet implemented + + def searchQtHelp(self, searchExpression): + """ + Public method to search for a given search expression. + + @param searchExpression expression to search for + @type str + """ + # TODO: not yet implemented + + def activate(self, searchWord=None): + """ + Public method to activate the widget and search for a given word. + + @param searchWord word to search for (defaults to None) + @type str (optional) + """ + # TODO: not yet implemented + + if searchWord: + self.searchQtHelp(searchWord)