128 ) |
128 ) |
129 dlg = QtHelpDocumentationSelectionDialog( |
129 dlg = QtHelpDocumentationSelectionDialog( |
130 self.__pluginHelpDocuments, |
130 self.__pluginHelpDocuments, |
131 QtHelpDocumentationSelectionDialog.AddMode, |
131 QtHelpDocumentationSelectionDialog.AddMode, |
132 self) |
132 self) |
133 if dlg.exec() == QDialog.Accepted: |
133 if dlg.exec() == QDialog.DialogCode.Accepted: |
134 documents = dlg.getData() |
134 documents = dlg.getData() |
135 if not documents: |
135 if not documents: |
136 return |
136 return |
137 |
137 |
138 self.__registerDocumentations(documents) |
138 self.__registerDocumentations(documents) |
168 """The file <b>{0}</b> is not a valid""" |
168 """The file <b>{0}</b> is not a valid""" |
169 """ Qt Help File.""").format(fileName) |
169 """ Qt Help File.""").format(fileName) |
170 ) |
170 ) |
171 continue |
171 continue |
172 |
172 |
173 if len(self.documentsList.findItems(ns, Qt.MatchFixedString)): |
173 if len(self.documentsList.findItems( |
|
174 ns, Qt.MatchFlag.MatchFixedString |
|
175 )): |
174 E5MessageBox.warning( |
176 E5MessageBox.warning( |
175 self, |
177 self, |
176 self.tr("Add Documentation"), |
178 self.tr("Add Documentation"), |
177 self.tr( |
179 self.tr( |
178 """The namespace <b>{0}</b> is already registered.""") |
180 """The namespace <b>{0}</b> is already registered.""") |
228 |
230 |
229 self.__engine.unregisterDocumentation(ns) |
231 self.__engine.unregisterDocumentation(ns) |
230 |
232 |
231 if self.documentsList.count(): |
233 if self.documentsList.count(): |
232 self.documentsList.setCurrentRow( |
234 self.documentsList.setCurrentRow( |
233 0, QItemSelectionModel.ClearAndSelect) |
235 0, QItemSelectionModel.SelectionFlag.ClearAndSelect) |
234 |
236 |
235 def hasDocumentationChanges(self): |
237 def hasDocumentationChanges(self): |
236 """ |
238 """ |
237 Public slot to test the dialog for changes of configured QtHelp |
239 Public slot to test the dialog for changes of configured QtHelp |
238 documents. |
240 documents. |
295 self.__filterMap[customFilter] = atts |
297 self.__filterMap[customFilter] = atts |
296 |
298 |
297 self.filtersList.addItems(sorted(self.__filterMap.keys())) |
299 self.filtersList.addItems(sorted(self.__filterMap.keys())) |
298 for attr in helpEngineCore.filterAttributes(): |
300 for attr in helpEngineCore.filterAttributes(): |
299 QTreeWidgetItem(self.attributesList, [attr]) |
301 QTreeWidgetItem(self.attributesList, [attr]) |
300 self.attributesList.sortItems(0, Qt.AscendingOrder) |
302 self.attributesList.sortItems(0, Qt.SortOrder.AscendingOrder) |
301 |
303 |
302 if selectedFiltersText or currentFilterText or selectedAttributesText: |
304 if selectedFiltersText or currentFilterText or selectedAttributesText: |
303 # restore the selected filters |
305 # restore the selected filters |
304 for txt in selectedFiltersText: |
306 for txt in selectedFiltersText: |
305 items = self.filtersList.findItems(txt, Qt.MatchExactly) |
307 items = self.filtersList.findItems( |
|
308 txt, Qt.MatchFlag.MatchExactly) |
306 for itm in items: |
309 for itm in items: |
307 itm.setSelected(True) |
310 itm.setSelected(True) |
308 # restore the current filter |
311 # restore the current filter |
309 if currentFilterText: |
312 if currentFilterText: |
310 items = self.filtersList.findItems(currentFilterText, |
313 items = self.filtersList.findItems(currentFilterText, |
311 Qt.MatchExactly) |
314 Qt.MatchFlag.MatchExactly) |
312 if items: |
315 if items: |
313 self.filtersList.setCurrentItem( |
316 self.filtersList.setCurrentItem( |
314 items[0], QItemSelectionModel.NoUpdate) |
317 items[0], QItemSelectionModel.SelectionFlag.NoUpdate) |
315 # restore the selected attributes |
318 # restore the selected attributes |
316 for txt in selectedAttributesText: |
319 for txt in selectedAttributesText: |
317 items = self.attributesList.findItems(txt, Qt.MatchExactly, 0) |
320 items = self.attributesList.findItems( |
|
321 txt, Qt.MatchFlag.MatchExactly, 0) |
318 for itm in items: |
322 for itm in items: |
319 itm.setSelected(True) |
323 itm.setSelected(True) |
320 elif self.__filterMap: |
324 elif self.__filterMap: |
321 self.filtersList.setCurrentRow(0) |
325 self.filtersList.setCurrentRow(0) |
322 |
326 |
333 if current is not None: |
337 if current is not None: |
334 checkedList = self.__filterMap[current.text()] |
338 checkedList = self.__filterMap[current.text()] |
335 for index in range(0, self.attributesList.topLevelItemCount()): |
339 for index in range(0, self.attributesList.topLevelItemCount()): |
336 itm = self.attributesList.topLevelItem(index) |
340 itm = self.attributesList.topLevelItem(index) |
337 if itm.text(0) in checkedList: |
341 if itm.text(0) in checkedList: |
338 itm.setCheckState(0, Qt.Checked) |
342 itm.setCheckState(0, Qt.CheckState.Checked) |
339 else: |
343 else: |
340 itm.setCheckState(0, Qt.Unchecked) |
344 itm.setCheckState(0, Qt.CheckState.Unchecked) |
341 |
345 |
342 @pyqtSlot() |
346 @pyqtSlot() |
343 def on_filtersList_itemSelectionChanged(self): |
347 def on_filtersList_itemSelectionChanged(self): |
344 """ |
348 """ |
345 Private slot handling a change of selected filters. |
349 Private slot handling a change of selected filters. |
363 return |
367 return |
364 |
368 |
365 newAtts = [] |
369 newAtts = [] |
366 for index in range(0, self.attributesList.topLevelItemCount()): |
370 for index in range(0, self.attributesList.topLevelItemCount()): |
367 itm = self.attributesList.topLevelItem(index) |
371 itm = self.attributesList.topLevelItem(index) |
368 if itm.checkState(0) == Qt.Checked: |
372 if itm.checkState(0) == Qt.CheckState.Checked: |
369 newAtts.append(itm.text(0)) |
373 newAtts.append(itm.text(0)) |
370 self.__filterMap[customFilter] = newAtts |
374 self.__filterMap[customFilter] = newAtts |
371 |
375 |
372 @pyqtSlot() |
376 @pyqtSlot() |
373 def on_attributesList_itemSelectionChanged(self): |
377 def on_attributesList_itemSelectionChanged(self): |
384 """ |
388 """ |
385 customFilter, ok = QInputDialog.getText( |
389 customFilter, ok = QInputDialog.getText( |
386 None, |
390 None, |
387 self.tr("Add Filter"), |
391 self.tr("Add Filter"), |
388 self.tr("Filter name:"), |
392 self.tr("Filter name:"), |
389 QLineEdit.Normal) |
393 QLineEdit.EchoMode.Normal) |
390 if not customFilter: |
394 if not customFilter: |
391 return |
395 return |
392 |
396 |
393 if customFilter not in self.__filterMap: |
397 if customFilter not in self.__filterMap: |
394 self.__filterMap[customFilter] = [] |
398 self.__filterMap[customFilter] = [] |
395 self.filtersList.addItem(customFilter) |
399 self.filtersList.addItem(customFilter) |
396 |
400 |
397 itm = self.filtersList.findItems( |
401 itm = self.filtersList.findItems( |
398 customFilter, Qt.MatchCaseSensitive)[0] |
402 customFilter, Qt.MatchFlag.MatchCaseSensitive)[0] |
399 self.filtersList.setCurrentItem(itm) |
403 self.filtersList.setCurrentItem(itm) |
400 |
404 |
401 @pyqtSlot() |
405 @pyqtSlot() |
402 def on_removeFiltersButton_clicked(self): |
406 def on_removeFiltersButton_clicked(self): |
403 """ |
407 """ |
422 self.__removedFilters.append(itm.text()) |
426 self.__removedFilters.append(itm.text()) |
423 del itm |
427 del itm |
424 |
428 |
425 if self.filtersList.count(): |
429 if self.filtersList.count(): |
426 self.filtersList.setCurrentRow( |
430 self.filtersList.setCurrentRow( |
427 0, QItemSelectionModel.ClearAndSelect) |
431 0, QItemSelectionModel.SelectionFlag.ClearAndSelect) |
428 |
432 |
429 @pyqtSlot() |
433 @pyqtSlot() |
430 def on_removeAttributesButton_clicked(self): |
434 def on_removeAttributesButton_clicked(self): |
431 """ |
435 """ |
432 Private slot to remove the selected filter attributes. |
436 Private slot to remove the selected filter attributes. |