Tue, 02 Mar 2021 17:17:09 +0100
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
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 | |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
35 | self.buttonBox.button( |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
36 | QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
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
|
37 | |
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 | 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
|
39 | """ |
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 | 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
|
41 | """ |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
42 | self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
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
|
43 | 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
|
44 | 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
|
45 | |
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 | @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
|
47 | 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
|
48 | """ |
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 | 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
|
50 | """ |
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 | 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
|
52 | |
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 | @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
|
54 | 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
|
55 | """ |
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
|
56 | 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
|
57 | |
d6c9d1ca2da4
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
58 | @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
|
59 | """ |
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 | 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
|
61 | |
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 | 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
|
63 | """ |
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 | 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
|
65 | |
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 | @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
|
67 | 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
|
68 | """ |
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 | 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
|
70 | 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
|
71 | 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
|
72 | 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
|
73 | ) |