9 """ |
9 """ |
10 |
10 |
11 |
11 |
12 import os |
12 import os |
13 |
13 |
14 from PyQt5.QtCore import pyqtSignal, QThread, Qt, QMutex, QDateTime, QDir, \ |
14 from PyQt5.QtCore import ( |
15 QLibraryInfo, QFileInfo |
15 pyqtSignal, QThread, Qt, QMutex, QDateTime, QDir, QLibraryInfo, QFileInfo |
|
16 ) |
16 from PyQt5.QtHelp import QHelpEngineCore |
17 from PyQt5.QtHelp import QHelpEngineCore |
17 |
18 |
18 from eric6config import getConfig |
19 from eric6config import getConfig |
19 |
20 |
20 from Globals import qVersionTuple |
21 from Globals import qVersionTuple |
130 docsPath = QDir( |
131 docsPath = QDir( |
131 QLibraryInfo.location(QLibraryInfo.DocumentationPath) + |
132 QLibraryInfo.location(QLibraryInfo.DocumentationPath) + |
132 QDir.separator() + "qch") |
133 QDir.separator() + "qch") |
133 elif version == 5: |
134 elif version == 5: |
134 docsPath = QLibraryInfo.location(QLibraryInfo.DocumentationPath) |
135 docsPath = QLibraryInfo.location(QLibraryInfo.DocumentationPath) |
135 if not os.path.isdir(docsPath) or \ |
136 if ( |
136 len(QDir(docsPath).entryList(["*.qch"])) == 0: |
137 not os.path.isdir(docsPath) or |
|
138 len(QDir(docsPath).entryList(["*.qch"])) == 0 |
|
139 ): |
137 # Qt installer is a bit buggy; it's missing a symbolic link |
140 # Qt installer is a bit buggy; it's missing a symbolic link |
138 docsPathList = QDir.fromNativeSeparators(docsPath).split("/") |
141 docsPathList = QDir.fromNativeSeparators(docsPath).split("/") |
139 docsPath = os.sep.join( |
142 docsPath = os.sep.join( |
140 docsPathList[:-3] + |
143 docsPathList[:-3] + |
141 ["Docs", "Qt-{0}.{1}".format(*qVersionTuple())]) |
144 ["Docs", "Qt-{0}.{1}".format(*qVersionTuple())]) |
157 namespace = QHelpEngineCore.namespaceName( |
160 namespace = QHelpEngineCore.namespaceName( |
158 fi.absoluteFilePath()) |
161 fi.absoluteFilePath()) |
159 if not namespace: |
162 if not namespace: |
160 continue |
163 continue |
161 |
164 |
162 if dt.isValid() and \ |
165 if ( |
163 namespace in engine.registeredDocumentations() and \ |
166 dt.isValid() and |
164 fi.lastModified().toString(Qt.ISODate) == \ |
167 namespace in engine.registeredDocumentations() and |
165 dt.toString(Qt.ISODate) and \ |
168 (fi.lastModified().toString(Qt.ISODate) == |
166 qchFile == fi.absoluteFilePath(): |
169 dt.toString(Qt.ISODate)) and |
|
170 qchFile == fi.absoluteFilePath() |
|
171 ): |
167 return False |
172 return False |
168 |
173 |
169 if namespace in engine.registeredDocumentations(): |
174 if namespace in engine.registeredDocumentations(): |
170 engine.unregisterDocumentation(namespace) |
175 engine.unregisterDocumentation(namespace) |
171 |
176 |
219 namespace = QHelpEngineCore.namespaceName( |
224 namespace = QHelpEngineCore.namespaceName( |
220 fi.absoluteFilePath()) |
225 fi.absoluteFilePath()) |
221 if not namespace: |
226 if not namespace: |
222 continue |
227 continue |
223 |
228 |
224 if dt.isValid() and \ |
229 if ( |
225 namespace in engine.registeredDocumentations() and \ |
230 dt.isValid() and |
226 fi.lastModified().toString(Qt.ISODate) == \ |
231 namespace in engine.registeredDocumentations() and |
227 dt.toString(Qt.ISODate) and \ |
232 (fi.lastModified().toString(Qt.ISODate) == |
228 qchFile == fi.absoluteFilePath(): |
233 dt.toString(Qt.ISODate)) and |
|
234 qchFile == fi.absoluteFilePath() |
|
235 ): |
229 return False |
236 return False |
230 |
237 |
231 if namespace in engine.registeredDocumentations(): |
238 if namespace in engine.registeredDocumentations(): |
232 engine.unregisterDocumentation(namespace) |
239 engine.unregisterDocumentation(namespace) |
233 |
240 |