eric6/Plugins/PluginEricdoc.py

Mon, 15 Apr 2019 19:53:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 15 Apr 2019 19:53:29 +0200
branch
setup.py
changeset 6949
a5255f1ba3f0
parent 6942
2602857055c5
child 7178
43e994af5ee0
permissions
-rw-r--r--

setup.py: continued implementing support for setup.py.

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
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
3 # Copyright (c) 2007 - 2019 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
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2407
diff changeset
11
394
da5696492639 Changed algorithm to detect eric tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 308
diff changeset
12 import os
da5696492639 Changed algorithm to detect eric tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 308
diff changeset
13
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
14 from PyQt5.QtCore import QObject, QCoreApplication
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
15 from PyQt5.QtWidgets import QDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
17 from E5Gui.E5Application import e5App
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
19 from E5Gui.E5Action import E5Action
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 import Utilities
5316
31cbc97d4974 Got rid of the manually set version numbers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
22 import UI.Info
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
24 from eric6config import getConfig
394
da5696492639 Changed algorithm to detect eric tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 308
diff changeset
25
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 # Start-Of-Header
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 name = "Ericdoc Plugin"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 autoactivate = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 deactivateable = True
5316
31cbc97d4974 Got rid of the manually set version numbers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
31 version = UI.Info.VersionOnly
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 className = "EricdocPlugin"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 packageName = "__core__"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 shortDescription = "Show the Ericdoc dialogs."
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 longDescription = """This plugin implements the Ericdoc dialogs.""" \
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
36 """ Ericdoc is used to generate a source code documentation""" \
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
37 """ for Python and Ruby projects."""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 pyqtApi = 2
3523
8df1ab89e261 python2Compatible flags for base plug-ins added.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3484
diff changeset
39 python2Compatible = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 # End-Of-Header
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 error = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
44
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
45 def exeDisplayDataList():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Public method to support the display of some executable info.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @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
50 the executable
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
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
52 dataList = []
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
53
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
54 # 1. eric6_doc
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
55 exe = 'eric6_doc'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 if Utilities.isWindowsPlatform():
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6217
diff changeset
57 exe = os.path.join(getConfig("bindir"), exe + '.cmd')
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6217
diff changeset
58 if not os.path.exists(exe):
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6217
diff changeset
59 exe = os.path.join(getConfig("bindir"), exe + '.bat')
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
60 else:
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
61 exe = os.path.join(getConfig("bindir"), exe)
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
62 dataList.append({
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
63 "programEntry": True,
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
64 "header": QCoreApplication.translate(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
65 "EricdocPlugin", "Eric6 Documentation Generator"),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
66 "exe": exe,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
67 "versionCommand": '--version',
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
68 "versionStartsWith": 'eric6_',
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
69 "versionPosition": -3,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
70 "version": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
71 "versionCleanup": None,
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
72 })
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
73
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
74 # 2. Qt Help Generator
6666
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
75 exe = os.path.join(
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
76 Utilities.getQtBinariesPath(),
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
77 Utilities.generateQtToolName('qhelpgenerator')
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
78 )
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
79 if Utilities.isWindowsPlatform():
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
80 exe += '.exe'
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
81 dataList.append({
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
82 "programEntry": True,
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
83 "header": QCoreApplication.translate(
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3004
diff changeset
84 "EricdocPlugin", "Qt Help Tools"),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
85 "exe": exe,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
86 "versionCommand": '-v',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
87 "versionStartsWith": 'Qt',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
88 "versionPosition": -1,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
89 "version": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
90 "versionCleanup": (0, -1),
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
91 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
6666
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
93 # 3. Qt Collection Generator
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
94 exe = os.path.join(
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
95 Utilities.getQtBinariesPath(),
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
96 Utilities.generateQtToolName('qcollectiongenerator')
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
97 )
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
98 if Utilities.isWindowsPlatform():
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
99 exe += '.exe'
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
100 if Utilities.isExecutable(exe):
06f6e0f24e89 Documentation Tools: changed logic such, that a missing 'qcollectiongenerator' executable is ignored an Qt 5.12 is assumed (it has the function integrated in 'qhelpgenerator').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
101 # assume Qt 5.,12 if it is missing
6665
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
102 dataList.append({
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
103 "programEntry": True,
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
104 "header": QCoreApplication.translate(
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
105 "EricdocPlugin", "Qt Help Tools"),
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
106 "exe": exe,
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
107 "versionCommand": '-v',
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
108 "versionStartsWith": 'Qt',
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
109 "versionPosition": -1,
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
110 "version": "",
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
111 "versionCleanup": (0, -1),
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
112 })
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
113
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
114 return dataList
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
116
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 class EricdocPlugin(QObject):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 Class implementing the Ericdoc plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 def __init__(self, ui):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 @param ui reference to the user interface object (UI.UserInterface)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2407
diff changeset
127 super(EricdocPlugin, self).__init__(ui)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 self.__ui = ui
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 self.__initialize()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 def __initialize(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 Private slot to (re)initialize the plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 self.__projectAct = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 def activate(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 Public method to activate this plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 @return tuple of None and activation status (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 """
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
143 menu = e5App().getObject("Project").getMenu("Apidoc")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 if menu:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 self.__projectAct = \
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3004
diff changeset
146 E5Action(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
147 self.tr('Generate documentation (eric6_doc)'),
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
148 self.tr('Generate &documentation (eric6_doc)'), 0, 0,
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
149 self, 'doc_eric6_doc')
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 495
diff changeset
150 self.__projectAct.setStatusTip(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
151 self.tr('Generate API documentation using eric6_doc'))
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3180
diff changeset
152 self.__projectAct.setWhatsThis(self.tr(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 """<b>Generate documentation</b>"""
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
154 """<p>Generate API documentation using eric6_doc.</p>"""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
156 self.__projectAct.triggered.connect(self.__doEricdoc)
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
157 e5App().getObject("Project").addE5Actions([self.__projectAct])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 menu.addAction(self.__projectAct)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
160 e5App().getObject("Project").showMenu.connect(self.__projectShowMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 return None, True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 def deactivate(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 Public method to deactivate this plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 """
3004
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
168 e5App().getObject("Project").showMenu.disconnect(
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
169 self.__projectShowMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
171 menu = e5App().getObject("Project").getMenu("Apidoc")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 if menu:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 menu.removeAction(self.__projectAct)
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
174 e5App().getObject("Project").removeE5Actions([self.__projectAct])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 self.__initialize()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 def __projectShowMenu(self, menuName, menu):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
179 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
180 about to be shown.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 @param menuName name of the menu to be shown (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 @param menu reference to the menu (QMenu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 if menuName == "Apidoc":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 if self.__projectAct is not None:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 495
diff changeset
187 self.__projectAct.setEnabled(
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
188 e5App().getObject("Project").getProjectLanguage() in
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
189 ["Python", "Python2", "Python3", "Ruby"])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 def __doEricdoc(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 """
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
193 Private slot to perform the eric6_doc api documentation generation.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 """
3004
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
195 from DocumentationPlugins.Ericdoc.EricdocConfigDialog import \
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
196 EricdocConfigDialog
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
197 eolTranslation = {
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
198 '\r': 'cr',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
199 '\n': 'lf',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
200 '\r\n': 'crlf',
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
201 }
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
202 project = e5App().getObject("Project")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 parms = project.getData('DOCUMENTATIONPARMS', "ERIC4DOC")
248
f4561c24989a Changed code to better deal with project relative paths on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
204 dlg = EricdocConfigDialog(project, parms)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 if dlg.exec_() == QDialog.Accepted:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 args, parms = dlg.generateParameters()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 project.setData('DOCUMENTATIONPARMS', "ERIC4DOC", parms)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
209 # 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
210 if not project.useSystemEol():
3004
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
211 args.append(
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
212 "--eol={0}".format(eolTranslation[project.getEolString()]))
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
213
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 # now do the call
3004
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
215 from DocumentationPlugins.Ericdoc.EricdocExecDialog import \
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
216 EricdocExecDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 dia = EricdocExecDialog("Ericdoc")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 res = dia.start(args, project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 if res:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 dia.exec_()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
254
422fd16817c0 Fixed an issue introduced by the latest changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
222 outdir = Utilities.toNativeSeparators(parms['outputDirectory'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 if outdir == '':
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
224 outdir = 'doc' # that is eric6_docs default output dir
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 # 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
227 outdir = project.getRelativePath(outdir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 if outdir not in project.pdata['OTHERS']:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 project.pdata['OTHERS'].append(outdir)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 project.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 project.othersAdded(outdir)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 if parms['qtHelpEnabled']:
3004
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
234 outdir = Utilities.toNativeSeparators(
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
235 parms['qtHelpOutputDirectory'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 if outdir == '':
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3523
diff changeset
237 outdir = 'help'
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
238 # that is eric6_docs default QtHelp output dir
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 # 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
241 outdir = project.getRelativePath(outdir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 if outdir not in project.pdata['OTHERS']:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 project.pdata['OTHERS'].append(outdir)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 project.setDirty(True)
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
245 project.othersAdded(outdir)

eric ide

mercurial