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 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtCore import QProcess, QTimer, SIGNAL, pyqtSlot |
12 from PyQt4.QtCore import QProcess, QTimer, SIGNAL, pyqtSlot, Qt |
13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QMessageBox, QLineEdit |
13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QMessageBox, QLineEdit |
14 |
14 |
15 from .Ui_HgDialog import Ui_HgDialog |
15 from .Ui_HgDialog import Ui_HgDialog |
16 |
16 |
17 import Preferences |
17 import Preferences |
51 self.proc.state() != QProcess.NotRunning: |
51 self.proc.state() != QProcess.NotRunning: |
52 self.proc.terminate() |
52 self.proc.terminate() |
53 QTimer.singleShot(2000, self.proc.kill) |
53 QTimer.singleShot(2000, self.proc.kill) |
54 self.proc.waitForFinished(3000) |
54 self.proc.waitForFinished(3000) |
55 |
55 |
|
56 self.inputGroup.setEnabled(False) |
|
57 self.inputGroup.hide() |
|
58 |
|
59 self.proc = None |
|
60 |
56 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
61 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
57 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
62 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
58 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
63 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
59 |
64 self.buttonBox.button(QDialogButtonBox.Close).setFocus(Qt.OtherFocusReason) |
60 self.inputGroup.setEnabled(False) |
|
61 self.inputGroup.hide() |
|
62 |
|
63 self.proc = None |
|
64 |
65 |
65 if Preferences.getVCS("AutoClose") and \ |
66 if Preferences.getVCS("AutoClose") and \ |
66 self.normal and \ |
67 self.normal and \ |
67 self.errors.toPlainText() == "": |
68 self.errors.toPlainText() == "": |
68 self.accept() |
69 self.accept() |