--- a/eric7/Plugins/VcsPlugins/vcsMercurial/StripExtension/HgStripDialog.py Sun Apr 17 19:34:09 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/StripExtension/HgStripDialog.py Wed Apr 20 15:00:51 2022 +0200 @@ -42,6 +42,21 @@ self.bookmarkCombo.addItems([""] + sorted(bookmarksList)) self.idEdit.setText(rev) + # connect various radio buttons and input fields + self.numberButton.toggled.connect(self.__updateOK) + self.idButton.toggled.connect(self.__updateOK) + self.tagButton.toggled.connect(self.__updateOK) + self.branchButton.toggled.connect(self.__updateOK) + self.expressionButton.toggled.connect(self.__updateOK) + + self.numberSpinBox.valueChanged.connect(self.__updateOK) + + self.idEdit.textChanged.connect(self.__updateOK) + self.expressionEdit.textChanged.connect(self.__updateOK) + + self.tagCombo.editTextChanged.connect(self.__updateOK) + self.branchCombo.editTextChanged.connect(self.__updateOK) + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -49,6 +64,7 @@ self.idEdit.setFocus() + @pyqtSlot() def __updateOK(self): """ Private slot to update the OK button. @@ -57,95 +73,17 @@ if self.numberButton.isChecked(): enabled = enabled and self.numberSpinBox.value() >= 0 elif self.idButton.isChecked(): - enabled = enabled and self.idEdit.text() != "" + enabled = enabled and bool(self.idEdit.text()) elif self.tagButton.isChecked(): - enabled = enabled and self.tagCombo.currentText() != "" + enabled = enabled and bool(self.tagCombo.currentText()) elif self.branchButton.isChecked(): - enabled = enabled and self.branchCombo.currentText() != "" + enabled = enabled and bool(self.branchCombo.currentText()) + elif self.expressionButton.isChecked(): + enabled = enabled and bool(self.expressionEdit.text()) self.buttonBox.button( QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - @pyqtSlot(bool) - def on_numberButton_toggled(self, checked): - """ - Private slot to handle changes of the Number select button. - - @param checked state of the button - @type bool - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_idButton_toggled(self, checked): - """ - Private slot to handle changes of the ID select button. - - @param checked state of the button - @type bool - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tagButton_toggled(self, checked): - """ - Private slot to handle changes of the Tag select button. - - @param checked state of the button - @type bool - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branchButton_toggled(self, checked): - """ - Private slot to handle changes of the Branch select button. - - @param checked state of the button - @type bool - """ - self.__updateOK() - - @pyqtSlot(int) - def on_numberSpinBox_valueChanged(self, val): - """ - Private slot to handle changes of the Number spin box. - - @param val value of the spin box - @type int - """ - self.__updateOK() - - @pyqtSlot(str) - def on_idEdit_textChanged(self, txt): - """ - Private slot to handle changes of the ID edit. - - @param txt text of the edit - @type str - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tagCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag combo. - - @param txt text of the combo - @type str - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branchCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch combo. - - @param txt text of the combo - @type str - """ - self.__updateOK() - def __getRevision(self): """ Private method to generate the revision. @@ -161,6 +99,8 @@ return self.tagCombo.currentText() elif self.branchButton.isChecked(): return self.branchCombo.currentText() + elif self.expressionButton.isChecked(): + return self.expressionEdit.text() else: # should not happen return ""