src/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
17 17
18 class HgGpgSignDialog(QDialog, Ui_HgGpgSignDialog): 18 class HgGpgSignDialog(QDialog, Ui_HgGpgSignDialog):
19 """ 19 """
20 Class implementing a dialog to enter data for signing a revision. 20 Class implementing a dialog to enter data for signing a revision.
21 """ 21 """
22 def __init__(self, tagsList, branchesList, bookmarksList=None, 22
23 parent=None): 23 def __init__(self, tagsList, branchesList, bookmarksList=None, parent=None):
24 """ 24 """
25 Constructor 25 Constructor
26 26
27 @param tagsList list of tags 27 @param tagsList list of tags
28 @type list of str 28 @type list of str
29 @param branchesList list of branches 29 @param branchesList list of branches
30 @type list of str 30 @type list of str
31 @param bookmarksList list of bookmarks 31 @param bookmarksList list of bookmarks
33 @param parent parent widget 33 @param parent parent widget
34 @type QWidget 34 @type QWidget
35 """ 35 """
36 super().__init__(parent) 36 super().__init__(parent)
37 self.setupUi(self) 37 self.setupUi(self)
38 38
39 self.buttonBox.button( 39 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
40 QDialogButtonBox.StandardButton.Ok).setEnabled(False) 40
41
42 project = ericApp().getObject("Project") 41 project = ericApp().getObject("Project")
43 pwl, pel = project.getProjectDictionaries() 42 pwl, pel = project.getProjectDictionaries()
44 language = project.getProjectSpellLanguage() 43 language = project.getProjectSpellLanguage()
45 self.messageEdit.setLanguageWithPWL( 44 self.messageEdit.setLanguageWithPWL(language, pwl or None, pel or None)
46 language, pwl or None, pel or None) 45
47
48 self.tagCombo.addItems(sorted(tagsList)) 46 self.tagCombo.addItems(sorted(tagsList))
49 self.branchCombo.addItems(["default"] + sorted(branchesList)) 47 self.branchCombo.addItems(["default"] + sorted(branchesList))
50 if bookmarksList is not None: 48 if bookmarksList is not None:
51 self.bookmarkCombo.addItems(sorted(bookmarksList)) 49 self.bookmarkCombo.addItems(sorted(bookmarksList))
52 else: 50 else:
53 self.bookmarkButton.setHidden(True) 51 self.bookmarkButton.setHidden(True)
54 self.bookmarkCombo.setHidden(True) 52 self.bookmarkCombo.setHidden(True)
55 53
56 # connect various radio buttons and input fields 54 # connect various radio buttons and input fields
57 self.idButton.toggled.connect(self.__updateOK) 55 self.idButton.toggled.connect(self.__updateOK)
58 self.tagButton.toggled.connect(self.__updateOK) 56 self.tagButton.toggled.connect(self.__updateOK)
59 self.branchButton.toggled.connect(self.__updateOK) 57 self.branchButton.toggled.connect(self.__updateOK)
60 self.bookmarkButton.toggled.connect(self.__updateOK) 58 self.bookmarkButton.toggled.connect(self.__updateOK)
61 self.expressionButton.toggled.connect(self.__updateOK) 59 self.expressionButton.toggled.connect(self.__updateOK)
62 60
63 self.idEdit.textChanged.connect(self.__updateOK) 61 self.idEdit.textChanged.connect(self.__updateOK)
64 self.expressionEdit.textChanged.connect(self.__updateOK) 62 self.expressionEdit.textChanged.connect(self.__updateOK)
65 63
66 self.tagCombo.editTextChanged.connect(self.__updateOK) 64 self.tagCombo.editTextChanged.connect(self.__updateOK)
67 self.branchCombo.editTextChanged.connect(self.__updateOK) 65 self.branchCombo.editTextChanged.connect(self.__updateOK)
68 self.bookmarkCombo.editTextChanged.connect(self.__updateOK) 66 self.bookmarkCombo.editTextChanged.connect(self.__updateOK)
69 67
70 @pyqtSlot() 68 @pyqtSlot()
71 def __updateOK(self): 69 def __updateOK(self):
72 """ 70 """
73 Private slot to update the OK button. 71 Private slot to update the OK button.
74 """ 72 """
81 enabled = enabled and self.branchCombo.currentText() != "" 79 enabled = enabled and self.branchCombo.currentText() != ""
82 elif self.bookmarkButton.isChecked(): 80 elif self.bookmarkButton.isChecked():
83 enabled = enabled and self.bookmarkCombo.currentText() != "" 81 enabled = enabled and self.bookmarkCombo.currentText() != ""
84 elif self.expressionButton.isChecked(): 82 elif self.expressionButton.isChecked():
85 enabled = enabled and bool(self.expressionEdit.text()) 83 enabled = enabled and bool(self.expressionEdit.text())
86 84
87 self.buttonBox.button( 85 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enabled)
88 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) 86
89
90 def getData(self): 87 def getData(self):
91 """ 88 """
92 Public method to retrieve the entered data. 89 Public method to retrieve the entered data.
93 90
94 @return tuple giving the revision, a flag indicating not to commit 91 @return tuple giving the revision, a flag indicating not to commit
95 the signature, a commit message, an ID of the key to be used, 92 the signature, a commit message, an ID of the key to be used,
96 a flag indicating a local signature and a flag indicating a forced 93 a flag indicating a local signature and a flag indicating a forced
97 signature 94 signature
98 @rtype tuple of (str, bool, str, str, bool, bool) 95 @rtype tuple of (str, bool, str, str, bool, bool)
109 rev = self.bookmarkCombo.currentText() 106 rev = self.bookmarkCombo.currentText()
110 elif self.expressionButton.isChecked(): 107 elif self.expressionButton.isChecked():
111 rev = self.expressionEdit.text() 108 rev = self.expressionEdit.text()
112 else: 109 else:
113 rev = "" 110 rev = ""
114 111
115 return ( 112 return (
116 rev, 113 rev,
117 self.nocommitCheckBox.isChecked(), 114 self.nocommitCheckBox.isChecked(),
118 self.messageEdit.toPlainText(), 115 self.messageEdit.toPlainText(),
119 self.keyEdit.text(), 116 self.keyEdit.text(),
120 self.localCheckBox.isChecked(), 117 self.localCheckBox.isChecked(),
121 self.forceCheckBox.isChecked() 118 self.forceCheckBox.isChecked(),
122 ) 119 )

eric ide

mercurial