Plugins/PluginEricdoc.py

Sun, 10 Feb 2013 19:46:21 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 10 Feb 2013 19:46:21 +0100
changeset 2407
b98cc8ee1142
parent 2302
f29e9405c851
child 2525
8b507a9a2d40
child 2596
32c4afbe0801
permissions
-rw-r--r--

Continued implementing the delayed import.

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
2302
f29e9405c851 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2297
diff changeset
3 # Copyright (c) 2007 - 2013 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
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
12 from PyQt4.QtCore import QObject
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt4.QtGui import QDialog, QApplication
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
15 from E5Gui.E5Application import e5App
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.E5Action import E5Action
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
394
da5696492639 Changed algorithm to detect eric tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 308
diff changeset
21 from eric5config import getConfig
da5696492639 Changed algorithm to detect eric tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 308
diff changeset
22
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 # Start-Of-Header
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 name = "Ericdoc Plugin"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 autoactivate = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 deactivateable = True
398
5b5636320dca Updated the version string of the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 394
diff changeset
28 version = "5.1.0"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 className = "EricdocPlugin"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 packageName = "__core__"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 shortDescription = "Show the Ericdoc dialogs."
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 longDescription = """This plugin implements the Ericdoc dialogs.""" \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """ Ericdoc is used to generate a source code documentation""" \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """ for Python and Ruby projects."""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 pyqtApi = 2
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 # End-Of-Header
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 error = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
40
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
41 def exeDisplayDataList():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 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
44
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 @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
46 the executable
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
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
48 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
49
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
50 # 1. eric5_doc
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
51 exe = 'eric5_doc'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 if Utilities.isWindowsPlatform():
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
53 exe = os.path.join(getConfig("bindir"), exe + '.bat')
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
54 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
55 "programEntry": True,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
56 "header": QApplication.translate("EricdocPlugin",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
57 "Eric5 Documentation Generator"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
58 "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
59 "versionCommand": '--version',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
60 "versionStartsWith": 'eric5_',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
61 "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
62 "version": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
63 "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
64 })
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
65
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
66 # 2. Qt Help Generator
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
67 exe = 'qhelpgenerator'
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
68 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
69 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
70 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
71 "programEntry": True,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
72 "header": QApplication.translate("EricdocPlugin",
2297
e8a46f81517c Adjusted some display strings to be independant of the Qt version (Qt4/Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
73 "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
74 "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
75 "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
76 "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
77 "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
78 "version": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
79 "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
80 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
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
82 # 3. Qt Collection Generator
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
83 exe = 'qcollectiongenerator'
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
84 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
85 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
86 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
87 "programEntry": True,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
88 "header": QApplication.translate("EricdocPlugin",
2297
e8a46f81517c Adjusted some display strings to be independant of the Qt version (Qt4/Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
89 "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
90 "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
91 "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
92 "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
93 "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
94 "version": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
95 "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
96 })
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
97
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
98 return dataList
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
100
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 class EricdocPlugin(QObject):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 Class implementing the Ericdoc plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 def __init__(self, ui):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 @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
110 """
1131
7781e396c903 Changed the code to use super() to access the superclass.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
111 super().__init__(ui)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 self.__ui = ui
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 self.__initialize()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 def __initialize(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 Private slot to (re)initialize the plugin.
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 self.__projectAct = None
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 activate(self):
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 Public method to activate this plugin.
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 @return tuple of None and activation status (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 """
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
127 menu = e5App().getObject("Project").getMenu("Apidoc")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 if menu:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 self.__projectAct = \
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
130 E5Action(self.trUtf8('Generate documentation (eric5_doc)'),
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
131 self.trUtf8('Generate &documentation (eric5_doc)'), 0, 0,
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
132 self, 'doc_eric5_doc')
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 495
diff changeset
133 self.__projectAct.setStatusTip(
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
134 self.trUtf8('Generate API documentation using eric5_doc'))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 self.__projectAct.setWhatsThis(self.trUtf8(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 """<b>Generate documentation</b>"""
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
137 """<p>Generate API documentation using eric5_doc.</p>"""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 ))
454
d28d558f7484 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 453
diff changeset
139 self.__projectAct.triggered[()].connect(self.__doEricdoc)
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
140 e5App().getObject("Project").addE5Actions([self.__projectAct])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 menu.addAction(self.__projectAct)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
143 e5App().getObject("Project").showMenu.connect(self.__projectShowMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 return None, True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 def deactivate(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 Public method to deactivate this plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 """
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
151 e5App().getObject("Project").showMenu.disconnect(self.__projectShowMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
153 menu = e5App().getObject("Project").getMenu("Apidoc")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 if menu:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 menu.removeAction(self.__projectAct)
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
156 e5App().getObject("Project").removeE5Actions([self.__projectAct])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.__initialize()
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 __projectShowMenu(self, menuName, menu):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
161 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
162 about to be shown.
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 @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
165 @param menu reference to the menu (QMenu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 if menuName == "Apidoc":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 if self.__projectAct is not None:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 495
diff changeset
169 self.__projectAct.setEnabled(
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
170 e5App().getObject("Project").getProjectLanguage() in \
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
171 ["Python", "Python2", "Python3", "Ruby"])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 def __doEricdoc(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 """
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
175 Private slot to perform the eric5_doc api documentation generation.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 """
2407
b98cc8ee1142 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
177 from DocumentationPlugins.Ericdoc.EricdocConfigDialog import EricdocConfigDialog
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
178 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
179 '\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
180 '\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
181 '\r\n': 'crlf',
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
182 }
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
183 project = e5App().getObject("Project")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 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
185 dlg = EricdocConfigDialog(project, parms)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 if dlg.exec_() == QDialog.Accepted:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 args, parms = dlg.generateParameters()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 project.setData('DOCUMENTATIONPARMS', "ERIC4DOC", parms)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
190 # 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
191 if not project.useSystemEol():
416
9ca4a5979826 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 398
diff changeset
192 args.append("--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
193
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 # now do the call
2407
b98cc8ee1142 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
195 from DocumentationPlugins.Ericdoc.EricdocExecDialog import EricdocExecDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 dia = EricdocExecDialog("Ericdoc")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 res = dia.start(args, project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 if res:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 dia.exec_()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200
254
422fd16817c0 Fixed an issue introduced by the latest changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
201 outdir = Utilities.toNativeSeparators(parms['outputDirectory'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 if outdir == '':
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
203 outdir = 'doc' # that is eric5_docs default output dir
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 # 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
206 outdir = project.getRelativePath(outdir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 if outdir not in project.pdata['OTHERS']:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 project.pdata['OTHERS'].append(outdir)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 project.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 project.othersAdded(outdir)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 if parms['qtHelpEnabled']:
254
422fd16817c0 Fixed an issue introduced by the latest changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
213 outdir = Utilities.toNativeSeparators(parms['qtHelpOutputDirectory'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 if outdir == '':
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
215 outdir = 'help' # that is eric5_docs default QtHelp output dir
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 # 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
218 outdir = project.getRelativePath(outdir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 if outdir not in project.pdata['OTHERS']:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 project.pdata['OTHERS'].append(outdir)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 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
222 project.othersAdded(outdir)

eric ide

mercurial