43 self.setObjectName("ProgramsDialog") |
43 self.setObjectName("ProgramsDialog") |
44 |
44 |
45 self.__hasSearched = False |
45 self.__hasSearched = False |
46 |
46 |
47 self.programsList.headerItem().setText( |
47 self.programsList.headerItem().setText( |
48 self.programsList.columnCount(), "") |
48 self.programsList.columnCount(), "") |
49 |
49 |
50 self.searchButton = self.buttonBox.addButton( |
50 self.searchButton = self.buttonBox.addButton( |
51 self.trUtf8("Search"), QDialogButtonBox.ActionRole) |
51 self.trUtf8("Search"), QDialogButtonBox.ActionRole) |
52 self.searchButton.setToolTip( |
52 self.searchButton.setToolTip( |
53 self.trUtf8("Press to search for programs")) |
53 self.trUtf8("Press to search for programs")) |
298 exe = "" |
298 exe = "" |
299 else: |
299 else: |
300 exe = Utilities.getExecutablePath(exe) |
300 exe = Utilities.getExecutablePath(exe) |
301 if exe: |
301 if exe: |
302 if versionCommand and \ |
302 if versionCommand and \ |
303 (versionStartsWith != "" or \ |
303 (versionStartsWith != "" or |
304 (versionRe is not None and versionRe != "")) and \ |
304 (versionRe is not None and versionRe != "")) and \ |
305 versionPosition: |
305 versionPosition: |
306 proc = QProcess() |
306 proc = QProcess() |
307 proc.setProcessChannelMode(QProcess.MergedChannels) |
307 proc.setProcessChannelMode(QProcess.MergedChannels) |
308 proc.start(exe, [versionCommand]) |
308 proc.start(exe, [versionCommand]) |
309 finished = proc.waitForFinished(10000) |
309 finished = proc.waitForFinished(10000) |
310 if finished: |
310 if finished: |
311 output = \ |
311 output = str(proc.readAllStandardOutput(), |
312 str(proc.readAllStandardOutput(), |
312 Preferences.getSystem("IOEncoding"), |
313 Preferences.getSystem("IOEncoding"), |
313 'replace') |
314 'replace') |
|
315 if versionRe is None: |
314 if versionRe is None: |
316 versionRe = "^{0}".format( |
315 versionRe = "^{0}".format( |
317 re.escape(versionStartsWith)) |
316 re.escape(versionStartsWith)) |
318 versionRe = re.compile(versionRe, re.UNICODE) |
317 versionRe = re.compile(versionRe, re.UNICODE) |
319 for line in output.splitlines(): |
318 for line in output.splitlines(): |