8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtCore import pyqtSlot, QProcess, Qt, QTimer, QCoreApplication |
12 from PyQt4.QtCore import pyqtSlot, QProcess, Qt, QTimer, QCoreApplication |
13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, QTreeWidgetItem, \ |
13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, \ |
14 QLineEdit |
14 QTreeWidgetItem, QLineEdit |
15 |
15 |
16 from E5Gui import E5MessageBox |
16 from E5Gui import E5MessageBox |
17 |
17 |
18 from .Ui_HgQueuesListDialog import Ui_HgQueuesListDialog |
18 from .Ui_HgQueuesListDialog import Ui_HgQueuesListDialog |
19 |
19 |
20 import Preferences |
20 import Preferences |
21 |
21 |
22 |
22 |
23 class HgQueuesListDialog(QDialog, Ui_HgQueuesListDialog): |
23 class HgQueuesListDialog(QDialog, Ui_HgQueuesListDialog): |
24 """ |
24 """ |
25 Class implementing a dialog to show a list of applied and unapplied patches. |
25 Class implementing a dialog to show a list of applied and unapplied |
|
26 patches. |
26 """ |
27 """ |
27 def __init__(self, vcs, parent=None): |
28 def __init__(self, vcs, parent=None): |
28 """ |
29 """ |
29 Constructor |
30 Constructor |
30 |
31 |
98 self.__repodir = repodir |
99 self.__repodir = repodir |
99 self.__getSeries() |
100 self.__getSeries() |
100 |
101 |
101 def __getSeries(self, missing=False): |
102 def __getSeries(self, missing=False): |
102 """ |
103 """ |
103 Private slot to get the list of applied, unapplied and guarded patches and |
104 Private slot to get the list of applied, unapplied and guarded patches |
104 patches missing in the series file. |
105 and patches missing in the series file. |
105 |
106 |
106 @param missing flag indicating to get the patches missing in the series file |
107 @param missing flag indicating to get the patches missing in the |
107 (boolean) |
108 series file (boolean) |
108 """ |
109 """ |
109 if missing: |
110 if missing: |
110 self.__mode = "missing" |
111 self.__mode = "missing" |
111 else: |
112 else: |
112 self.__mode = "qseries" |
113 self.__mode = "qseries" |
197 self.inputGroup.setEnabled(True) |
198 self.inputGroup.setEnabled(True) |
198 self.inputGroup.show() |
199 self.inputGroup.show() |
199 |
200 |
200 def __finish(self): |
201 def __finish(self): |
201 """ |
202 """ |
202 Private slot called when the process finished or the user pressed the button. |
203 Private slot called when the process finished or the user pressed |
|
204 the button. |
203 """ |
205 """ |
204 if self.process is not None and \ |
206 if self.process is not None and \ |
205 self.process.state() != QProcess.NotRunning: |
207 self.process.state() != QProcess.NotRunning: |
206 self.process.terminate() |
208 self.process.terminate() |
207 QTimer.singleShot(2000, self.process.kill) |
209 QTimer.singleShot(2000, self.process.kill) |
211 self.inputGroup.hide() |
213 self.inputGroup.hide() |
212 |
214 |
213 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
215 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
214 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
216 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
215 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
217 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
216 self.buttonBox.button(QDialogButtonBox.Close).setFocus(Qt.OtherFocusReason) |
218 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
|
219 Qt.OtherFocusReason) |
217 |
220 |
218 self.process = None |
221 self.process = None |
219 |
222 |
220 if self.patchesList.topLevelItemCount() == 0: |
223 if self.patchesList.topLevelItemCount() == 0: |
221 # no patches present |
224 # no patches present |
222 self.__generateItem(0, "", self.trUtf8("no patches found"), "", True) |
225 self.__generateItem( |
|
226 0, "", self.trUtf8("no patches found"), "", True) |
223 self.__resizeColumns() |
227 self.__resizeColumns() |
224 self.__resort() |
228 self.__resort() |
225 |
229 |
226 def on_buttonBox_clicked(self, button): |
230 def on_buttonBox_clicked(self, button): |
227 """ |
231 """ |