eric6/WebBrowser/QtHelp/HelpDocsInstaller.py

changeset 8143
2c730d5fd177
parent 7960
e8fc383322f7
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
58 58
59 def installDocs(self): 59 def installDocs(self):
60 """ 60 """
61 Public method to start the installation procedure. 61 Public method to start the installation procedure.
62 """ 62 """
63 self.start(QThread.LowPriority) 63 self.start(QThread.Priority.LowPriority)
64 64
65 def run(self): 65 def run(self):
66 """ 66 """
67 Public method executed by the thread. 67 Public method executed by the thread.
68 """ 68 """
117 info = engine.customValue(versionKey, "") 117 info = engine.customValue(versionKey, "")
118 lst = info.split('|') 118 lst = info.split('|')
119 119
120 dt = QDateTime() 120 dt = QDateTime()
121 if len(lst) and lst[0]: 121 if len(lst) and lst[0]:
122 dt = QDateTime.fromString(lst[0], Qt.ISODate) 122 dt = QDateTime.fromString(lst[0], Qt.DateFormat.ISODate)
123 123
124 qchFile = "" 124 qchFile = ""
125 if len(lst) == 2: 125 if len(lst) == 2:
126 qchFile = lst[1] 126 qchFile = lst[1]
127 127
128 if version == 4: 128 if version == 4:
129 docsPath = QDir( 129 docsPath = QDir(
130 QLibraryInfo.location(QLibraryInfo.DocumentationPath) + 130 QLibraryInfo.location(
131 QLibraryInfo.LibraryLocation.DocumentationPath) +
131 QDir.separator() + "qch") 132 QDir.separator() + "qch")
132 elif version == 5: 133 elif version == 5:
133 docsPath = QLibraryInfo.location(QLibraryInfo.DocumentationPath) 134 docsPath = QLibraryInfo.location(
135 QLibraryInfo.LibraryLocation.DocumentationPath)
134 if ( 136 if (
135 not os.path.isdir(docsPath) or 137 not os.path.isdir(docsPath) or
136 len(QDir(docsPath).entryList(["*.qch"])) == 0 138 len(QDir(docsPath).entryList(["*.qch"])) == 0
137 ): 139 ):
138 docsPathList = QDir.fromNativeSeparators(docsPath).split("/") 140 docsPathList = QDir.fromNativeSeparators(docsPath).split("/")
146 148
147 files = docsPath.entryList(["*.qch"]) 149 files = docsPath.entryList(["*.qch"])
148 if not files: 150 if not files:
149 engine.setCustomValue( 151 engine.setCustomValue(
150 versionKey, 152 versionKey,
151 QDateTime().toString(Qt.ISODate) + '|') 153 QDateTime().toString(Qt.DateFormat.ISODate) + '|')
152 return False 154 return False
153 155
154 for f in files: 156 for f in files:
155 if f.startswith(name + "."): 157 if f.startswith(name + "."):
156 fi = QFileInfo(docsPath.absolutePath() + QDir.separator() + f) 158 fi = QFileInfo(docsPath.absolutePath() + QDir.separator() + f)
160 continue 162 continue
161 163
162 if ( 164 if (
163 dt.isValid() and 165 dt.isValid() and
164 namespace in engine.registeredDocumentations() and 166 namespace in engine.registeredDocumentations() and
165 (fi.lastModified().toString(Qt.ISODate) == 167 (fi.lastModified().toString(Qt.DateFormat.ISODate) ==
166 dt.toString(Qt.ISODate)) and 168 dt.toString(Qt.DateFormat.ISODate)) and
167 qchFile == fi.absoluteFilePath() 169 qchFile == fi.absoluteFilePath()
168 ): 170 ):
169 return False 171 return False
170 172
171 if namespace in engine.registeredDocumentations(): 173 if namespace in engine.registeredDocumentations():
180 ) 182 )
181 return False 183 return False
182 184
183 engine.setCustomValue( 185 engine.setCustomValue(
184 versionKey, 186 versionKey,
185 fi.lastModified().toString(Qt.ISODate) + '|' + 187 fi.lastModified().toString(Qt.DateFormat.ISODate) + '|' +
186 fi.absoluteFilePath()) 188 fi.absoluteFilePath())
187 return True 189 return True
188 190
189 return False 191 return False
190 192
199 info = engine.customValue(versionKey, "") 201 info = engine.customValue(versionKey, "")
200 lst = info.split('|') 202 lst = info.split('|')
201 203
202 dt = QDateTime() 204 dt = QDateTime()
203 if len(lst) and lst[0]: 205 if len(lst) and lst[0]:
204 dt = QDateTime.fromString(lst[0], Qt.ISODate) 206 dt = QDateTime.fromString(lst[0], Qt.DateFormat.ISODate)
205 207
206 qchFile = "" 208 qchFile = ""
207 if len(lst) == 2: 209 if len(lst) == 2:
208 qchFile = lst[1] 210 qchFile = lst[1]
209 211
210 docsPath = QDir(getConfig("ericDocDir") + QDir.separator() + "Help") 212 docsPath = QDir(getConfig("ericDocDir") + QDir.separator() + "Help")
211 213
212 files = docsPath.entryList(["*.qch"]) 214 files = docsPath.entryList(["*.qch"])
213 if not files: 215 if not files:
214 engine.setCustomValue( 216 engine.setCustomValue(
215 versionKey, QDateTime().toString(Qt.ISODate) + '|') 217 versionKey, QDateTime().toString(Qt.DateFormat.ISODate) + '|')
216 return False 218 return False
217 219
218 for f in files: 220 for f in files:
219 if f == "source.qch": 221 if f == "source.qch":
220 fi = QFileInfo(docsPath.absolutePath() + QDir.separator() + f) 222 fi = QFileInfo(docsPath.absolutePath() + QDir.separator() + f)
224 continue 226 continue
225 227
226 if ( 228 if (
227 dt.isValid() and 229 dt.isValid() and
228 namespace in engine.registeredDocumentations() and 230 namespace in engine.registeredDocumentations() and
229 (fi.lastModified().toString(Qt.ISODate) == 231 (fi.lastModified().toString(Qt.DateFormat.ISODate) ==
230 dt.toString(Qt.ISODate)) and 232 dt.toString(Qt.DateFormat.ISODate)) and
231 qchFile == fi.absoluteFilePath() 233 qchFile == fi.absoluteFilePath()
232 ): 234 ):
233 return False 235 return False
234 236
235 if namespace in engine.registeredDocumentations(): 237 if namespace in engine.registeredDocumentations():
244 ) 246 )
245 return False 247 return False
246 248
247 engine.setCustomValue( 249 engine.setCustomValue(
248 versionKey, 250 versionKey,
249 fi.lastModified().toString(Qt.ISODate) + '|' + 251 fi.lastModified().toString(Qt.DateFormat.ISODate) + '|' +
250 fi.absoluteFilePath()) 252 fi.absoluteFilePath())
251 return True 253 return True
252 254
253 return False 255 return False

eric ide

mercurial