src/eric7/Plugins/PluginEricdoc.py

Sat, 26 Apr 2025 12:34:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 26 Apr 2025 12:34:32 +0200
branch
eric7
changeset 11240
c48c615c04a3
parent 11148
15e30f0c76a8
permissions
-rw-r--r--

MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
11090
f5f5f5803935 Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
3 # Copyright (c) 2007 - 2025 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Ericdoc plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
394
da5696492639 Changed algorithm to detect eric tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 308
diff changeset
10 import os
da5696492639 Changed algorithm to detect eric tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 308
diff changeset
11
10315
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
12 from PyQt6.QtCore import QCoreApplication, QObject, pyqtSlot
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8314
diff changeset
13 from PyQt6.QtWidgets import QDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
15 from eric7 import Preferences
10730
454f6ff4e1cd Corrected some imports ordering.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10716
diff changeset
16 from eric7.__version__ import VersionOnly
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
17 from eric7.EricGui.EricAction import EricAction
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9448
diff changeset
18 from eric7.EricWidgets.EricApplication import ericApp
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9448
diff changeset
19 from eric7.Globals import getConfig
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
20 from eric7.SystemUtilities import (
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
21 FileSystemUtilities,
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
22 OSUtilities,
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
23 PythonUtilities,
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
24 QtUtilities,
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
25 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 # Start-Of-Header
10061
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
28 __header__ = {
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
29 "name": "Ericdoc Plugin",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
30 "author": "Detlev Offenbach <detlev@die-offenbachs.de>",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
31 "autoactivate": True,
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
32 "deactivateable": True,
10716
11cdcc824469 Relocated the Version information into a top level '__version__.py' module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10683
diff changeset
33 "version": VersionOnly,
10061
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
34 "className": "EricdocPlugin",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
35 "packageName": "__core__",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
36 "shortDescription": "Show the Ericdoc dialogs.",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
37 "longDescription": (
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
38 """This plugin implements the Ericdoc dialogs."""
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
39 """ Ericdoc is used to generate a source code documentation"""
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
40 """ for Python and Ruby projects."""
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
41 ),
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
42 "pyqtApi": 2,
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
43 }
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 # End-Of-Header
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
11148
15e30f0c76a8 Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11090
diff changeset
46 error = "" # noqa: U-200
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
48
438
f62a3f9d2e28 Changed code to include Qt Help tools in programs detection and introduced the 'exeDisplayDataList' plug-in function to report back a list of tools to check for.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 416
diff changeset
49 def exeDisplayDataList():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 Public method to support the display of some executable info.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
52
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 @return dictionary containing the data to query the presence of
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 the executable
10437
2f70ca07f0af Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10315
diff changeset
55 @rtype dict
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
438
f62a3f9d2e28 Changed code to include Qt Help tools in programs detection and introduced the 'exeDisplayDataList' plug-in function to report back a list of tools to check for.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 416
diff changeset
57 dataList = []
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
58
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
59 # 1. eric7_doc
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
60 exe = "eric7_doc"
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
61 if OSUtilities.isWindowsPlatform():
9138
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
62 for exepath in (
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
63 getConfig("bindir"),
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
64 PythonUtilities.getPythonScriptsDirectory(),
9138
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
65 ):
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
66 found = False
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
67 for ext in (".exe", ".cmd", ".bat"):
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
68 exe_ = os.path.join(exepath, exe + ext)
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
69 if os.path.exists(exe_):
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
70 exe = exe_
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
71 found = True
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
72 break
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
73 if found:
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
74 break
6217
35b9e03ffcd6 eric api, eric doc plug-ins: changed the executable path on non-Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
75 else:
9138
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
76 for exepath in (
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
77 getConfig("bindir"),
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
78 PythonUtilities.getPythonScriptsDirectory(),
9138
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
79 ):
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
80 exe_ = os.path.join(exepath, exe)
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
81 if os.path.exists(exe_):
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
82 exe = exe_
85f68ca14a7a Fixed an issue detecting the eric api and eric documentation tools when installed via the wheel.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
83 break
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
84
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
85 dataList.append(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
86 {
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
87 "programEntry": True,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
88 "header": QCoreApplication.translate(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
89 "EricdocPlugin", "eric Documentation Generator"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
90 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
91 "exe": exe,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
92 "versionCommand": "--version",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
93 "versionStartsWith": "eric7_",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
94 "versionPosition": -3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
95 "version": "",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
96 "versionCleanup": None,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
97 }
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
98 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
99
438
f62a3f9d2e28 Changed code to include Qt Help tools in programs detection and introduced the 'exeDisplayDataList' plug-in function to report back a list of tools to check for.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 416
diff changeset
100 # 2. Qt Help Generator
9154
e8ca7b41a7d8 Changed the path to search for for the "qhelpgenerator" tool because that was moved to the 'libexec' directory on Linux and maxOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9138
diff changeset
101 # 2.1 location before 6.3 (Linux and macOS) and Windows
9536
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
102 exe = Preferences.getQt("QHelpGenerator")
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
103
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
104 if not exe:
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
105 # 2.2 location before 6.3 (Linux and macOS) and Windows
9155
2efa8d1312cd Corrected the documentation plugin tool detection logic.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9154
diff changeset
106 exe = os.path.join(
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
107 QtUtilities.getQtBinariesPath(),
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
108 QtUtilities.generateQtToolName("qhelpgenerator"),
9155
2efa8d1312cd Corrected the documentation plugin tool detection logic.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9154
diff changeset
109 )
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
110 if OSUtilities.isWindowsPlatform():
9536
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
111 exe += ".exe"
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
112 if not os.path.exists(exe):
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
113 # 2.3 location starting with 6.3.0 (Linux and macOS)
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
114 exe = os.path.join(
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
115 QtUtilities.getQtBinariesPath(libexec=True),
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9536
diff changeset
116 QtUtilities.generateQtToolName("qhelpgenerator"),
9536
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
117 )
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
118
c1c84299bef3 Qt Tools
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9514
diff changeset
119 if exe:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
120 dataList.append(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
121 {
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
122 "programEntry": True,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
123 "header": QCoreApplication.translate("EricdocPlugin", "Qt Help Tools"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
124 "exe": exe,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
125 "versionCommand": "-v",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
126 "versionStartsWith": "Qt",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
127 "versionPosition": -1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
128 "version": "",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
129 "versionCleanup": (0, -1),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
130 }
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
131 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
132
438
f62a3f9d2e28 Changed code to include Qt Help tools in programs detection and introduced the 'exeDisplayDataList' plug-in function to report back a list of tools to check for.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 416
diff changeset
133 return dataList
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
135
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 class EricdocPlugin(QObject):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 Class implementing the Ericdoc plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
140
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 def __init__(self, ui):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
144
10437
2f70ca07f0af Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10315
diff changeset
145 @param ui reference to the user interface object
2f70ca07f0af Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10315
diff changeset
146 @type UserInterface
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
148 super().__init__(ui)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 self.__ui = ui
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 self.__initialize()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
151
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 def __initialize(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 Private slot to (re)initialize the plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 self.__projectAct = None
10315
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
157 self.__execDialog = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 def activate(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 Public method to activate this plugin.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
162
10437
2f70ca07f0af Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10315
diff changeset
163 @return tuple of None and activation status
2f70ca07f0af Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10315
diff changeset
164 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 """
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
166 menu = ericApp().getObject("Project").getMenu("Apidoc")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 if menu:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
168 self.__projectAct = EricAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
169 self.tr("Generate documentation (eric7_doc)"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
170 self.tr("Generate &documentation (eric7_doc)"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
171 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
172 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
173 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
174 "doc_eric7_doc",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
175 )
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 495
diff changeset
176 self.__projectAct.setStatusTip(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
177 self.tr("Generate API documentation using eric7_doc")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
178 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
179 self.__projectAct.setWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
180 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
181 """<b>Generate documentation</b>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
182 """<p>Generate API documentation using eric7_doc.</p>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
183 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
184 )
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
185 self.__projectAct.triggered.connect(self.__doEricdoc)
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
186 ericApp().getObject("Project").addEricActions([self.__projectAct])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 menu.addAction(self.__projectAct)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
188
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
189 ericApp().getObject("Project").showMenu.connect(self.__projectShowMenu)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
190
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 return None, True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 def deactivate(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 Public method to deactivate this plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
197 ericApp().getObject("Project").showMenu.disconnect(self.__projectShowMenu)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
198
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
199 menu = ericApp().getObject("Project").getMenu("Apidoc")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 if menu:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 menu.removeAction(self.__projectAct)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
202 ericApp().getObject("Project").removeEricActions([self.__projectAct])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 self.__initialize()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
204
10683
779cda568acb Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
205 def __projectShowMenu(self, menuName, _menu):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
207 Private slot called, when the the project menu or a submenu is
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 about to be shown.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
209
10437
2f70ca07f0af Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10315
diff changeset
210 @param menuName name of the menu to be shown
2f70ca07f0af Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10315
diff changeset
211 @type str
10683
779cda568acb Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
212 @param _menu reference to the menu (unused)
10437
2f70ca07f0af Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10315
diff changeset
213 @type QMenu
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 """
8222
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
215 if menuName == "Apidoc" and self.__projectAct is not None:
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
216 self.__projectAct.setEnabled(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
217 ericApp().getObject("Project").getProjectLanguage()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
218 in ["Python", "Python3", "Ruby", "MicroPython"]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
219 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
220
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 def __doEricdoc(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 """
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
223 Private slot to perform the eric7_doc api documentation generation.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 """
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
225 from eric7.Plugins.DocumentationPlugins.Ericdoc.EricdocConfigDialog import (
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
226 EricdocConfigDialog,
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
227 )
9482
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
228 from eric7.Plugins.DocumentationPlugins.Ericdoc.EricdocExecDialog import (
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
229 EricdocExecDialog,
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
230 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
231
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
232 eolTranslation = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
233 "\r": "cr",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
234 "\n": "lf",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
235 "\r\n": "crlf",
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
236 }
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
237 project = ericApp().getObject("Project")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
238 parms = project.getData("DOCUMENTATIONPARMS", "ERIC4DOC")
11006
a671918232f3 Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10730
diff changeset
239 dlg = EricdocConfigDialog(project, parms=parms, parent=self.__ui)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
240 if dlg.exec() == QDialog.DialogCode.Accepted:
9211
99eb1cb030a5 Code Documentation Generator
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
241 args, parms, startDir = dlg.generateParameters()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
242 project.setData("DOCUMENTATIONPARMS", "ERIC4DOC", parms)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
243
9211
99eb1cb030a5 Code Documentation Generator
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
244 if not startDir:
99eb1cb030a5 Code Documentation Generator
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
245 startDir = project.ppath
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
246
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
247 # add parameter for the eol setting
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
248 if not project.useSystemEol():
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
249 args.append("--eol={0}".format(eolTranslation[project.getEolString()]))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
250
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 # now do the call
10315
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
252 self.__execDialog = EricdocExecDialog("Ericdoc")
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
253 self.__execDialog.finished.connect(self.__execDialogFinished)
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
254 self.__execDialog.processFinished.connect(self.__ericdocProcessFinished)
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
255 self.__execDialog.show()
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
256 self.__execDialog.start(args, startDir)
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
257
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
258 @pyqtSlot()
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
259 def __ericdocProcessFinished(self):
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
260 """
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
261 Private slot to perform actions after the documentation was generated.
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
262 """
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
263 project = ericApp().getObject("Project")
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
264 parms = project.getData("DOCUMENTATIONPARMS", "ERIC4DOC")
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
265
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
266 outdir = FileSystemUtilities.toNativeSeparators(parms["outputDirectory"])
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
267 if outdir == "":
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
268 outdir = "doc" # that is eric7_docs default output dir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
269
10315
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
270 # add it to the project data, if it isn't in already
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
271 outdir = project.getRelativePath(outdir)
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
272 if outdir not in project.getProjectData(dataKey="OTHERS"):
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
273 project.setProjectData(
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
274 project.getProjectData(dataKey="OTHERS") + [outdir],
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
275 dataKey="OTHERS",
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
276 )
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
277 project.setDirty(True)
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
278 project.othersAdded(outdir)
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
279
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
280 if parms["qtHelpEnabled"]:
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
281 outdir = FileSystemUtilities.toNativeSeparators(
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
282 parms["qtHelpOutputDirectory"]
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
283 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
284 if outdir == "":
10315
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
285 outdir = "help"
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
286 # that is eric7_docs default QtHelp output dir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
287
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 # add it to the project data, if it isn't in already
248
f4561c24989a Changed code to better deal with project relative paths on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
289 outdir = project.getRelativePath(outdir)
9514
2b104ad132a4 Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
290 if outdir not in project.getProjectData(dataKey="OTHERS"):
2b104ad132a4 Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
291 project.setProjectData(
2b104ad132a4 Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
292 project.getProjectData(dataKey="OTHERS") + [outdir],
2b104ad132a4 Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
293 dataKey="OTHERS",
2b104ad132a4 Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
294 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 project.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 project.othersAdded(outdir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9211
diff changeset
297
10315
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
298 @pyqtSlot()
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
299 def __execDialogFinished(self):
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
300 """
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
301 Private slot to handle the execution dialog being closed.
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
302 """
4102a69604eb Modified the API and code documentation generator dialogs to allow better error handling (i.e. the dialogs are not modal anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
303 self.__execDialog = None

eric ide

mercurial