eric7/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/HgRebaseDialog.py

branch
eric7
changeset 9028
b3a7f0368163
parent 8881
54e42bc2437a
equal deleted inserted replaced
9027:f259edcf185a 9028:b3a7f0368163
48 self.bookmark1Combo.addItems(sorted(bookmarksList)) 48 self.bookmark1Combo.addItems(sorted(bookmarksList))
49 self.bookmark2Combo.addItems(sorted(bookmarksList)) 49 self.bookmark2Combo.addItems(sorted(bookmarksList))
50 50
51 self.dryRunGroup.setEnabled(version >= (4, 7, 0)) 51 self.dryRunGroup.setEnabled(version >= (4, 7, 0))
52 52
53 # connect various radio buttons and input fields
54 self.id1Button.toggled.connect(self.__updateOK)
55 self.tag1Button.toggled.connect(self.__updateOK)
56 self.branch1Button.toggled.connect(self.__updateOK)
57 self.bookmark1Button.toggled.connect(self.__updateOK)
58 self.expression1Button.toggled.connect(self.__updateOK)
59 self.id2Button.toggled.connect(self.__updateOK)
60 self.tag2Button.toggled.connect(self.__updateOK)
61 self.branch2Button.toggled.connect(self.__updateOK)
62 self.bookmark2Button.toggled.connect(self.__updateOK)
63 self.expression2Button.toggled.connect(self.__updateOK)
64
65 self.id1Edit.textChanged.connect(self.__updateOK)
66 self.expression1Edit.textChanged.connect(self.__updateOK)
67 self.id2Edit.textChanged.connect(self.__updateOK)
68 self.expression2Edit.textChanged.connect(self.__updateOK)
69
70 self.tag1Combo.editTextChanged.connect(self.__updateOK)
71 self.branch1Combo.editTextChanged.connect(self.__updateOK)
72 self.bookmark1Combo.editTextChanged.connect(self.__updateOK)
73 self.tag2Combo.editTextChanged.connect(self.__updateOK)
74 self.branch2Combo.editTextChanged.connect(self.__updateOK)
75 self.bookmark2Combo.editTextChanged.connect(self.__updateOK)
76
53 msh = self.minimumSizeHint() 77 msh = self.minimumSizeHint()
54 self.resize(max(self.width(), msh.width()), msh.height()) 78 self.resize(max(self.width(), msh.width()), msh.height())
55 79
80 @pyqtSlot()
56 def __updateOK(self): 81 def __updateOK(self):
57 """ 82 """
58 Private slot to update the OK button. 83 Private slot to update the OK button.
59 """ 84 """
60 enabled = True 85 enabled = True
61 if not self.parentButton.isChecked(): 86 if not self.parentButton.isChecked():
62 if self.id1Button.isChecked(): 87 if self.id1Button.isChecked():
63 enabled = enabled and self.id1Edit.text() != "" 88 enabled = enabled and bool(self.id1Edit.text())
64 elif self.tag1Button.isChecked(): 89 elif self.tag1Button.isChecked():
65 enabled = enabled and self.tag1Combo.currentText() != "" 90 enabled = enabled and bool(self.tag1Combo.currentText())
66 elif self.branch1Button.isChecked(): 91 elif self.branch1Button.isChecked():
67 enabled = enabled and self.branch1Combo.currentText() != "" 92 enabled = enabled and bool(self.branch1Combo.currentText())
68 elif self.bookmark1Button.isChecked(): 93 elif self.bookmark1Button.isChecked():
69 enabled = enabled and self.bookmark1Combo.currentText() != "" 94 enabled = enabled and bool(self.bookmark1Combo.currentText())
95 elif self.expression1Button.isChecked():
96 enabled = enabled and bool(self.expression1Edit.text())
70 97
71 if self.id2Button.isChecked(): 98 if self.id2Button.isChecked():
72 enabled = enabled and self.id2Edit.text() != "" 99 enabled = enabled and bool(self.id2Edit.text())
73 elif self.tag2Button.isChecked(): 100 elif self.tag2Button.isChecked():
74 enabled = enabled and self.tag2Combo.currentText() != "" 101 enabled = enabled and bool(self.tag2Combo.currentText())
75 elif self.branch2Button.isChecked(): 102 elif self.branch2Button.isChecked():
76 enabled = enabled and self.branch2Combo.currentText() != "" 103 enabled = enabled and bool(self.branch2Combo.currentText())
77 elif self.bookmark2Button.isChecked(): 104 elif self.bookmark2Button.isChecked():
78 enabled = enabled and self.bookmark2Combo.currentText() != "" 105 enabled = enabled and bool(self.bookmark2Combo.currentText())
106 elif self.expression2Button.isChecked():
107 enabled = enabled and bool(self.expression2Edit.text())
79 108
80 self.buttonBox.button( 109 self.buttonBox.button(
81 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) 110 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled)
82
83 @pyqtSlot(bool)
84 def on_id1Button_toggled(self, checked):
85 """
86 Private slot to handle changes of the ID1 select button.
87
88 @param checked state of the button (boolean)
89 """
90 self.__updateOK()
91
92 @pyqtSlot(bool)
93 def on_id2Button_toggled(self, checked):
94 """
95 Private slot to handle changes of the ID2 select button.
96
97 @param checked state of the button (boolean)
98 """
99 self.__updateOK()
100
101 @pyqtSlot(bool)
102 def on_tag1Button_toggled(self, checked):
103 """
104 Private slot to handle changes of the Tag1 select button.
105
106 @param checked state of the button (boolean)
107 """
108 self.__updateOK()
109
110 @pyqtSlot(bool)
111 def on_tag2Button_toggled(self, checked):
112 """
113 Private slot to handle changes of the Tag2 select button.
114
115 @param checked state of the button (boolean)
116 """
117 self.__updateOK()
118
119 @pyqtSlot(bool)
120 def on_branch1Button_toggled(self, checked):
121 """
122 Private slot to handle changes of the Branch1 select button.
123
124 @param checked state of the button (boolean)
125 """
126 self.__updateOK()
127
128 @pyqtSlot(bool)
129 def on_branch2Button_toggled(self, checked):
130 """
131 Private slot to handle changes of the Branch2 select button.
132
133 @param checked state of the button (boolean)
134 """
135 self.__updateOK()
136
137 @pyqtSlot(bool)
138 def on_bookmark1Button_toggled(self, checked):
139 """
140 Private slot to handle changes of the Bookmark1 select button.
141
142 @param checked state of the button (boolean)
143 """
144 self.__updateOK()
145
146 @pyqtSlot(bool)
147 def on_bookmark2Button_toggled(self, checked):
148 """
149 Private slot to handle changes of the Bookmark2 select button.
150
151 @param checked state of the button (boolean)
152 """
153 self.__updateOK()
154
155 @pyqtSlot(str)
156 def on_id1Edit_textChanged(self, txt):
157 """
158 Private slot to handle changes of the ID1 edit.
159
160 @param txt text of the edit (string)
161 """
162 self.__updateOK()
163
164 @pyqtSlot(str)
165 def on_id2Edit_textChanged(self, txt):
166 """
167 Private slot to handle changes of the ID2 edit.
168
169 @param txt text of the edit (string)
170 """
171 self.__updateOK()
172
173 @pyqtSlot(str)
174 def on_tag1Combo_editTextChanged(self, txt):
175 """
176 Private slot to handle changes of the Tag1 combo.
177
178 @param txt text of the combo (string)
179 """
180 self.__updateOK()
181
182 @pyqtSlot(str)
183 def on_tag2Combo_editTextChanged(self, txt):
184 """
185 Private slot to handle changes of the Tag2 combo.
186
187 @param txt text of the combo (string)
188 """
189 self.__updateOK()
190
191 @pyqtSlot(str)
192 def on_branch1Combo_editTextChanged(self, txt):
193 """
194 Private slot to handle changes of the Branch1 combo.
195
196 @param txt text of the combo (string)
197 """
198 self.__updateOK()
199
200 @pyqtSlot(str)
201 def on_branch2Combo_editTextChanged(self, txt):
202 """
203 Private slot to handle changes of the Branch2 combo.
204
205 @param txt text of the combo (string)
206 """
207 self.__updateOK()
208
209 @pyqtSlot(str)
210 def on_bookmark1Combo_editTextChanged(self, txt):
211 """
212 Private slot to handle changes of the Bookmark1 combo.
213
214 @param txt text of the combo (string)
215 """
216 self.__updateOK()
217
218 @pyqtSlot(str)
219 def on_bookmark2Combo_editTextChanged(self, txt):
220 """
221 Private slot to handle changes of the Bookmark2 combo.
222
223 @param txt text of the combo (string)
224 """
225 self.__updateOK()
226 111
227 def __getRevision(self, no): 112 def __getRevision(self, no):
228 """ 113 """
229 Private method to generate the revision. 114 Private method to generate the revision.
230 115
231 @param no revision number to generate (1 or 2) 116 @param no revision number to generate (1 or 2)
232 @return revision (string) 117 @type int
118 @return revision
119 @rtype str
233 """ 120 """
234 if no == 1: 121 if no == 1:
235 numberButton = self.number1Button 122 numberButton = self.number1Button
236 numberSpinBox = self.number1SpinBox 123 numberSpinBox = self.number1SpinBox
237 idButton = self.id1Button 124 idButton = self.id1Button
240 tagCombo = self.tag1Combo 127 tagCombo = self.tag1Combo
241 branchButton = self.branch1Button 128 branchButton = self.branch1Button
242 branchCombo = self.branch1Combo 129 branchCombo = self.branch1Combo
243 bookmarkButton = self.bookmark1Button 130 bookmarkButton = self.bookmark1Button
244 bookmarkCombo = self.bookmark1Combo 131 bookmarkCombo = self.bookmark1Combo
132 expressionButton = self.expression1Button
133 expressionEdit = self.expression1Edit
245 tipButton = None 134 tipButton = None
246 else: 135 else:
247 numberButton = self.number2Button 136 numberButton = self.number2Button
248 numberSpinBox = self.number2SpinBox 137 numberSpinBox = self.number2SpinBox
249 idButton = self.id2Button 138 idButton = self.id2Button
252 tagCombo = self.tag2Combo 141 tagCombo = self.tag2Combo
253 branchButton = self.branch2Button 142 branchButton = self.branch2Button
254 branchCombo = self.branch2Combo 143 branchCombo = self.branch2Combo
255 bookmarkButton = self.bookmark2Button 144 bookmarkButton = self.bookmark2Button
256 bookmarkCombo = self.bookmark2Combo 145 bookmarkCombo = self.bookmark2Combo
146 expressionButton = self.expression2Button
147 expressionEdit = self.expression2Edit
257 tipButton = self.tip2Button 148 tipButton = self.tip2Button
258 149
259 if numberButton.isChecked(): 150 if numberButton.isChecked():
260 return "rev({0})".format(numberSpinBox.value()) 151 return "rev({0})".format(numberSpinBox.value())
261 elif idButton.isChecked(): 152 elif idButton.isChecked():
264 return tagCombo.currentText() 155 return tagCombo.currentText()
265 elif branchButton.isChecked(): 156 elif branchButton.isChecked():
266 return branchCombo.currentText() 157 return branchCombo.currentText()
267 elif bookmarkButton.isChecked(): 158 elif bookmarkButton.isChecked():
268 return bookmarkCombo.currentText() 159 return bookmarkCombo.currentText()
160 elif expressionButton.isChecked():
161 return expressionEdit.text()
269 elif tipButton and tipButton.isChecked(): 162 elif tipButton and tipButton.isChecked():
270 return "" 163 return ""
271 164
272 return "" 165 return ""
273 166

eric ide

mercurial