4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog starting a process and showing its output. |
7 Module implementing a dialog starting a process and showing its output. |
8 """ |
8 """ |
9 |
|
10 from __future__ import unicode_literals |
|
11 try: |
|
12 str = unicode |
|
13 except NameError: |
|
14 pass |
|
15 |
9 |
16 import os |
10 import os |
17 |
11 |
18 from PyQt5.QtCore import QProcess, QTimer, pyqtSlot, Qt, QCoreApplication |
12 from PyQt5.QtCore import QProcess, QTimer, pyqtSlot, Qt, QCoreApplication |
19 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QLineEdit, QTextEdit |
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QLineEdit, QTextEdit |
80 def finish(self): |
74 def finish(self): |
81 """ |
75 """ |
82 Public slot called when the process finished or the user pressed the |
76 Public slot called when the process finished or the user pressed the |
83 button. |
77 button. |
84 """ |
78 """ |
85 if self.proc is not None and \ |
79 if ( |
86 self.proc.state() != QProcess.NotRunning: |
80 self.proc is not None and |
|
81 self.proc.state() != QProcess.NotRunning |
|
82 ): |
87 self.proc.terminate() |
83 self.proc.terminate() |
88 QTimer.singleShot(2000, self.proc.kill) |
84 QTimer.singleShot(2000, self.proc.kill) |
89 self.proc.waitForFinished(3000) |
85 self.proc.waitForFinished(3000) |
90 |
86 |
91 self.inputGroup.setEnabled(False) |
87 self.inputGroup.setEnabled(False) |