Preferences/ProgramsDialog.py

changeset 945
8cd4d08fa9f6
parent 901
99b4cb6910ad
child 1131
7781e396c903
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
24 24
25 class ProgramsDialog(QDialog, Ui_ProgramsDialog): 25 class ProgramsDialog(QDialog, Ui_ProgramsDialog):
26 """ 26 """
27 Class implementing the Programs page. 27 Class implementing the Programs page.
28 """ 28 """
29 def __init__(self, parent = None): 29 def __init__(self, parent=None):
30 """ 30 """
31 Constructor 31 Constructor
32 32
33 @param parent The parent widget of this dialog. (QWidget) 33 @param parent The parent widget of this dialog. (QWidget)
34 """ 34 """
77 # 1. do the Qt4 programs 77 # 1. do the Qt4 programs
78 # 1a. Translation Converter 78 # 1a. Translation Converter
79 exe = Utilities.isWindowsPlatform() and \ 79 exe = Utilities.isWindowsPlatform() and \
80 "{0}.exe".format(Utilities.generateQtToolName("lrelease")) or \ 80 "{0}.exe".format(Utilities.generateQtToolName("lrelease")) or \
81 Utilities.generateQtToolName("lrelease") 81 Utilities.generateQtToolName("lrelease")
82 version = self.__createProgramEntry(self.trUtf8("Translation Converter (Qt4)"), 82 version = self.__createProgramEntry(self.trUtf8("Translation Converter (Qt4)"),
83 exe, '-version', 'lrelease', -1) 83 exe, '-version', 'lrelease', -1)
84 # 1b. Qt4 Designer 84 # 1b. Qt4 Designer
85 exe = Utilities.isWindowsPlatform() and \ 85 exe = Utilities.isWindowsPlatform() and \
86 "{0}.exe".format(Utilities.generateQtToolName("designer")) or \ 86 "{0}.exe".format(Utilities.generateQtToolName("designer")) or \
87 Utilities.generateQtToolName("designer") 87 Utilities.generateQtToolName("designer")
88 self.__createProgramEntry(self.trUtf8("Qt4 Designer"), exe, version = version) 88 self.__createProgramEntry(self.trUtf8("Qt4 Designer"), exe, version=version)
89 # 1c. Qt4 Linguist 89 # 1c. Qt4 Linguist
90 exe = Utilities.isWindowsPlatform() and \ 90 exe = Utilities.isWindowsPlatform() and \
91 "{0}.exe".format(Utilities.generateQtToolName("linguist")) or \ 91 "{0}.exe".format(Utilities.generateQtToolName("linguist")) or \
92 Utilities.generateQtToolName("linguist") 92 Utilities.generateQtToolName("linguist")
93 self.__createProgramEntry(self.trUtf8("Qt4 Linguist"), exe, version = version) 93 self.__createProgramEntry(self.trUtf8("Qt4 Linguist"), exe, version=version)
94 # 1d. Qt4 Assistant 94 # 1d. Qt4 Assistant
95 exe = Utilities.isWindowsPlatform() and \ 95 exe = Utilities.isWindowsPlatform() and \
96 "{0}.exe".format(Utilities.generateQtToolName("assistant")) or \ 96 "{0}.exe".format(Utilities.generateQtToolName("assistant")) or \
97 Utilities.generateQtToolName("assistant") 97 Utilities.generateQtToolName("assistant")
98 self.__createProgramEntry(self.trUtf8("Qt4 Assistant"), exe, version = version) 98 self.__createProgramEntry(self.trUtf8("Qt4 Assistant"), exe, version=version)
99 99
100 # 2. do the PyQt programs 100 # 2. do the PyQt programs
101 # 2a. Translation Extractor PyQt4 101 # 2a. Translation Extractor PyQt4
102 self.__createProgramEntry(self.trUtf8("Translation Extractor (Python, Qt4)"), 102 self.__createProgramEntry(self.trUtf8("Translation Extractor (Python, Qt4)"),
103 Utilities.isWindowsPlatform() and "pylupdate4.exe" or "pylupdate4", 103 Utilities.isWindowsPlatform() and "pylupdate4.exe" or "pylupdate4",
104 '-version', 'pylupdate', -1) 104 '-version', 'pylupdate', -1)
105 # 2b. Forms Compiler PyQt4 105 # 2b. Forms Compiler PyQt4
106 self.__createProgramEntry(self.trUtf8("Forms Compiler (Python, Qt4)"), 106 self.__createProgramEntry(self.trUtf8("Forms Compiler (Python, Qt4)"),
107 Utilities.isWindowsPlatform() and "pyuic4.bat" or "pyuic4", 107 Utilities.isWindowsPlatform() and "pyuic4.bat" or "pyuic4",
108 '--version', 'Python User', 4) 108 '--version', 'Python User', 4)
109 # 2c. Resource Compiler PyQt4 109 # 2c. Resource Compiler PyQt4
110 self.__createProgramEntry(self.trUtf8("Resource Compiler (Python, Qt4)"), 110 self.__createProgramEntry(self.trUtf8("Resource Compiler (Python, Qt4)"),
111 Utilities.isWindowsPlatform() and "pyrcc4.exe" or "pyrcc4", 111 Utilities.isWindowsPlatform() and "pyrcc4.exe" or "pyrcc4",
112 '-version', 'Resource Compiler', -1) 112 '-version', 'Resource Compiler', -1)
113 113
114 # 3. do the PySide programs 114 # 3. do the PySide programs
115 # 3a. Translation Extractor PySide 115 # 3a. Translation Extractor PySide
116 self.__createProgramEntry(self.trUtf8("Translation Extractor (Python, PySide)"), 116 self.__createProgramEntry(self.trUtf8("Translation Extractor (Python, PySide)"),
117 Utilities.isWindowsPlatform() and "pyside-lupdate.exe" or "pyside-lupdate", 117 Utilities.isWindowsPlatform() and "pyside-lupdate.exe" or "pyside-lupdate",
118 '-version', '', -1, versionRe = 'lupdate') 118 '-version', '', -1, versionRe='lupdate')
119 # 3b. Forms Compiler PySide 119 # 3b. Forms Compiler PySide
120 self.__createProgramEntry(self.trUtf8("Forms Compiler (Python, PySide)"), 120 self.__createProgramEntry(self.trUtf8("Forms Compiler (Python, PySide)"),
121 Utilities.isWindowsPlatform() and "pyside-uic.bat" or "pyside-uic", 121 Utilities.isWindowsPlatform() and "pyside-uic.bat" or "pyside-uic",
122 '--version', 'Python User', 4) 122 '--version', 'Python User', 4)
123 # 3.c Resource Compiler PySide 123 # 3.c Resource Compiler PySide
124 self.__createProgramEntry(self.trUtf8("Resource Compiler (Python, PySide)"), 124 self.__createProgramEntry(self.trUtf8("Resource Compiler (Python, PySide)"),
125 Utilities.isWindowsPlatform() and "pyside-rcc4.exe" or "pyside-rcc4", 125 Utilities.isWindowsPlatform() and "pyside-rcc4.exe" or "pyside-rcc4",
126 '-version', 'Resource Compiler', -1) 126 '-version', 'Resource Compiler', -1)
127 127
128 # 4. do the Ruby programs 128 # 4. do the Ruby programs
129 # 4a. Forms Compiler for Qt4 129 # 4a. Forms Compiler for Qt4
130 self.__createProgramEntry(self.trUtf8("Forms Compiler (Ruby, Qt4)"), 130 self.__createProgramEntry(self.trUtf8("Forms Compiler (Ruby, Qt4)"),
131 Utilities.isWindowsPlatform() and "rbuic4.exe" or "rbuic4", 131 Utilities.isWindowsPlatform() and "rbuic4.exe" or "rbuic4",
132 '-version', 'Qt', -1) 132 '-version', 'Qt', -1)
133 # 4b. Resource Compiler for Qt4 133 # 4b. Resource Compiler for Qt4
134 self.__createProgramEntry(self.trUtf8("Resource Compiler (Ruby, Qt4)"), 134 self.__createProgramEntry(self.trUtf8("Resource Compiler (Ruby, Qt4)"),
135 Utilities.isWindowsPlatform() and "rbrcc.exe" or "rbrcc", 135 Utilities.isWindowsPlatform() and "rbrcc.exe" or "rbrcc",
136 '-version', 'Ruby Resource Compiler', -1) 136 '-version', 'Ruby Resource Compiler', -1)
137 137
138 # 5. do the CORBA programs 138 # 5. do the CORBA programs
139 # 5a. omniORB 139 # 5a. omniORB
140 exe = Preferences.getCorba("omniidl") 140 exe = Preferences.getCorba("omniidl")
178 # do the plugin related programs 178 # do the plugin related programs
179 pm = e5App().getObject("PluginManager") 179 pm = e5App().getObject("PluginManager")
180 for info in pm.getPluginExeDisplayData(): 180 for info in pm.getPluginExeDisplayData():
181 if info["programEntry"]: 181 if info["programEntry"]:
182 self.__createProgramEntry( 182 self.__createProgramEntry(
183 info["header"], 183 info["header"],
184 info["exe"], 184 info["exe"],
185 versionCommand = info["versionCommand"], 185 versionCommand=info["versionCommand"],
186 versionStartsWith = info["versionStartsWith"], 186 versionStartsWith=info["versionStartsWith"],
187 versionPosition = info["versionPosition"], 187 versionPosition=info["versionPosition"],
188 version = info["version"], 188 version=info["version"],
189 versionCleanup = info["versionCleanup"], 189 versionCleanup=info["versionCleanup"],
190 ) 190 )
191 else: 191 else:
192 self.__createEntry( 192 self.__createEntry(
193 info["header"], 193 info["header"],
194 info["text"], 194 info["text"],
195 info["version"] 195 info["version"]
196 ) 196 )
197 197
198 self.programsList.sortByColumn(0, Qt.AscendingOrder) 198 self.programsList.sortByColumn(0, Qt.AscendingOrder)
199 QApplication.restoreOverrideCursor() 199 QApplication.restoreOverrideCursor()
200 200
201 self.__hasSearched = True 201 self.__hasSearched = True
202 202
203 def __createProgramEntry(self, description, exe, 203 def __createProgramEntry(self, description, exe,
204 versionCommand = "", versionStartsWith = "", 204 versionCommand="", versionStartsWith="",
205 versionPosition = 0, version = "", 205 versionPosition=0, version="",
206 versionCleanup = None, versionRe = None): 206 versionCleanup=None, versionRe=None):
207 """ 207 """
208 Private method to generate a program entry. 208 Private method to generate a program entry.
209 209
210 @param description descriptive text (string) 210 @param description descriptive text (string)
211 @param exe name of the executable program (string) 211 @param exe name of the executable program (string)
214 @param versionStartsWith start of line identifying version info (string) 214 @param versionStartsWith start of line identifying version info (string)
215 @param versionPosition index of part containing the version info (integer) 215 @param versionPosition index of part containing the version info (integer)
216 @keyparam version version string to show (string) 216 @keyparam version version string to show (string)
217 @keyparam versionCleanup tuple of two integers giving string positions 217 @keyparam versionCleanup tuple of two integers giving string positions
218 start and stop for the version string (tuple of integers) 218 start and stop for the version string (tuple of integers)
219 @keyparam versionRe regexp to determine the line identifying version 219 @keyparam versionRe regexp to determine the line identifying version
220 info (string). Takes precedence over versionStartsWith. 220 info (string). Takes precedence over versionStartsWith.
221 @return version string of detected or given version (string) 221 @return version string of detected or given version (string)
222 """ 222 """
223 itmList = self.programsList.findItems(description, Qt.MatchCaseSensitive) 223 itmList = self.programsList.findItems(description, Qt.MatchCaseSensitive)
224 if itmList: 224 if itmList:
245 proc.setProcessChannelMode(QProcess.MergedChannels) 245 proc.setProcessChannelMode(QProcess.MergedChannels)
246 proc.start(exe, [versionCommand]) 246 proc.start(exe, [versionCommand])
247 finished = proc.waitForFinished(10000) 247 finished = proc.waitForFinished(10000)
248 if finished: 248 if finished:
249 output = \ 249 output = \
250 str(proc.readAllStandardOutput(), 250 str(proc.readAllStandardOutput(),
251 Preferences.getSystem("IOEncoding"), 251 Preferences.getSystem("IOEncoding"),
252 'replace') 252 'replace')
253 if versionRe is None: 253 if versionRe is None:
254 versionRe = "^{0}".format(re.escape(versionStartsWith)) 254 versionRe = "^{0}".format(re.escape(versionStartsWith))
255 versionRe = re.compile(versionRe, re.UNICODE) 255 versionRe = re.compile(versionRe, re.UNICODE)
256 for line in output.splitlines(): 256 for line in output.splitlines():

eric ide

mercurial