8 """ |
8 """ |
9 |
9 |
10 |
10 |
11 import os |
11 import os |
12 |
12 |
13 from PyQt5.QtCore import QProcess, QTimer, pyqtSlot, Qt, QCoreApplication, \ |
13 from PyQt5.QtCore import ( |
14 QProcessEnvironment |
14 QProcess, QTimer, pyqtSlot, Qt, QCoreApplication, QProcessEnvironment |
|
15 ) |
15 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QLineEdit |
16 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QLineEdit |
16 |
17 |
17 from E5Gui import E5MessageBox |
18 from E5Gui import E5MessageBox |
18 |
19 |
19 from .Ui_HgDialog import Ui_HgDialog |
20 from .Ui_HgDialog import Ui_HgDialog |
65 def __finish(self): |
66 def __finish(self): |
66 """ |
67 """ |
67 Private slot called when the process finished or the user pressed |
68 Private slot called when the process finished or the user pressed |
68 the button. |
69 the button. |
69 """ |
70 """ |
70 if self.process is not None and \ |
71 if ( |
71 self.process.state() != QProcess.NotRunning: |
72 self.process is not None and |
|
73 self.process.state() != QProcess.NotRunning |
|
74 ): |
72 self.process.terminate() |
75 self.process.terminate() |
73 QTimer.singleShot(2000, self.process.kill) |
76 QTimer.singleShot(2000, self.process.kill) |
74 self.process.waitForFinished(3000) |
77 self.process.waitForFinished(3000) |
75 |
78 |
76 self.inputGroup.setEnabled(False) |
79 self.inputGroup.setEnabled(False) |
82 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
85 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
83 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
86 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
84 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
87 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
85 Qt.OtherFocusReason) |
88 Qt.OtherFocusReason) |
86 |
89 |
87 if Preferences.getVCS("AutoClose") and \ |
90 if ( |
88 self.normal and \ |
91 Preferences.getVCS("AutoClose") and |
89 self.errors.toPlainText() == "": |
92 self.normal and |
|
93 self.errors.toPlainText() == "" |
|
94 ): |
90 self.accept() |
95 self.accept() |
91 |
96 |
92 def on_buttonBox_clicked(self, button): |
97 def on_buttonBox_clicked(self, button): |
93 """ |
98 """ |
94 Private slot called by a button of the button box clicked. |
99 Private slot called by a button of the button box clicked. |
128 self.errorGroup.hide() |
133 self.errorGroup.hide() |
129 self.normal = False |
134 self.normal = False |
130 self.intercept = False |
135 self.intercept = False |
131 |
136 |
132 self.__hasAddOrDelete = False |
137 self.__hasAddOrDelete = False |
133 if args[0] in ["fetch", "qpush", "qpop", "qgoto", "rebase", |
138 if ( |
134 "update", "import", "revert", "graft", "shelve", |
139 args[0] in ["fetch", "qpush", "qpop", "qgoto", "rebase", |
135 "unshelve", "strip", "histedit"] or \ |
140 "update", "import", "revert", "graft", "shelve", |
136 (args[0] in ["pull", "unbundle"] and |
141 "unshelve", "strip", "histedit"] or |
137 ("--update" in args[1:] or "--rebase" in args[1:])): |
142 (args[0] in ["pull", "unbundle"] and |
|
143 ("--update" in args[1:] or "--rebase" in args[1:])) |
|
144 ): |
138 self.__updateCommand = True |
145 self.__updateCommand = True |
139 else: |
146 else: |
140 self.__updateCommand = False |
147 self.__updateCommand = False |
141 |
148 |
142 if showArgs: |
149 if showArgs: |