|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2021 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the help viewer base class. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtCore import pyqtSignal, QUrl |
|
11 |
|
12 |
|
13 class HelpViewerImpl: |
|
14 """ |
|
15 Class implementing the help viewer base class. |
|
16 |
|
17 This is the base class of help viewer implementations and defines the |
|
18 interface. Als subclasses must implement the these methods. |
|
19 |
|
20 @signal titleChanged() emitted to indicate a change of the page title |
|
21 @signal loadFinished(ok) emitted to indicate the completion of a page load |
|
22 @signal zoomChanged() emitted to indicate a change of the zoom level |
|
23 """ |
|
24 titleChanged = pyqtSignal() |
|
25 loadFinished = pyqtSignal(bool) |
|
26 zoomChanged = pyqtSignal() |
|
27 |
|
28 def __init__(self, engine): |
|
29 """ |
|
30 Constructor |
|
31 |
|
32 @param engine reference to the help engine |
|
33 @type QHelpEngine |
|
34 """ |
|
35 self._engine = engine |
|
36 |
|
37 def setLink(self, url): |
|
38 """ |
|
39 Public method to set the URL of the document to be shown. |
|
40 |
|
41 @param url URL of the document |
|
42 @type QUrl |
|
43 @exception RuntimeError raised when not implemented |
|
44 """ |
|
45 raise RuntimeError("Not implemented") |
|
46 |
|
47 def link(self): |
|
48 """ |
|
49 Public method to get the URL of the shown document. |
|
50 |
|
51 @return URL of the document |
|
52 @rtype QUrl |
|
53 @exception RuntimeError raised when not implemented |
|
54 """ |
|
55 raise RuntimeError("Not implemented") |
|
56 return QUrl() |
|
57 |
|
58 def pageTitle(self): |
|
59 """ |
|
60 Public method get the page title. |
|
61 |
|
62 @return page title |
|
63 @rtype str |
|
64 @exception RuntimeError raised when not implemented |
|
65 """ |
|
66 raise RuntimeError("Not implemented") |
|
67 return "" |
|
68 |
|
69 def isEmptyPage(self): |
|
70 """ |
|
71 Public method to check, if the current page is the empty page. |
|
72 |
|
73 @return flag indicating an empty page is loaded |
|
74 @rtype bool |
|
75 @exception RuntimeError raised when not implemented |
|
76 """ |
|
77 raise RuntimeError("Not implemented") |
|
78 return False |
|
79 |
|
80 def gotoHistory(self, index): |
|
81 """ |
|
82 Public method to step through the history. |
|
83 |
|
84 @param index history index (<0 backward, >0 forward) |
|
85 @type int |
|
86 @exception RuntimeError raised when not implemented |
|
87 """ |
|
88 raise RuntimeError("Not implemented") |
|
89 |
|
90 def isBackwardAvailable(self): |
|
91 """ |
|
92 Public method to check, if stepping backward through the history is |
|
93 available. |
|
94 |
|
95 @return flag indicating backward stepping is available |
|
96 @rtype bool |
|
97 @exception RuntimeError raised when not implemented |
|
98 """ |
|
99 raise RuntimeError("Not implemented") |
|
100 return False |
|
101 |
|
102 def isForwardAvailable(self): |
|
103 """ |
|
104 Public method to check, if stepping forward through the history is |
|
105 available. |
|
106 |
|
107 @return flag indicating forward stepping is available |
|
108 @rtype bool |
|
109 @exception RuntimeError raised when not implemented |
|
110 """ |
|
111 raise RuntimeError("Not implemented") |
|
112 return False |
|
113 |
|
114 def scaleUp(self): |
|
115 """ |
|
116 Public method to zoom in. |
|
117 |
|
118 @exception RuntimeError raised when not implemented |
|
119 """ |
|
120 raise RuntimeError("Not implemented") |
|
121 |
|
122 def scaleDown(self): |
|
123 """ |
|
124 Public method to zoom out. |
|
125 |
|
126 @exception RuntimeError raised when not implemented |
|
127 """ |
|
128 raise RuntimeError("Not implemented") |
|
129 |
|
130 def setScale(self, scale): |
|
131 """ |
|
132 Public method to set the zoom level. |
|
133 |
|
134 @param scale zoom level to set |
|
135 @type int |
|
136 @exception RuntimeError raised when not implemented |
|
137 """ |
|
138 raise RuntimeError("Not implemented") |
|
139 |
|
140 def resetScale(self): |
|
141 """ |
|
142 Public method to reset the zoom level. |
|
143 |
|
144 @exception RuntimeError raised when not implemented |
|
145 """ |
|
146 raise RuntimeError("Not implemented") |
|
147 |
|
148 def scale(self): |
|
149 """ |
|
150 Public method to get the zoom level. |
|
151 |
|
152 @return current zoom level |
|
153 @rtype int |
|
154 @exception RuntimeError raised when not implemented |
|
155 """ |
|
156 raise RuntimeError("Not implemented") |
|
157 return 0 |
|
158 |
|
159 def isScaleUpAvailable(self): |
|
160 """ |
|
161 Public method to check, if the max. zoom level is reached. |
|
162 |
|
163 @return flag indicating scale up is available |
|
164 @rtype bool |
|
165 @exception RuntimeError raised when not implemented |
|
166 """ |
|
167 raise RuntimeError("Not implemented") |
|
168 return False |
|
169 |
|
170 def isScaleDownAvailable(self): |
|
171 """ |
|
172 Public method to check, if the min. zoom level is reached. |
|
173 |
|
174 @return flag indicating scale down is available |
|
175 @rtype bool |
|
176 @exception RuntimeError raised when not implemented |
|
177 """ |
|
178 raise RuntimeError("Not implemented") |
|
179 return False |