src/eric7/Plugins/PluginEricdoc.py

branch
eric7
changeset 9624
b47dfa7a137d
parent 9536
c1c84299bef3
child 9653
e67609152c5e
equal deleted inserted replaced
9623:9c1f429cb56b 9624:b47dfa7a137d
10 import os 10 import os
11 11
12 from PyQt6.QtCore import QCoreApplication, QObject 12 from PyQt6.QtCore import QCoreApplication, QObject
13 from PyQt6.QtWidgets import QDialog 13 from PyQt6.QtWidgets import QDialog
14 14
15 from eric7 import Preferences, Utilities 15 from eric7 import Preferences
16 from eric7.EricGui.EricAction import EricAction 16 from eric7.EricGui.EricAction import EricAction
17 from eric7.EricWidgets.EricApplication import ericApp 17 from eric7.EricWidgets.EricApplication import ericApp
18 from eric7.Globals import getConfig 18 from eric7.Globals import getConfig
19 from eric7.SystemUtilities import (
20 FileSystemUtilities,
21 OSUtilities,
22 PythonUtilities,
23 QtUtilities,
24 )
19 from eric7.UI import Info 25 from eric7.UI import Info
20 26
21 # Start-Of-Header 27 # Start-Of-Header
22 name = "Ericdoc Plugin" 28 name = "Ericdoc Plugin"
23 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 29 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
47 """ 53 """
48 dataList = [] 54 dataList = []
49 55
50 # 1. eric7_doc 56 # 1. eric7_doc
51 exe = "eric7_doc" 57 exe = "eric7_doc"
52 if Utilities.isWindowsPlatform(): 58 if OSUtilities.isWindowsPlatform():
53 for exepath in ( 59 for exepath in (
54 getConfig("bindir"), 60 getConfig("bindir"),
55 Utilities.getPythonScriptsDirectory(), 61 PythonUtilities.getPythonScriptsDirectory(),
56 ): 62 ):
57 found = False 63 found = False
58 for ext in (".exe", ".cmd", ".bat"): 64 for ext in (".exe", ".cmd", ".bat"):
59 exe_ = os.path.join(exepath, exe + ext) 65 exe_ = os.path.join(exepath, exe + ext)
60 if os.path.exists(exe_): 66 if os.path.exists(exe_):
64 if found: 70 if found:
65 break 71 break
66 else: 72 else:
67 for exepath in ( 73 for exepath in (
68 getConfig("bindir"), 74 getConfig("bindir"),
69 Utilities.getPythonScriptsDirectory(), 75 PythonUtilities.getPythonScriptsDirectory(),
70 ): 76 ):
71 exe_ = os.path.join(exepath, exe) 77 exe_ = os.path.join(exepath, exe)
72 if os.path.exists(exe_): 78 if os.path.exists(exe_):
73 exe = exe_ 79 exe = exe_
74 break 80 break
93 exe = Preferences.getQt("QHelpGenerator") 99 exe = Preferences.getQt("QHelpGenerator")
94 100
95 if not exe: 101 if not exe:
96 # 2.2 location before 6.3 (Linux and macOS) and Windows 102 # 2.2 location before 6.3 (Linux and macOS) and Windows
97 exe = os.path.join( 103 exe = os.path.join(
98 Utilities.getQtBinariesPath(), 104 QtUtilities.getQtBinariesPath(),
99 Utilities.generateQtToolName("qhelpgenerator"), 105 QtUtilities.generateQtToolName("qhelpgenerator"),
100 ) 106 )
101 if Utilities.isWindowsPlatform(): 107 if OSUtilities.isWindowsPlatform():
102 exe += ".exe" 108 exe += ".exe"
103 if not os.path.exists(exe): 109 if not os.path.exists(exe):
104 # 2.3 location starting with 6.3.0 (Linux and macOS) 110 # 2.3 location starting with 6.3.0 (Linux and macOS)
105 exe = os.path.join( 111 exe = os.path.join(
106 Utilities.getQtBinariesPath(libexec=True), 112 QtUtilities.getQtBinariesPath(libexec=True),
107 Utilities.generateQtToolName("qhelpgenerator"), 113 QtUtilities.generateQtToolName("qhelpgenerator"),
108 ) 114 )
109 115
110 if exe: 116 if exe:
111 dataList.append( 117 dataList.append(
112 { 118 {
238 dia = EricdocExecDialog("Ericdoc") 244 dia = EricdocExecDialog("Ericdoc")
239 res = dia.start(args, startDir) 245 res = dia.start(args, startDir)
240 if res: 246 if res:
241 dia.exec() 247 dia.exec()
242 248
243 outdir = Utilities.toNativeSeparators(parms["outputDirectory"]) 249 outdir = FileSystemUtilities.toNativeSeparators(parms["outputDirectory"])
244 if outdir == "": 250 if outdir == "":
245 outdir = "doc" # that is eric7_docs default output dir 251 outdir = "doc" # that is eric7_docs default output dir
246 252
247 # add it to the project data, if it isn't in already 253 # add it to the project data, if it isn't in already
248 outdir = project.getRelativePath(outdir) 254 outdir = project.getRelativePath(outdir)
253 ) 259 )
254 project.setDirty(True) 260 project.setDirty(True)
255 project.othersAdded(outdir) 261 project.othersAdded(outdir)
256 262
257 if parms["qtHelpEnabled"]: 263 if parms["qtHelpEnabled"]:
258 outdir = Utilities.toNativeSeparators(parms["qtHelpOutputDirectory"]) 264 outdir = FileSystemUtilities.toNativeSeparators(
265 parms["qtHelpOutputDirectory"]
266 )
259 if outdir == "": 267 if outdir == "":
260 outdir = "help" 268 outdir = "help"
261 # that is eric7_docs default QtHelp output dir 269 # that is eric7_docs default QtHelp output dir
262 270
263 # add it to the project data, if it isn't in already 271 # add it to the project data, if it isn't in already

eric ide

mercurial