diff -r f259edcf185a -r b3a7f0368163 eric7/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/HgRebaseDialog.py --- a/eric7/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/HgRebaseDialog.py Sun Apr 17 19:34:09 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/HgRebaseDialog.py Wed Apr 20 15:00:51 2022 +0200 @@ -50,9 +50,34 @@ self.dryRunGroup.setEnabled(version >= (4, 7, 0)) + # connect various radio buttons and input fields + self.id1Button.toggled.connect(self.__updateOK) + self.tag1Button.toggled.connect(self.__updateOK) + self.branch1Button.toggled.connect(self.__updateOK) + self.bookmark1Button.toggled.connect(self.__updateOK) + self.expression1Button.toggled.connect(self.__updateOK) + self.id2Button.toggled.connect(self.__updateOK) + self.tag2Button.toggled.connect(self.__updateOK) + self.branch2Button.toggled.connect(self.__updateOK) + self.bookmark2Button.toggled.connect(self.__updateOK) + self.expression2Button.toggled.connect(self.__updateOK) + + self.id1Edit.textChanged.connect(self.__updateOK) + self.expression1Edit.textChanged.connect(self.__updateOK) + self.id2Edit.textChanged.connect(self.__updateOK) + self.expression2Edit.textChanged.connect(self.__updateOK) + + self.tag1Combo.editTextChanged.connect(self.__updateOK) + self.branch1Combo.editTextChanged.connect(self.__updateOK) + self.bookmark1Combo.editTextChanged.connect(self.__updateOK) + self.tag2Combo.editTextChanged.connect(self.__updateOK) + self.branch2Combo.editTextChanged.connect(self.__updateOK) + self.bookmark2Combo.editTextChanged.connect(self.__updateOK) + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) + @pyqtSlot() def __updateOK(self): """ Private slot to update the OK button. @@ -60,176 +85,38 @@ enabled = True if not self.parentButton.isChecked(): if self.id1Button.isChecked(): - enabled = enabled and self.id1Edit.text() != "" + enabled = enabled and bool(self.id1Edit.text()) elif self.tag1Button.isChecked(): - enabled = enabled and self.tag1Combo.currentText() != "" + enabled = enabled and bool(self.tag1Combo.currentText()) elif self.branch1Button.isChecked(): - enabled = enabled and self.branch1Combo.currentText() != "" + enabled = enabled and bool(self.branch1Combo.currentText()) elif self.bookmark1Button.isChecked(): - enabled = enabled and self.bookmark1Combo.currentText() != "" + enabled = enabled and bool(self.bookmark1Combo.currentText()) + elif self.expression1Button.isChecked(): + enabled = enabled and bool(self.expression1Edit.text()) if self.id2Button.isChecked(): - enabled = enabled and self.id2Edit.text() != "" + enabled = enabled and bool(self.id2Edit.text()) elif self.tag2Button.isChecked(): - enabled = enabled and self.tag2Combo.currentText() != "" + enabled = enabled and bool(self.tag2Combo.currentText()) elif self.branch2Button.isChecked(): - enabled = enabled and self.branch2Combo.currentText() != "" + enabled = enabled and bool(self.branch2Combo.currentText()) elif self.bookmark2Button.isChecked(): - enabled = enabled and self.bookmark2Combo.currentText() != "" + enabled = enabled and bool(self.bookmark2Combo.currentText()) + elif self.expression2Button.isChecked(): + enabled = enabled and bool(self.expression2Edit.text()) self.buttonBox.button( QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - @pyqtSlot(bool) - def on_id1Button_toggled(self, checked): - """ - Private slot to handle changes of the ID1 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_id2Button_toggled(self, checked): - """ - Private slot to handle changes of the ID2 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tag1Button_toggled(self, checked): - """ - Private slot to handle changes of the Tag1 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tag2Button_toggled(self, checked): - """ - Private slot to handle changes of the Tag2 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branch1Button_toggled(self, checked): - """ - Private slot to handle changes of the Branch1 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branch2Button_toggled(self, checked): - """ - Private slot to handle changes of the Branch2 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmark1Button_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark1 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmark2Button_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark2 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_id1Edit_textChanged(self, txt): - """ - Private slot to handle changes of the ID1 edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_id2Edit_textChanged(self, txt): - """ - Private slot to handle changes of the ID2 edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tag1Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag1 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tag2Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag2 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branch1Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch1 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branch2Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch2 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmark1Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark1 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmark2Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark2 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - def __getRevision(self, no): """ Private method to generate the revision. @param no revision number to generate (1 or 2) - @return revision (string) + @type int + @return revision + @rtype str """ if no == 1: numberButton = self.number1Button @@ -242,6 +129,8 @@ branchCombo = self.branch1Combo bookmarkButton = self.bookmark1Button bookmarkCombo = self.bookmark1Combo + expressionButton = self.expression1Button + expressionEdit = self.expression1Edit tipButton = None else: numberButton = self.number2Button @@ -254,6 +143,8 @@ branchCombo = self.branch2Combo bookmarkButton = self.bookmark2Button bookmarkCombo = self.bookmark2Combo + expressionButton = self.expression2Button + expressionEdit = self.expression2Edit tipButton = self.tip2Button if numberButton.isChecked(): @@ -266,6 +157,8 @@ return branchCombo.currentText() elif bookmarkButton.isChecked(): return bookmarkCombo.currentText() + elif expressionButton.isChecked(): + return expressionEdit.text() elif tipButton and tipButton.isChecked(): return ""