eric7/HelpViewer/HelpViewerWidget.py

Wed, 06 Oct 2021 20:00:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 06 Oct 2021 20:00:29 +0200
branch
eric7
changeset 8678
85a83e4e7f18
child 8679
fd172973428e
permissions
-rw-r--r--

Started implementing the embedded help viewer widget.

# -*- 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)

eric ide

mercurial