34 @type QWidget |
34 @type QWidget |
35 """ |
35 """ |
36 super(PipDialog, self).__init__(parent) |
36 super(PipDialog, self).__init__(parent) |
37 self.setupUi(self) |
37 self.setupUi(self) |
38 |
38 |
39 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
39 self.buttonBox.button( |
40 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
40 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
|
41 self.buttonBox.button( |
|
42 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
41 |
43 |
42 self.proc = None |
44 self.proc = None |
43 self.__processQueue = [] |
45 self.__processQueue = [] |
44 self.__ioEncoding = Preferences.getSystem("IOEncoding") |
46 self.__ioEncoding = Preferences.getSystem("IOEncoding") |
45 |
47 |
63 Private slot called when the process finished or the user pressed |
65 Private slot called when the process finished or the user pressed |
64 the button. |
66 the button. |
65 """ |
67 """ |
66 if ( |
68 if ( |
67 self.proc is not None and |
69 self.proc is not None and |
68 self.proc.state() != QProcess.NotRunning |
70 self.proc.state() != QProcess.ProcessState.NotRunning |
69 ): |
71 ): |
70 self.proc.terminate() |
72 self.proc.terminate() |
71 QTimer.singleShot(2000, self.proc.kill) |
73 QTimer.singleShot(2000, self.proc.kill) |
72 self.proc.waitForFinished(3000) |
74 self.proc.waitForFinished(3000) |
73 |
75 |
76 if self.__processQueue: |
78 if self.__processQueue: |
77 cmd, args = self.__processQueue.pop(0) |
79 cmd, args = self.__processQueue.pop(0) |
78 self.__addOutput("\n\n") |
80 self.__addOutput("\n\n") |
79 self.startProcess(cmd, args) |
81 self.startProcess(cmd, args) |
80 else: |
82 else: |
81 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
83 self.buttonBox.button( |
82 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
84 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
83 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
85 self.buttonBox.button( |
84 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
86 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
85 Qt.OtherFocusReason) |
87 self.buttonBox.button( |
|
88 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
89 self.buttonBox.button( |
|
90 QDialogButtonBox.StandardButton.Close).setFocus( |
|
91 Qt.FocusReason.OtherFocusReason) |
86 |
92 |
87 def __cancel(self): |
93 def __cancel(self): |
88 """ |
94 """ |
89 Private slot to cancel the current action. |
95 Private slot to cancel the current action. |
90 """ |
96 """ |
97 Private slot called by a button of the button box clicked. |
103 Private slot called by a button of the button box clicked. |
98 |
104 |
99 @param button button that was clicked |
105 @param button button that was clicked |
100 @type QAbstractButton |
106 @type QAbstractButton |
101 """ |
107 """ |
102 if button == self.buttonBox.button(QDialogButtonBox.Close): |
108 if button == self.buttonBox.button( |
|
109 QDialogButtonBox.StandardButton.Close |
|
110 ): |
103 self.close() |
111 self.close() |
104 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
112 elif button == self.buttonBox.button( |
|
113 QDialogButtonBox.StandardButton.Cancel |
|
114 ): |
105 self.__cancel() |
115 self.__cancel() |
106 |
116 |
107 def __procFinished(self, exitCode, exitStatus): |
117 def __procFinished(self, exitCode, exitStatus): |
108 """ |
118 """ |
109 Private slot connected to the finished signal. |
119 Private slot connected to the finished signal. |