eric7/HelpViewer/HelpViewerWidget.py

branch
eric7
changeset 8678
85a83e4e7f18
child 8679
fd172973428e
equal deleted inserted replaced
8677:2e3d02a0f0b6 8678:85a83e4e7f18
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing an embedded viewer for QtHelp and local HTML files.
8 """
9
10 from PyQt6.QtWidgets import (
11 QWidget, QVBoxLayout, QComboBox, QSizePolicy, QStackedWidget
12 )
13
14
15 class HelpViewerWidget(QWidget):
16 """
17 Class implementing an embedded viewer for QtHelp and local HTML files.
18 """
19 def __init__(self, parent=None):
20 """
21 Constructor
22
23 @param parent reference to the parent widget (defaults to None)
24 @type QWidget (optional)
25 """
26 super().__init__(parent)
27 self.setObjectName("HelpViewerWidget")
28
29 self.__layout = QVBoxLayout()
30 self.__layout.setObjectName("MainLayout")
31 self.__layout.setContentsMargins(0, 3, 0, 0)
32
33 self.__helpSelector = QComboBox(self)
34 self.__helpSelector.setSizePolicy(
35 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
36 self.__layout.addWidget(self.__helpSelector)
37 self.__populateHelpSelector()
38
39 self.__helpStack = QStackedWidget(self)
40 self.__helpStack.setSizePolicy(
41 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
42 self.__layout.addWidget(self.__helpStack)
43
44 self.__helpNavigationStack = QStackedWidget(self)
45 self.__helpNavigationStack.setSizePolicy(
46 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
47 self.__layout.addWidget(self.__helpNavigationStack)
48 self.__populateNavigationStack()
49
50 self.setLayout(self.__layout)
51
52 def __populateNavigationStack(self):
53 """
54 Private method to populate the stack of navigation widgets.
55 """
56 # TODO: not yet implemented
57
58 def __populateHelpSelector(self):
59 """
60 Private method to populate the help selection combo box.
61 """
62 # TODO: not yet implemented
63
64 def searchQtHelp(self, searchExpression):
65 """
66 Public method to search for a given search expression.
67
68 @param searchExpression expression to search for
69 @type str
70 """
71 # TODO: not yet implemented
72
73 def activate(self, searchWord=None):
74 """
75 Public method to activate the widget and search for a given word.
76
77 @param searchWord word to search for (defaults to None)
78 @type str (optional)
79 """
80 # TODO: not yet implemented
81
82 if searchWord:
83 self.searchQtHelp(searchWord)

eric ide

mercurial