eric6/Preferences/ProgramsDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8043
0acf98cd089a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

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
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7911
diff changeset
3 # Copyright (c) 2006 - 2021 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 Programs page.
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
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import re
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
12 import sys
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
14 from PyQt5.QtCore import pyqtSlot, Qt, QProcess
7263
c1af2e327675 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
15 from PyQt5.QtWidgets import (
c1af2e327675 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
16 QApplication, QTreeWidgetItem, QHeaderView, QDialog, QDialogButtonBox
c1af2e327675 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 )
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.E5Application import e5App
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
20 from E5Gui.E5OverrideCursor import E5OverrideCursor
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
22 from .Ui_ProgramsDialog import Ui_ProgramsDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
394
da5696492639 Changed algorithm to detect eric tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 308
diff changeset
27
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 class ProgramsDialog(QDialog, Ui_ProgramsDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Class implementing the Programs page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
32 ToolAvailableRole = Qt.UserRole + 1
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
33
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 901
diff changeset
34 def __init__(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 Constructor
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 @param parent The parent widget of this dialog. (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
40 super(ProgramsDialog, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.setObjectName("ProgramsDialog")
4278
ccd1e13cb9bd Fixed issues where dialogs could not be minimized on some desktop environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
43 self.setWindowFlags(Qt.Window)
0
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 self.__hasSearched = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
47 self.programsList.headerItem().setText(
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
48 self.programsList.columnCount(), "")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
50 self.searchButton = self.buttonBox.addButton(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
51 self.tr("Search"), QDialogButtonBox.ActionRole)
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
52 self.searchButton.setToolTip(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
53 self.tr("Press to search for programs"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
55 self.showComboBox.addItems([
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
56 self.tr("All Supported Tools"),
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
57 self.tr("Available Tools Only"),
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
58 self.tr("Unavailable Tools Only"),
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
59 ])
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
60
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 def show(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 Public slot to show the dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 QDialog.show(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 if not self.__hasSearched:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.on_programsSearchButton_clicked()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 def on_buttonBox_clicked(self, button):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 Private slot called by a button of the button box clicked.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @param button button that was clicked (QAbstractButton)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 if button == self.searchButton:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.on_programsSearchButton_clicked()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 def on_programsSearchButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 Private slot to search for all supported/required programs.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.programsList.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 header = self.programsList.header()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 header.setSortIndicator(0, Qt.AscendingOrder)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 header.setSortIndicatorShown(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
88 with E5OverrideCursor():
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
89 # 1. do the Qt programs
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
90 # 1a. Translation Converter
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
91 exe = (
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
92 Utilities.isWindowsPlatform() and
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
93 "{0}.exe".format(Utilities.generateQtToolName("lrelease")) or
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
94 Utilities.generateQtToolName("lrelease")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
95 )
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
96 exe = os.path.join(Utilities.getQtBinariesPath(), exe)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
97 version = self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
98 self.tr("Translation Converter (Qt)"), exe, '-version',
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
99 'lrelease', -1)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
100 # 1b. Qt Designer
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
101 if Utilities.isWindowsPlatform():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
102 exe = os.path.join(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
103 Utilities.getQtBinariesPath(),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
104 "{0}.exe".format(Utilities.generateQtToolName("designer")))
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
105 elif Utilities.isMacPlatform():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
106 exe = Utilities.getQtMacBundle("designer")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
107 else:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
108 exe = os.path.join(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
109 Utilities.getQtBinariesPath(),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
110 Utilities.generateQtToolName("designer"))
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
111 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
112 self.tr("Qt Designer"), exe, version=version)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
113 # 1c. Qt Linguist
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
114 if Utilities.isWindowsPlatform():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
115 exe = os.path.join(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
116 Utilities.getQtBinariesPath(),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
117 "{0}.exe".format(Utilities.generateQtToolName("linguist")))
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
118 elif Utilities.isMacPlatform():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
119 exe = Utilities.getQtMacBundle("linguist")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
120 else:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
121 exe = os.path.join(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
122 Utilities.getQtBinariesPath(),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
123 Utilities.generateQtToolName("linguist"))
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
124 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
125 self.tr("Qt Linguist"), exe, version=version)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
126 # 1d. Qt Assistant
6672
2af01e538c57 Started implementing support conda virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6667
diff changeset
127 if Utilities.isWindowsPlatform():
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
128 exe = os.path.join(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
129 Utilities.getQtBinariesPath(),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
130 "{0}.exe".format(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
131 Utilities.generateQtToolName("assistant")))
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
132 elif Utilities.isMacPlatform():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
133 exe = Utilities.getQtMacBundle("assistant")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
134 else:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
135 exe = os.path.join(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
136 Utilities.getQtBinariesPath(),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
137 Utilities.generateQtToolName("assistant"))
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
138 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
139 self.tr("Qt Assistant"), exe, version=version)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
140
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
141 # 2. do the PyQt programs
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
142 # 2.1 do the PyQt5 programs
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
143 # 2.1a. Translation Extractor PyQt5
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
144 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
145 self.tr("Translation Extractor (Python, PyQt5)"),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
146 Utilities.generatePyQtToolPath("pylupdate5"),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
147 '-version', 'pylupdate', -1)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
148 # 2.1b. Forms Compiler PyQt5
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
149 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
150 self.tr("Forms Compiler (Python, PyQt5)"),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
151 Utilities.generatePyQtToolPath("pyuic5", ["py3uic5"]),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
152 '--version', 'Python User', 4)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
153 # 2.1c. Resource Compiler PyQt5
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
154 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
155 self.tr("Resource Compiler (Python, PyQt5)"),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
156 Utilities.generatePyQtToolPath("pyrcc5"),
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
157 '-version', '', -1, versionRe='Resource Compiler|pyrcc5')
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
158
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
159 # 2.2 do the PyQt6 programs
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
160 # 2.2a. Translation Extractor PyQt6
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
161 self.__createProgramEntry(
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
162 self.tr("Translation Extractor (Python, PyQt6)"),
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
163 Utilities.generatePyQtToolPath("pylupdate6"),
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
164 '--version', versionPosition=0)
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
165 # 2.2b. Forms Compiler PyQt6
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
166 self.__createProgramEntry(
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
167 self.tr("Forms Compiler (Python, PyQt6)"),
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
168 Utilities.generatePyQtToolPath("pyuic6"),
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
169 '--version', versionPosition=0)
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
170
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
171 # 3. do the PySide programs
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
172 # 3.1 do the PySide2 programs
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
173 # 3.1a. Translation Extractor PySide2
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
174 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
175 self.tr("Translation Extractor (Python, PySide2)"),
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
176 Utilities.generatePySideToolPath("pyside2-lupdate", variant=2),
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
177 '-version', '', -1, versionRe='lupdate')
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
178 # 3.1b. Forms Compiler PySide2
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
179 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
180 self.tr("Forms Compiler (Python, PySide2)"),
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
181 Utilities.generatePySideToolPath("pyside2-uic", variant=2),
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
182 '--version', '', -1, versionRe='uic')
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
183 # 3.1c Resource Compiler PySide2
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
184 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
185 self.tr("Resource Compiler (Python, PySide2)"),
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
186 Utilities.generatePySideToolPath("pyside2-rcc", variant=2),
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
187 '-version', '', -1, versionRe='rcc')
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
188 # 3.2 do the PySide5 programs
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
189 # 3.2a. Translation Extractor PySide6
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
190 self.__createProgramEntry(
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
191 self.tr("Translation Extractor (Python, PySide6)"),
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
192 Utilities.generatePySideToolPath("pyside6-lupdate", variant=6),
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
193 '-version', '', -1, versionRe='lupdate')
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
194 # 3.2b. Forms Compiler PySide6
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
195 self.__createProgramEntry(
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
196 self.tr("Forms Compiler (Python, PySide6)"),
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
197 Utilities.generatePySideToolPath("pyside6-uic", variant=6),
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
198 '--version', '', -1, versionRe='uic')
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
199 # 3.2c Resource Compiler PySide6
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
200 self.__createProgramEntry(
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
201 self.tr("Resource Compiler (Python, PySide6)"),
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
202 Utilities.generatePySideToolPath("pyside6-rcc", variant=6),
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
203 '--version', '', -1, versionRe='rcc')
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
204
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
205 # 4. do the Conda program(s)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
206 exe = Preferences.getConda("CondaExecutable")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
207 if not exe:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
208 exe = "conda"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
209 if Utilities.isWindowsPlatform():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
210 exe += ".exe"
6782
390a45748883 PipInterface: started to convert the pip interface from a menu based plug-in to a widget based interface to be placed in the right side tools bar.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6672
diff changeset
211 self.__createProgramEntry(
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
212 self.tr("conda Manager"), exe, '--version', 'conda', -1)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
213
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
214 # 5. do the pip program(s)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
215 virtualenvManager = e5App().getObject("VirtualEnvManager")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
216 for venvName in virtualenvManager.getVirtualenvNames():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
217 interpreter = virtualenvManager.getVirtualenvInterpreter(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
218 venvName)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
219 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
220 self.tr("PyPI Package Management"), interpreter,
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
221 '--version', 'pip', 1, exeModule=["-m", "pip"])
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
222
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
223 # 6. do the CORBA and Protobuf programs
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
224 # 6a. omniORB
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
225 exe = Preferences.getCorba("omniidl")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
226 if not exe:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
227 exe = "omniidl"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
228 if Utilities.isWindowsPlatform():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
229 exe += ".exe"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
230 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
231 self.tr("CORBA IDL Compiler"), exe, '-V', 'omniidl', -1)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
232 # 6b. protobuf
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
233 exe = Preferences.getProtobuf("protoc")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
234 if not exe:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
235 exe = "protoc"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
236 if Utilities.isWindowsPlatform():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
237 exe += ".exe"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
238 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
239 self.tr("Protobuf Compiler"), exe, '--version', 'libprotoc',
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
240 -1)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
241 # 6c. grpc
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
242 exe = Preferences.getProtobuf("grpcPython")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
243 if not exe:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
244 exe = sys.executable
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
245 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
246 self.tr("gRPC Compiler"), exe, '--version', 'libprotoc', -1,
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
247 exeModule=['-m', 'grpc_tools.protoc'])
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
248
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
249 # 7. do the spell checking entry
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 try:
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
251 import enchant
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
252 try:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
253 text = os.path.dirname(enchant.__file__)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
254 except AttributeError:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
255 text = "enchant"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
256 try:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
257 version = enchant.__version__
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
258 except AttributeError:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
259 version = self.tr("(unknown)")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
260 except (ImportError, AttributeError, OSError):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 text = "enchant"
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
262 version = ""
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
263 self.__createEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
264 self.tr("Spell Checker - PyEnchant"), text, version)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
265
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
266 # 8. do the pygments entry
686
b672b36f3efb Added code to show the version of the Pygments source highlighter and which variant is used (built-in or external).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 438
diff changeset
267 try:
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
268 import pygments
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
269 try:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
270 text = os.path.dirname(pygments.__file__)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
271 except AttributeError:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
272 text = "pygments"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
273 try:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
274 version = pygments.__version__
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
275 except AttributeError:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
276 version = self.tr("(unknown)")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
277 except (ImportError, AttributeError, OSError):
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
278 text = "pygments"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
279 version = ""
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
280 self.__createEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
281 self.tr("Source Highlighter - Pygments"), text, version)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
282
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
283 # 9. do the MicroPython related entries
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
284 exe = Preferences.getMicroPython("MpyCrossCompiler")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
285 if not exe:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
286 exe = "mpy-cross"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
287 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
288 self.tr("MicroPython - MPY Cross Compiler"), exe, '--version',
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
289 'MicroPython', 1)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
290 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
291 self.tr("MicroPython - ESP Tool"), sys.executable, 'version',
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
292 'esptool', -1, exeModule=['-m', 'esptool'])
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
293 exe = Preferences.getMicroPython("DfuUtilPath")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
294 if not exe:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
295 exe = "dfu-util"
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
296 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
297 self.tr("MicroPython - PyBoard Flasher"), exe, '--version',
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
298 'dfu-util', -1)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
299
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
300 # 10. do the plugin related programs
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
301 pm = e5App().getObject("PluginManager")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
302 for info in pm.getPluginExeDisplayData():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
303 if info["programEntry"]:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
304 if "exeModule" not in info:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
305 info["exeModule"] = None
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
306 if "versionRe" not in info:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
307 info["versionRe"] = None
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
308 self.__createProgramEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
309 info["header"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
310 info["exe"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
311 versionCommand=info["versionCommand"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
312 versionStartsWith=info["versionStartsWith"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
313 versionPosition=info["versionPosition"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
314 version=info["version"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
315 versionCleanup=info["versionCleanup"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
316 versionRe=info["versionRe"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
317 exeModule=info["exeModule"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
318 )
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
319 else:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
320 self.__createEntry(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
321 info["header"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
322 info["text"],
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
323 info["version"]
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
324 )
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
325
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
326 self.programsList.sortByColumn(0, Qt.AscendingOrder)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
327 self.on_showComboBox_currentIndexChanged(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
328 self.showComboBox.currentIndex())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 self.__hasSearched = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 def __createProgramEntry(self, description, exe,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 901
diff changeset
333 versionCommand="", versionStartsWith="",
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
334 versionPosition=None, version="",
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
335 versionCleanup=None, versionRe=None,
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
336 exeModule=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 Private method to generate a program entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 @param description descriptive text (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 @param exe name of the executable program (string)
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
342 @param versionCommand command line switch to get the version info
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
343 (str). If this is empty, the given version will be shown.
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
344 @param versionStartsWith start of line identifying version info
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
345 (string)
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
346 @param versionPosition index of part containing the version info
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
347 (integer)
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
348 @param version version string to show (string)
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
349 @param versionCleanup tuple of two integers giving string positions
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 start and stop for the version string (tuple of integers)
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
351 @param versionRe regexp to determine the line identifying version
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 info (string). Takes precedence over versionStartsWith.
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
353 @param exeModule list of command line parameters to execute a module
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
354 with the program given in exe (e.g. to execute a Python module)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
355 (list of str)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 @return version string of detected or given version (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
358 itmList = self.programsList.findItems(
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
359 description, Qt.MatchCaseSensitive)
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: 426
diff changeset
360 if itmList:
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: 426
diff changeset
361 itm = itmList[0]
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: 426
diff changeset
362 else:
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: 426
diff changeset
363 itm = QTreeWidgetItem(self.programsList, [description])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 font = itm.font(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 font.setBold(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 itm.setFont(0, font)
6665
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
367 rememberedExe = exe
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 if not exe:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
369 itm.setText(1, self.tr("(not configured)"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 if os.path.isabs(exe):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 if not Utilities.isExecutable(exe):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 exe = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 exe = Utilities.getExecutablePath(exe)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 if exe:
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
377 available = True
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
378 if versionCommand and versionPosition is not None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 proc = QProcess()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 proc.setProcessChannelMode(QProcess.MergedChannels)
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
381 if exeModule:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
382 args = exeModule[:] + [versionCommand]
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
383 else:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
384 args = [versionCommand]
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
385 proc.start(exe, args)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 finished = proc.waitForFinished(10000)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 if finished:
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
388 output = str(proc.readAllStandardOutput(),
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
389 Preferences.getSystem("IOEncoding"),
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
390 'replace')
7263
c1af2e327675 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
391 if (
c1af2e327675 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
392 exeModule and
c1af2e327675 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
393 exeModule[0] == "-m" and
6288
67ae52179c8b ProgramsDialog: fixed an issue causing a non-existent module not being detected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6083
diff changeset
394 ("ImportError:" in output or
6667
d45c9b0c3851 ProgramsDialog: added another condition for failing to load a Python module via -m.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6665
diff changeset
395 "ModuleNotFoundError:" in output or
7263
c1af2e327675 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
396 proc.exitCode() != 0)
c1af2e327675 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
397 ):
6083
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
398 version = self.tr("(module not found)")
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
399 available = False
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
400 elif not versionStartsWith and not versionRe:
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
401 # assume output is just one line
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
402 try:
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
403 version = (
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
404 output.strip().split()[versionPosition]
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
405 )
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
406 if versionCleanup:
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
407 version = version[
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
408 versionCleanup[0]:
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
409 versionCleanup[1]
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
410 ]
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
411 except IndexError:
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
412 version = self.tr("(unknown)")
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
413 available = False
3194
c95193671ab5 Little correction to the programs dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
414 else:
6083
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
415 if versionRe is None:
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
416 versionRe = "^{0}".format(
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
417 re.escape(versionStartsWith))
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
418 versionRe = re.compile(versionRe, re.UNICODE)
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
419 for line in output.splitlines():
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
420 if versionRe.search(line):
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
421 try:
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
422 version = line.split()[versionPosition]
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
423 if versionCleanup:
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
424 version = version[
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
425 versionCleanup[0]:
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
426 versionCleanup[1]
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
427 ]
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
428 break
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
429 except IndexError:
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
430 version = self.tr("(unknown)")
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
431 available = False
6083
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
432 else:
fc99172cd83e Fixed the output of the programs dialog for failed module imports of programs (i.e. for commands like "python3 -m grpc_tools.protoc").
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6068
diff changeset
433 version = self.tr("(unknown)")
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
434 available = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
436 version = self.tr("(not executable)")
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
437 available = False
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
438 if exeModule:
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
439 citm = QTreeWidgetItem(itm, [
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
440 "{0} {1}".format(exe, " ".join(exeModule)),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
441 version])
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
442 else:
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
443 citm = QTreeWidgetItem(itm, [exe, version])
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
444 citm.setData(0, self.ToolAvailableRole, available)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 itm.setExpanded(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 else:
6665
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
447 if itm.childCount() == 0:
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
448 itm.setText(1, self.tr("(not found)"))
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
449 else:
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
450 citm = QTreeWidgetItem(
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
451 itm, [rememberedExe, self.tr("(not found)")])
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
452 citm.setData(0, self.ToolAvailableRole, False)
6665
adb59475e671 Some changes to the Qt Help tools detection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
453 itm.setExpanded(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 QApplication.processEvents()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 self.programsList.header().resizeSections(QHeaderView.ResizeToContents)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 self.programsList.header().setStretchLastSection(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 return version
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 def __createEntry(self, description, entryText, entryVersion):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 Private method to generate a program entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 @param description descriptive text (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 @param entryText text to show (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 @param entryVersion version string to show (string).
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 itm = QTreeWidgetItem(self.programsList, [description])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 font = itm.font(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 font.setBold(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 itm.setFont(0, font)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 if len(entryVersion):
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
473 citm = QTreeWidgetItem(itm, [entryText, entryVersion])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 itm.setExpanded(True)
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
475 citm.setData(0, self.ToolAvailableRole,
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
476 not entryVersion.startswith("("))
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
477 # assume version starting with '(' is an unavailability
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
479 itm.setText(1, self.tr("(not found)"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 QApplication.processEvents()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 self.programsList.header().resizeSections(QHeaderView.ResizeToContents)
97
c4086afea02b Finished cleaning up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
482 self.programsList.header().setStretchLastSection(True)
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
483
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
484 @pyqtSlot(int)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
485 def on_showComboBox_currentIndexChanged(self, index):
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
486 """
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
487 Private slot to apply the selected show criteria.
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
488
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
489 @param index index of the show criterium
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
490 @type int
7425
bd0eff406c6b ProgramsDialog: implemented interims filter solution to hide unavailable tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
491 """
7426
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
492 if index == 0:
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
493 # All Supported Tools
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
494 for topIndex in range(self.programsList.topLevelItemCount()):
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
495 topItem = self.programsList.topLevelItem(topIndex)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
496 for childIndex in range(topItem.childCount()):
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
497 topItem.child(childIndex).setHidden(False)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
498 topItem.setHidden(False)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
499 else:
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
500 # 1 = Available Tools Only
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
501 # 2 = Unavailable Tools Only
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
502 for topIndex in range(self.programsList.topLevelItemCount()):
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
503 topItem = self.programsList.topLevelItem(topIndex)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
504 if topItem.childCount() == 0:
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
505 topItem.setHidden(index == 1)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
506 else:
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
507 availabilityList = []
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
508 for childIndex in range(topItem.childCount()):
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
509 childItem = topItem.child(childIndex)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
510 available = childItem.data(0, self.ToolAvailableRole)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
511 if index == 1:
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
512 childItem.setHidden(not available)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
513 else:
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
514 childItem.setHidden(available)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
515 availabilityList.append(available)
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
516 if index == 1:
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
517 topItem.setHidden(not any(availabilityList))
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
518 else:
dc171b1d8261 ProgramsDialog: added filter capability to the dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7425
diff changeset
519 topItem.setHidden(all(availabilityList))

eric ide

mercurial