16 class HgPhaseDialog(QDialog, Ui_HgPhaseDialog): |
16 class HgPhaseDialog(QDialog, Ui_HgPhaseDialog): |
17 """ |
17 """ |
18 Class dimplementing a dialog to enter data for the Mercurial Phase |
18 Class dimplementing a dialog to enter data for the Mercurial Phase |
19 operation. |
19 operation. |
20 """ |
20 """ |
|
21 |
21 def __init__(self, parent=None): |
22 def __init__(self, parent=None): |
22 """ |
23 """ |
23 Constructor |
24 Constructor |
24 |
25 |
25 @param parent reference to the parent widget (QWidget) |
26 @param parent reference to the parent widget (QWidget) |
26 """ |
27 """ |
27 super().__init__(parent) |
28 super().__init__(parent) |
28 self.setupUi(self) |
29 self.setupUi(self) |
29 |
30 |
30 self.phaseCombo.addItem("", "") |
31 self.phaseCombo.addItem("", "") |
31 self.phaseCombo.addItem(self.tr("Public"), "p") |
32 self.phaseCombo.addItem(self.tr("Public"), "p") |
32 self.phaseCombo.addItem(self.tr("Draft"), "d") |
33 self.phaseCombo.addItem(self.tr("Draft"), "d") |
33 self.phaseCombo.addItem(self.tr("Secret"), "s") |
34 self.phaseCombo.addItem(self.tr("Secret"), "s") |
34 |
35 |
35 self.buttonBox.button( |
36 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
36 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
37 |
37 |
|
38 def __updateOk(self): |
38 def __updateOk(self): |
39 """ |
39 """ |
40 Private slot to update the state of the OK button. |
40 Private slot to update the state of the OK button. |
41 """ |
41 """ |
42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
43 self.revisionsEdit.toPlainText().strip() != "" and |
43 self.revisionsEdit.toPlainText().strip() != "" |
44 self.phaseCombo.currentText().strip() != "") |
44 and self.phaseCombo.currentText().strip() != "" |
45 |
45 ) |
|
46 |
46 @pyqtSlot() |
47 @pyqtSlot() |
47 def on_revisionsEdit_textChanged(self): |
48 def on_revisionsEdit_textChanged(self): |
48 """ |
49 """ |
49 Private slot to react upon changes of revisions. |
50 Private slot to react upon changes of revisions. |
50 """ |
51 """ |
51 self.__updateOk() |
52 self.__updateOk() |
52 |
53 |
53 @pyqtSlot(int) |
54 @pyqtSlot(int) |
54 def on_phaseCombo_activated(self, index): |
55 def on_phaseCombo_activated(self, index): |
55 """ |
56 """ |
56 Private slot to react upon changes of the phase. |
57 Private slot to react upon changes of the phase. |
57 |
58 |
58 @param index index of the selected entry |
59 @param index index of the selected entry |
59 @type int |
60 @type int |
60 """ |
61 """ |
61 self.__updateOk() |
62 self.__updateOk() |
62 |
63 |
63 def getData(self): |
64 def getData(self): |
64 """ |
65 """ |
65 Public method to retrieve the entered data. |
66 Public method to retrieve the entered data. |
66 |
67 |
67 @return tuple with list of revisions, phase and a flag indicating |
68 @return tuple with list of revisions, phase and a flag indicating |
68 a forced operation (list of strings, string, boolean) |
69 a forced operation (list of strings, string, boolean) |
69 """ |
70 """ |
70 return ( |
71 return ( |
71 self.revisionsEdit.toPlainText().strip().splitlines(), |
72 self.revisionsEdit.toPlainText().strip().splitlines(), |
72 self.phaseCombo.itemData(self.phaseCombo.currentIndex()), |
73 self.phaseCombo.itemData(self.phaseCombo.currentIndex()), |
73 self.forceCheckBox.isChecked() |
74 self.forceCheckBox.isChecked(), |
74 ) |
75 ) |