eric6/Plugins/VcsPlugins/vcsMercurial/HgPhaseDialog.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2012 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to enter data for the Mercurial Phase operation.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtCore import pyqtSlot
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
14
15 from .Ui_HgPhaseDialog import Ui_HgPhaseDialog
16
17
18 class HgPhaseDialog(QDialog, Ui_HgPhaseDialog):
19 """
20 Class dimplementing a dialog to enter data for the Mercurial Phase
21 operation.
22 """
23 def __init__(self, parent=None):
24 """
25 Constructor
26
27 @param parent reference to the parent widget (QWidget)
28 """
29 super(HgPhaseDialog, self).__init__(parent)
30 self.setupUi(self)
31
32 self.phaseCombo.addItem("", "")
33 self.phaseCombo.addItem(self.tr("Public"), "p")
34 self.phaseCombo.addItem(self.tr("Draft"), "d")
35 self.phaseCombo.addItem(self.tr("Secret"), "s")
36
37 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
38
39 def __updateOk(self):
40 """
41 Private slot to update the state of the OK button.
42 """
43 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
44 self.revisionsEdit.toPlainText().strip() != "" and
45 self.phaseCombo.currentText().strip() != "")
46
47 @pyqtSlot()
48 def on_revisionsEdit_textChanged(self):
49 """
50 Private slot to react upon changes of revisions.
51 """
52 self.__updateOk()
53
54 @pyqtSlot(str)
55 def on_phaseCombo_activated(self, txt):
56 """
57 Private slot to react upon changes of the phase.
58
59 @param txt activated entry (string)
60 """
61 self.__updateOk()
62
63 def getData(self):
64 """
65 Public method to retrieve the entered data.
66
67 @return tuple with list of revisions, phase and a flag indicating
68 a forced operation (list of strings, string, boolean)
69 """
70 return (
71 self.revisionsEdit.toPlainText().strip().splitlines(),
72 self.phaseCombo.itemData(self.phaseCombo.currentIndex()),
73 self.forceCheckBox.isChecked()
74 )

eric ide

mercurial