--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitBranchDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitBranchDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -17,6 +17,7 @@ """ Class implementing a dialog to enter the data for a branching operation. """ + CreateBranch = 1 DeleteBranch = 2 RenameBranch = 3 @@ -24,12 +25,13 @@ CreateTrackingBranch = 5 SetTrackingBranch = 6 UnsetTrackingBranch = 7 - - def __init__(self, branchlist, revision=None, branchName=None, - branchOp=None, parent=None): + + def __init__( + self, branchlist, revision=None, branchName=None, branchOp=None, parent=None + ): """ Constructor - + @param branchlist list of previously entered branches (list of strings) @param revision revision to set tag for (string) @param branchName name of the branch (string) @@ -38,26 +40,23 @@ """ super().__init__(parent) self.setupUi(self) - - self.okButton = self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok) + + self.okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) - - self.__remoteBranches = [b for b in branchlist - if b.startswith("remotes/")] - self.__lokalBranches = [b for b in branchlist - if not b.startswith("remotes/")] - + + self.__remoteBranches = [b for b in branchlist if b.startswith("remotes/")] + self.__lokalBranches = [b for b in branchlist if not b.startswith("remotes/")] + self.branchCombo.clear() self.branchCombo.addItem("") self.branchCombo.addItems(sorted(self.__lokalBranches)) - + self.remoteBranchCombo.clear() self.remoteBranchCombo.addItems(sorted(self.__remoteBranches)) - + if revision: self.revisionEdit.setText(revision) - + if branchName: index = self.branchCombo.findText(branchName) if index > -1: @@ -67,7 +66,7 @@ else: self.branchCombo.setEditText(branchName) self.createBranchButton.setChecked(True) - + if branchOp: if branchOp == GitBranchDialog.CreateBranch: self.createBranchButton.setChecked(True) @@ -86,31 +85,28 @@ else: # Oops, fall back to a save default self.createBranchButton.setChecked(True) - + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - + def __updateOK(self): """ Private method used to enable/disable the OK-button. """ - if ( - self.setTrackingButton.isChecked() or - self.unsetTrackingButton.isChecked() - ): + if self.setTrackingButton.isChecked() or self.unsetTrackingButton.isChecked(): enable = True else: enable = self.branchCombo.currentText() != "" if self.moveBranchButton.isChecked(): enable &= self.newBranchNameEdit.text() != "" - + self.okButton.setEnabled(enable) - + @pyqtSlot(bool) def on_createTrackingButton_toggled(self, checked): """ Private slot to handle the selection of creating a tracking branch. - + @param checked state of the selection (boolean) """ self.branchCombo.setEditable(not checked) @@ -121,53 +117,53 @@ self.branchCombo.addItem("") self.branchCombo.addItems(sorted(self.__lokalBranches)) self.__updateOK() - + @pyqtSlot(bool) def on_setTrackingButton_toggled(self, checked): """ Private slot to handle the selection of setting a tracking branch. - + @param checked state of the selection (boolean) """ self.__updateOK() - + @pyqtSlot(bool) def on_unsetTrackingButton_toggled(self, checked): """ Private slot to handle the selection of unsetting a tracking branch. - + @param checked state of the selection (boolean) """ self.__updateOK() - + @pyqtSlot(str) def on_branchCombo_editTextChanged(self, text): """ Private slot to handle a change of the branch. - + @param text branch name entered in the combo (string) """ self.__updateOK() - + @pyqtSlot(str) def on_newBranchNameEdit_textChanged(self, text): """ Private slot to handle a change of the new branch. - + @param text new branch name entered (string) """ self.__updateOK() - + def getParameters(self): """ Public method to retrieve the branch data. - + @return tuple of an int, four strings and a boolean (branch operation, branch name, revision, new branch name, remote branch name, enforce operation) """ branch = self.branchCombo.currentText().replace(" ", "_") - + if self.createBranchButton.isChecked(): branchOp = GitBranchDialog.CreateBranch elif self.deleteBranchButton.isChecked(): @@ -182,8 +178,12 @@ branchOp = GitBranchDialog.SetTrackingBranch else: branchOp = GitBranchDialog.UnsetTrackingBranch - - return (branchOp, branch, self.revisionEdit.text(), - self.newBranchNameEdit.text(), - self.remoteBranchCombo.currentText(), - self.forceCheckBox.isChecked()) + + return ( + branchOp, + branch, + self.revisionEdit.text(), + self.newBranchNameEdit.text(), + self.remoteBranchCombo.currentText(), + self.forceCheckBox.isChecked(), + )