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

branch
eric7
changeset 9025
9fe8cfa14542
parent 8881
54e42bc2437a
equal deleted inserted replaced
9024:640778fcd474 9025:9fe8cfa14542
22 def __init__(self, tagsList, branchesList, bookmarksList=None, 22 def __init__(self, tagsList, branchesList, bookmarksList=None,
23 parent=None): 23 parent=None):
24 """ 24 """
25 Constructor 25 Constructor
26 26
27 @param tagsList list of tags (list of strings) 27 @param tagsList list of tags
28 @param branchesList list of branches (list of strings) 28 @type list of str
29 @param bookmarksList list of bookmarks (list of strings) 29 @param branchesList list of branches
30 @param parent reference to the parent widget (QWidget) 30 @type list of str
31 @param bookmarksList list of bookmarks
32 @type list of str
33 @param parent parent widget
34 @type QWidget
31 """ 35 """
32 super().__init__(parent) 36 super().__init__(parent)
33 self.setupUi(self) 37 self.setupUi(self)
34 38
35 self.buttonBox.button( 39 self.buttonBox.button(
46 if bookmarksList is not None: 50 if bookmarksList is not None:
47 self.bookmarkCombo.addItems(sorted(bookmarksList)) 51 self.bookmarkCombo.addItems(sorted(bookmarksList))
48 else: 52 else:
49 self.bookmarkButton.setHidden(True) 53 self.bookmarkButton.setHidden(True)
50 self.bookmarkCombo.setHidden(True) 54 self.bookmarkCombo.setHidden(True)
55
56 # connect various radio buttons and input fields
57 self.idButton.toggled.connect(self.__updateOK)
58 self.tagButton.toggled.connect(self.__updateOK)
59 self.branchButton.toggled.connect(self.__updateOK)
60 self.bookmarkButton.toggled.connect(self.__updateOK)
61 self.expressionButton.toggled.connect(self.__updateOK)
62
63 self.idEdit.textChanged.connect(self.__updateOK)
64 self.expressionEdit.textChanged.connect(self.__updateOK)
65
66 self.tagCombo.editTextChanged.connect(self.__updateOK)
67 self.branchCombo.editTextChanged.connect(self.__updateOK)
68 self.bookmarkCombo.editTextChanged.connect(self.__updateOK)
51 69
70 @pyqtSlot()
52 def __updateOK(self): 71 def __updateOK(self):
53 """ 72 """
54 Private slot to update the OK button. 73 Private slot to update the OK button.
55 """ 74 """
56 enabled = True 75 enabled = True
60 enabled = enabled and self.tagCombo.currentText() != "" 79 enabled = enabled and self.tagCombo.currentText() != ""
61 elif self.branchButton.isChecked(): 80 elif self.branchButton.isChecked():
62 enabled = enabled and self.branchCombo.currentText() != "" 81 enabled = enabled and self.branchCombo.currentText() != ""
63 elif self.bookmarkButton.isChecked(): 82 elif self.bookmarkButton.isChecked():
64 enabled = enabled and self.bookmarkCombo.currentText() != "" 83 enabled = enabled and self.bookmarkCombo.currentText() != ""
84 elif self.expressionButton.isChecked():
85 enabled = enabled and bool(self.expressionEdit.text())
65 86
66 self.buttonBox.button( 87 self.buttonBox.button(
67 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) 88 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled)
68
69 @pyqtSlot(bool)
70 def on_idButton_toggled(self, checked):
71 """
72 Private slot to handle changes of the ID select button.
73
74 @param checked state of the button (boolean)
75 """
76 self.__updateOK()
77
78 @pyqtSlot(bool)
79 def on_tagButton_toggled(self, checked):
80 """
81 Private slot to handle changes of the Tag select button.
82
83 @param checked state of the button (boolean)
84 """
85 self.__updateOK()
86
87 @pyqtSlot(bool)
88 def on_branchButton_toggled(self, checked):
89 """
90 Private slot to handle changes of the Branch select button.
91
92 @param checked state of the button (boolean)
93 """
94 self.__updateOK()
95
96 @pyqtSlot(bool)
97 def on_bookmarkButton_toggled(self, checked):
98 """
99 Private slot to handle changes of the Bookmark select button.
100
101 @param checked state of the button (boolean)
102 """
103 self.__updateOK()
104
105 @pyqtSlot(str)
106 def on_idEdit_textChanged(self, txt):
107 """
108 Private slot to handle changes of the ID edit.
109
110 @param txt text of the edit (string)
111 """
112 self.__updateOK()
113
114 @pyqtSlot(str)
115 def on_tagCombo_editTextChanged(self, txt):
116 """
117 Private slot to handle changes of the Tag combo.
118
119 @param txt text of the combo (string)
120 """
121 self.__updateOK()
122
123 @pyqtSlot(str)
124 def on_branchCombo_editTextChanged(self, txt):
125 """
126 Private slot to handle changes of the Branch combo.
127
128 @param txt text of the combo (string)
129 """
130 self.__updateOK()
131
132 @pyqtSlot(str)
133 def on_bookmarkCombo_editTextChanged(self, txt):
134 """
135 Private slot to handle changes of the Bookmark combo.
136
137 @param txt text of the combo (string)
138 """
139 self.__updateOK()
140 89
141 def getData(self): 90 def getData(self):
142 """ 91 """
143 Public method to retrieve the entered data. 92 Public method to retrieve the entered data.
144 93
145 @return tuple giving the revision, a flag indicating not to commit 94 @return tuple giving the revision, a flag indicating not to commit
146 the signature, a commit message, an ID of the key to be used, 95 the signature, a commit message, an ID of the key to be used,
147 a flag indicating a local signature and a flag indicating a forced 96 a flag indicating a local signature and a flag indicating a forced
148 signature (string, boolean, string, string, boolean, boolean) 97 signature
98 @rtype tuple of (str, bool, str, str, bool, bool)
149 """ 99 """
150 if self.numberButton.isChecked(): 100 if self.numberButton.isChecked():
151 rev = str(self.numberSpinBox.value()) 101 rev = str(self.numberSpinBox.value())
152 elif self.idButton.isChecked(): 102 elif self.idButton.isChecked():
153 rev = self.idEdit.text() 103 rev = self.idEdit.text()
155 rev = self.tagCombo.currentText() 105 rev = self.tagCombo.currentText()
156 elif self.branchButton.isChecked(): 106 elif self.branchButton.isChecked():
157 rev = self.branchCombo.currentText() 107 rev = self.branchCombo.currentText()
158 elif self.bookmarkButton.isChecked(): 108 elif self.bookmarkButton.isChecked():
159 rev = self.bookmarkCombo.currentText() 109 rev = self.bookmarkCombo.currentText()
110 elif self.expressionButton.isChecked():
111 rev = self.expressionEdit.text()
160 else: 112 else:
161 rev = "" 113 rev = ""
162 114
163 return ( 115 return (
164 rev, 116 rev,

eric ide

mercurial