--- a/PluginDocumentationSets.py Fri Oct 14 18:51:35 2016 +0200 +++ b/PluginDocumentationSets.py Sat Oct 15 15:23:08 2016 +0200 @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2016 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing the QtHelp documentation provider plug-in. +""" + +from __future__ import unicode_literals + +import os +import glob + +from PyQt5.QtCore import QObject + +# Start-Of-Header +name = "Documentation Sets" +author = "Detlev Offenbach <detlev@die-offenbachs.de>" +autoactivate = True +deactivateable = True +version = "1.0.0" +className = "PluginDocumentationSets" +packageName = "DocumentationSets" +shortDescription = "Documentation sets in QtHelp format (*.qch)" +longDescription = ( + """This plug-in provides an interface to additional documentation sets""" + """ in QtHelp format (*.qch) for registration with the eric help/web""" + """ browser or Qt Assistant.""" +) +needsRestart = False +pyqtApi = 2 +python2Compatible = True +# End-Of-Header + +error = "" + + +def helpFiles(): + """ + Module function to return the documentation sets provided by this plug-in. + + @return dictionary with documentation set type as key and list of + documentation files as values + @rtype dict (key: str, value: list of str) + """ + documentationSets = {} + documentationSetsDir = os.path.join(os.path.dirname(__file__), + "DocumentationSets") + if os.path.isdir(documentationSetsDir): + documentationTypes = [ + d for d in os.listdir(documentationSetsDir) + if os.path.isdir(os.path.join(documentationSetsDir, d)) + ] + for documentationType in documentationTypes: + documentationSets[documentationType] = glob.glob( + os.path.join(documentationSetsDir, documentationType, "*.qch")) + + return documentationSets + + +class PluginDocumentationSets(QObject): + """ + Class implementing the QtHelp documentation provider plug-in. + """ + def __init__(self, ui): + """ + Constructor + + @param ui reference to the user interface object (UI.UserInterface) + """ + super(PluginDocumentationSets, self).__init__(ui) + self.__ui = ui + + def activate(self): + """ + Public method to activate this plugin. + + @return tuple of None and activation status (boolean) + """ + global error + error = "" # clear previous error + + return None, True + + def deactivate(self): + """ + Public method to deactivate this plugin. + """ + pass