24 import Preferences |
24 import Preferences |
25 |
25 |
26 |
26 |
27 class PipDialog(QDialog, Ui_PipDialog): |
27 class PipDialog(QDialog, Ui_PipDialog): |
28 """ |
28 """ |
29 Class implementing a dialog showing the output of a pip command. |
29 Class implementing a dialog showing the output of a 'python -m pip' |
|
30 command. |
30 """ |
31 """ |
31 def __init__(self, text, parent=None): |
32 def __init__(self, text, parent=None): |
32 """ |
33 """ |
33 Constructor |
34 Constructor |
34 |
35 |
35 @param text text to be shown by the label (string) |
36 @param text text to be shown by the label |
36 @param parent reference to the parent widget (QWidget) |
37 @type str |
|
38 @param parent reference to the parent widget |
|
39 @type QWidget |
37 """ |
40 """ |
38 super(PipDialog, self).__init__(parent) |
41 super(PipDialog, self).__init__(parent) |
39 self.setupUi(self) |
42 self.setupUi(self) |
40 |
43 |
41 self.proc = None |
44 self.proc = None |
49 |
52 |
50 def closeEvent(self, e): |
53 def closeEvent(self, e): |
51 """ |
54 """ |
52 Protected slot implementing a close event handler. |
55 Protected slot implementing a close event handler. |
53 |
56 |
54 @param e close event (QCloseEvent) |
57 @param e close event |
|
58 @type QCloseEvent |
55 """ |
59 """ |
56 self.__processQueue = [] |
60 self.__processQueue = [] |
57 |
61 |
58 if self.proc is not None and \ |
62 if self.proc is not None and \ |
59 self.proc.state() != QProcess.NotRunning: |
63 self.proc.state() != QProcess.NotRunning: |
90 @pyqtSlot(QAbstractButton) |
94 @pyqtSlot(QAbstractButton) |
91 def on_buttonBox_clicked(self, button): |
95 def on_buttonBox_clicked(self, button): |
92 """ |
96 """ |
93 Private slot called by a button of the button box clicked. |
97 Private slot called by a button of the button box clicked. |
94 |
98 |
95 @param button button that was clicked (QAbstractButton) |
99 @param button button that was clicked |
|
100 @type QAbstractButton |
96 """ |
101 """ |
97 if button == self.buttonBox.button(QDialogButtonBox.Close): |
102 if button == self.buttonBox.button(QDialogButtonBox.Close): |
98 self.close() |
103 self.close() |
99 |
104 |
100 def __procFinished(self, exitCode, exitStatus): |
105 def __procFinished(self, exitCode, exitStatus): |
101 """ |
106 """ |
102 Private slot connected to the finished signal. |
107 Private slot connected to the finished signal. |
103 |
108 |
104 @param exitCode exit code of the process (integer) |
109 @param exitCode exit code of the process |
105 @param exitStatus exit status of the process (QProcess.ExitStatus) |
110 @type int |
|
111 @param exitStatus exit status of the process |
|
112 @type QProcess.ExitStatus |
106 """ |
113 """ |
107 self.__finish() |
114 self.__finish() |
108 |
115 |
109 def startProcess(self, cmd, args, showArgs=True): |
116 def startProcess(self, cmd, args, showArgs=True): |
110 """ |
117 """ |
111 Public slot used to start the process. |
118 Public slot used to start the process. |
112 |
119 |
113 @param cmd name of the pip executable to be used (string) |
120 @param cmd name of the pip executable to be used |
114 @param args list of arguments for the process (list of strings) |
121 @type str |
115 @keyparam showArgs flag indicating to show the arguments (boolean) |
122 @param args list of arguments for the process |
|
123 @type list of str |
|
124 @keyparam showArgs flag indicating to show the arguments |
|
125 @type bool |
116 @return flag indicating a successful start of the process |
126 @return flag indicating a successful start of the process |
|
127 @rtype bool |
117 """ |
128 """ |
118 if len(self.errors.toPlainText()) == 0: |
129 if len(self.errors.toPlainText()) == 0: |
119 self.errorGroup.hide() |
130 self.errorGroup.hide() |
120 |
131 |
121 if showArgs: |
132 if showArgs: |
142 """ |
153 """ |
143 Public method to issue a list of commands to be executed. |
154 Public method to issue a list of commands to be executed. |
144 |
155 |
145 @param processParams list of tuples containing the command |
156 @param processParams list of tuples containing the command |
146 and arguments |
157 and arguments |
147 @type list of tuples of str and list of str |
158 @type list of tuples of (str, list of str) |
148 @return flag indicating a successful start of the first process |
159 @return flag indicating a successful start of the first process |
149 @rtype bool |
160 @rtype bool |
150 """ |
161 """ |
151 if len(processParams) > 1: |
162 if len(processParams) > 1: |
152 for cmd, args in processParams[1:]: |
163 for cmd, args in processParams[1:]: |