13 except NameError: |
13 except NameError: |
14 pass |
14 pass |
15 |
15 |
16 import os |
16 import os |
17 |
17 |
18 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QCoreApplication |
18 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QCoreApplication |
19 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton, \ |
19 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton, \ |
20 QListWidgetItem |
20 QListWidgetItem |
21 |
21 |
22 from E5Gui import E5MessageBox |
22 from E5Gui import E5MessageBox |
23 |
23 |
40 @param parent reference to the parent widget (QWidget) |
40 @param parent reference to the parent widget (QWidget) |
41 """ |
41 """ |
42 super(HgQueuesDefineGuardsDialog, self).__init__(parent) |
42 super(HgQueuesDefineGuardsDialog, self).__init__(parent) |
43 self.setupUi(self) |
43 self.setupUi(self) |
44 |
44 |
45 self.process = None |
|
46 self.vcs = vcs |
45 self.vcs = vcs |
47 self.extension = extension |
46 self.extension = extension |
48 self.__hgClient = vcs.getClient() |
47 self.__hgClient = vcs.getClient() |
49 |
48 |
50 self.__patches = patchesList[:] |
49 self.__patches = patchesList[:] |
66 @param e close event (QCloseEvent) |
65 @param e close event (QCloseEvent) |
67 """ |
66 """ |
68 if self.__hgClient: |
67 if self.__hgClient: |
69 if self.__hgClient.isExecuting(): |
68 if self.__hgClient.isExecuting(): |
70 self.__hgClient.cancel() |
69 self.__hgClient.cancel() |
71 else: |
|
72 if self.process is not None and \ |
|
73 self.process.state() != QProcess.NotRunning: |
|
74 self.process.terminate() |
|
75 QTimer.singleShot(2000, self.process.kill) |
|
76 self.process.waitForFinished(3000) |
|
77 |
70 |
78 if self.__dirtyList: |
71 if self.__dirtyList: |
79 res = E5MessageBox.question( |
72 res = E5MessageBox.question( |
80 self, |
73 self, |
81 self.tr("Unsaved Changes"), |
74 self.tr("Unsaved Changes"), |