--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitRevisionsSelectionDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitRevisionsSelectionDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -18,28 +18,28 @@ Class implementing a dialog to enter the revisions for the git diff command. """ + def __init__(self, tagsList, branchesList, parent=None): """ Constructor - + @param tagsList list of tags (list of strings) @param branchesList list of branches (list of strings) @param parent parent widget of the dialog (QWidget) """ super().__init__(parent) self.setupUi(self) - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(False) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) + self.tag1Combo.addItems(sorted(tagsList)) self.tag2Combo.addItems(sorted(tagsList)) self.branch1Combo.addItems(["master"] + sorted(branchesList)) self.branch2Combo.addItems(["master"] + sorted(branchesList)) - + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - + def __updateOK(self): """ Private slot to update the OK button. @@ -51,129 +51,128 @@ enabled = enabled and self.tag1Combo.currentText() != "" elif self.branch1Button.isChecked(): enabled = enabled and self.branch1Combo.currentText() != "" - + if self.rev2Button.isChecked(): enabled = enabled and self.rev2Edit.text() != "" elif self.tag2Button.isChecked(): enabled = enabled and self.tag2Combo.currentText() != "" elif self.branch2Button.isChecked(): enabled = enabled and self.branch2Combo.currentText() != "" - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) + @pyqtSlot(bool) def on_rev1Button_toggled(self, checked): """ Private slot to handle changes of the rev1 select button. - + @param checked state of the button (boolean) """ self.__updateOK() - + @pyqtSlot(bool) def on_rev2Button_toggled(self, checked): """ Private slot to handle changes of the rev2 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(str) def on_rev1Edit_textChanged(self, txt): """ Private slot to handle changes of the rev1 edit. - + @param txt text of the edit (string) """ self.__updateOK() - + @pyqtSlot(str) def on_rev2Edit_textChanged(self, txt): """ Private slot to handle changes of the rev2 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() - + def __getRevision(self, no): """ Private method to generate the revision. - + @param no revision number to generate (1 or 2) @return revision (string) """ @@ -197,7 +196,7 @@ tipButton = self.tip2Button prevButton = self.prev2Button noneButton = self.none2Button - + if revButton.isChecked(): return revEdit.text() elif tagButton.isChecked(): @@ -210,16 +209,16 @@ return "HEAD^" elif noneButton.isChecked(): return "" - + return "" - + def getRevisions(self): """ Public method to get the revisions. - + @return list of two revisions (list of strings) """ rev1 = self.__getRevision(1) rev2 = self.__getRevision(2) - + return [rev1, rev2]