WebBrowser/QtHelp/QtHelpDocumentationDialog.py

changeset 5227
5bffd1a6741f
parent 5224
7454861e4106
child 5389
9b1c800daff3
--- a/WebBrowser/QtHelp/QtHelpDocumentationDialog.py	Tue Oct 11 18:51:15 2016 +0200
+++ b/WebBrowser/QtHelp/QtHelpDocumentationDialog.py	Tue Oct 11 19:04:22 2016 +0200
@@ -65,7 +65,7 @@
     @pyqtSlot()
     def on_addButton_clicked(self):
         """
-        Private slot to add documents to the help database.
+        Private slot to add QtHelp documents to the help database.
         """
         fileNames = E5FileDialog.getOpenFileNames(
             self,
@@ -75,6 +75,32 @@
         if not fileNames:
             return
         
+        self.__registerDocumentations(fileNames)
+    
+    @pyqtSlot()
+    def on_addPluginButton_clicked(self):
+        """
+        Private slot to add QtHelp documents provided by plug-ins to
+        the help database.
+        """
+        from .QtHelpDocumentationSelectionDialog import \
+            QtHelpDocumentationSelectionDialog
+        dlg = QtHelpDocumentationSelectionDialog(self.__pluginHelpDocuments,
+                                                 self)
+        if dlg.exec_() == QDialog.Accepted:
+            documents = dlg.getData()
+            if not documents:
+                return
+            
+            self.__registerDocumentations(documents)
+    
+    def __registerDocumentations(self, fileNames):
+        """
+        Private method to register a given list of documentations.
+        
+        @param fileNames list of documentation files to be registered
+        @type list of str
+        """
         for fileName in fileNames:
             ns = QHelpEngineCore.namespaceName(fileName)
             if not ns:
@@ -147,14 +173,6 @@
             self.documentsList.setCurrentRow(
                 0, QItemSelectionModel.ClearAndSelect)
     
-    @pyqtSlot()
-    def on_addPluginButton_clicked(self):
-        """
-        Private slot to add QtHelp documents provided by plug-ins.
-        """
-        # TODO: not implemented yet
-        raise NotImplementedError
-    
     def hasChanges(self):
         """
         Public slot to test the dialog for changes.

eric ide

mercurial