PluginDocumentationSets.py

branch
eric7
changeset 67
4f7d5d158bc5
parent 63
ef499ea8b820
child 76
119228f1ac21
equal deleted inserted replaced
66:765f08369eea 67:4f7d5d158bc5
34 34
35 35
36 def helpFiles(): 36 def helpFiles():
37 """ 37 """
38 Module function to return the documentation sets provided by this plug-in. 38 Module function to return the documentation sets provided by this plug-in.
39 39
40 @return dictionary with documentation set type as key and list of 40 @return dictionary with documentation set type as key and list of
41 documentation files as values 41 documentation files as values
42 @rtype dict (key: str, value: list of str) 42 @rtype dict (key: str, value: list of str)
43 """ 43 """
44 documentationSets = {} 44 documentationSets = {}
45 documentationSetsDir = os.path.join(os.path.dirname(__file__), 45 documentationSetsDir = os.path.join(os.path.dirname(__file__), "DocumentationSets")
46 "DocumentationSets")
47 if os.path.isdir(documentationSetsDir): 46 if os.path.isdir(documentationSetsDir):
48 documentationTypes = [ 47 documentationTypes = [
49 d for d in os.listdir(documentationSetsDir) 48 d
49 for d in os.listdir(documentationSetsDir)
50 if os.path.isdir(os.path.join(documentationSetsDir, d)) 50 if os.path.isdir(os.path.join(documentationSetsDir, d))
51 ] 51 ]
52 for documentationType in documentationTypes: 52 for documentationType in documentationTypes:
53 documentationSets[documentationType] = glob.glob( 53 documentationSets[documentationType] = glob.glob(
54 os.path.join(documentationSetsDir, documentationType, "*.qch")) 54 os.path.join(documentationSetsDir, documentationType, "*.qch")
55 55 )
56
56 return documentationSets 57 return documentationSets
57 58
58 59
59 class PluginDocumentationSets(QObject): 60 class PluginDocumentationSets(QObject):
60 """ 61 """
61 Class implementing the QtHelp documentation provider plug-in. 62 Class implementing the QtHelp documentation provider plug-in.
62 """ 63 """
64
63 def __init__(self, ui): 65 def __init__(self, ui):
64 """ 66 """
65 Constructor 67 Constructor
66 68
67 @param ui reference to the user interface object (UI.UserInterface) 69 @param ui reference to the user interface object (UI.UserInterface)
68 """ 70 """
69 super().__init__(ui) 71 super().__init__(ui)
70 self.__ui = ui 72 self.__ui = ui
71 73
72 def activate(self): 74 def activate(self):
73 """ 75 """
74 Public method to activate this plugin. 76 Public method to activate this plugin.
75 77
76 @return tuple of None and activation status (boolean) 78 @return tuple of None and activation status (boolean)
77 """ 79 """
78 global error 80 global error
79 error = "" # clear previous error 81 error = "" # clear previous error
80 82
81 return None, True 83 return None, True
82 84
83 def deactivate(self): 85 def deactivate(self):
84 """ 86 """
85 Public method to deactivate this plugin. 87 Public method to deactivate this plugin.
86 """ 88 """
87 pass 89 pass

eric ide

mercurial