eric6/Plugins/VcsPlugins/vcsMercurial/HgPhaseDialog.py

Wed, 30 Dec 2020 11:00:05 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:05 +0100
changeset 7923
91e843545d9a
parent 7780
41420f82c0ac
child 8143
2c730d5fd177
permissions
-rw-r--r--

Updated copyright for 2021.

1608
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2012 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
1608
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter data for the Mercurial Phase operation.
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
10 from PyQt5.QtCore import pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
1608
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_HgPhaseDialog import Ui_HgPhaseDialog
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 class HgPhaseDialog(QDialog, Ui_HgPhaseDialog):
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
18 Class dimplementing a dialog to enter data for the Mercurial Phase
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
19 operation.
1608
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 def __init__(self, parent=None):
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param parent reference to the parent widget (QWidget)
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
27 super(HgPhaseDialog, self).__init__(parent)
1608
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 self.setupUi(self)
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.phaseCombo.addItem("", "")
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
31 self.phaseCombo.addItem(self.tr("Public"), "p")
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
32 self.phaseCombo.addItem(self.tr("Draft"), "d")
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
33 self.phaseCombo.addItem(self.tr("Secret"), "s")
1608
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 def __updateOk(self):
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 Private slot to update the state of the OK button.
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.revisionsEdit.toPlainText().strip() != "" and
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.phaseCombo.currentText().strip() != "")
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 @pyqtSlot()
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 def on_revisionsEdit_textChanged(self):
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 Private slot to react upon changes of revisions.
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.__updateOk()
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 @pyqtSlot(str)
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 def on_phaseCombo_activated(self, txt):
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 Private slot to react upon changes of the phase.
2962
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
56
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
57 @param txt activated entry (string)
1608
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.__updateOk()
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 def getData(self):
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 Public method to retrieve the entered data.
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 @return tuple with list of revisions, phase and a flag indicating
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 a forced operation (list of strings, string, boolean)
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 return (
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.revisionsEdit.toPlainText().strip().splitlines(),
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.phaseCombo.itemData(self.phaseCombo.currentIndex()),
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.forceCheckBox.isChecked()
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 )

eric ide

mercurial