PluginDocumentationSets.py

Wed, 16 Apr 2025 17:42:24 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 16 Apr 2025 17:42:24 +0200
branch
eric7
changeset 102
7186e5d52e7f
parent 98
bab4585d9d63
permissions
-rw-r--r--

Added documentation set for
- MicroPython 1.25

1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1 # -*- coding: utf-8 -*-
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2
98
bab4585d9d63 Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 86
diff changeset
3 # Copyright (c) 2016 - 2025 Detlev Offenbach <detlev@die-offenbachs.de>
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
4 #
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
5
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
6 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
7 Module implementing the QtHelp documentation provider plug-in.
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
8 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
9
86
812d4cf28c23 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 85
diff changeset
10 import glob
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
11 import os
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
12
59
d2b40896293f Fixed a bug.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 57
diff changeset
13 from PyQt6.QtCore import QObject
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
14
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 # Start-Of-Header
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
16 name = "Documentation Sets"
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
17 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
18 autoactivate = True
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
19 deactivateable = True
63
ef499ea8b820 Updated version info to indicate relation to eric7 and removed outdated documentation sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 62
diff changeset
20 version = "10.0.0"
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
21 className = "PluginDocumentationSets"
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
22 packageName = "DocumentationSets"
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
23 shortDescription = "Documentation sets in QtHelp format (*.qch)"
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
24 longDescription = (
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
25 """This plug-in provides an interface to additional documentation sets"""
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
26 """ in QtHelp format (*.qch) for registration with the eric help/web"""
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
27 """ browser or Qt Assistant."""
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
28 )
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
29 needsRestart = False
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
30 pyqtApi = 2
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
31 # End-Of-Header
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
32
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
33 error = ""
41
10870f99f004 Removed QtHelp packages for
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
34
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
35
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
36 def helpFiles():
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
37 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
38 Module function to return the documentation sets provided by this plug-in.
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
39
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
40 @return dictionary with documentation set type as key and list of
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
41 documentation files as values
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
42 @rtype dict (key: str, value: list of str)
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
43 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
44 documentationSets = {}
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
45 documentationSetsDir = os.path.join(os.path.dirname(__file__), "DocumentationSets")
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
46 if os.path.isdir(documentationSetsDir):
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
47 documentationTypes = [
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
48 d
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
49 for d in os.listdir(documentationSetsDir)
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
50 if os.path.isdir(os.path.join(documentationSetsDir, d))
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51 ]
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
52 for documentationType in documentationTypes:
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
53 documentationSets[documentationType] = glob.glob(
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
54 os.path.join(documentationSetsDir, documentationType, "*.qch")
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
55 )
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
56
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
57 return documentationSets
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
58
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
59
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
60 class PluginDocumentationSets(QObject):
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
61 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
62 Class implementing the QtHelp documentation provider plug-in.
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
63 """
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
64
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
65 def __init__(self, ui):
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
66 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
67 Constructor
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
68
86
812d4cf28c23 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 85
diff changeset
69 @param ui reference to the user interface object
812d4cf28c23 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 85
diff changeset
70 @type UserInterface
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
71 """
53
9a762a7d6f42 - implemented some code simplifications
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 51
diff changeset
72 super().__init__(ui)
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
73 self.__ui = ui
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
74
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
75 def activate(self):
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
76 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
77 Public method to activate this plugin.
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
78
86
812d4cf28c23 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 85
diff changeset
79 @return tuple of None and activation status
812d4cf28c23 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 85
diff changeset
80 @rtype bool
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
81 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
82 global error
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
83 error = "" # clear previous error
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
84
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
85 return None, True
67
4f7d5d158bc5 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 63
diff changeset
86
1
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
87 def deactivate(self):
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
88 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
89 Public method to deactivate this plugin.
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
90 """
a1e4eb168c29 Finished the plug-in code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
91 pass
86
812d4cf28c23 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 85
diff changeset
92
812d4cf28c23 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 85
diff changeset
93 #
812d4cf28c23 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 85
diff changeset
94 # eflag: noqa = U200

eric ide

mercurial