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