src/eric7/Plugins/VcsPlugins/vcsGit/GitBranchPushDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 15
16 class GitBranchPushDialog(QDialog, Ui_GitBranchPushDialog): 16 class GitBranchPushDialog(QDialog, Ui_GitBranchPushDialog):
17 """ 17 """
18 Class implementing a dialog to select the data for pushing a branch. 18 Class implementing a dialog to select the data for pushing a branch.
19 """ 19 """
20
20 def __init__(self, branches, remotes, delete=False, parent=None): 21 def __init__(self, branches, remotes, delete=False, parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param branches list of branch names (list of string) 25 @param branches list of branch names (list of string)
25 @param remotes list of remote names (list of string) 26 @param remotes list of remote names (list of string)
26 @param delete flag indicating a delete branch action (boolean) 27 @param delete flag indicating a delete branch action (boolean)
27 @param parent reference to the parent widget (QWidget) 28 @param parent reference to the parent widget (QWidget)
28 """ 29 """
29 super().__init__(parent) 30 super().__init__(parent)
30 self.setupUi(self) 31 self.setupUi(self)
31 32
32 self.__okButton = self.buttonBox.button( 33 self.__okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
33 QDialogButtonBox.StandardButton.Ok) 34
34
35 self.__allBranches = self.tr("<all branches>") 35 self.__allBranches = self.tr("<all branches>")
36 36
37 if "origin" in remotes: 37 if "origin" in remotes:
38 self.remoteComboBox.addItem("origin") 38 self.remoteComboBox.addItem("origin")
39 remotes.remove("origin") 39 remotes.remove("origin")
40 self.remoteComboBox.addItems(sorted(remotes)) 40 self.remoteComboBox.addItems(sorted(remotes))
41 41
42 if delete: 42 if delete:
43 self.branchComboBox.addItem("") 43 self.branchComboBox.addItem("")
44 else: 44 else:
45 self.branchComboBox.addItem(self.__allBranches) 45 self.branchComboBox.addItem(self.__allBranches)
46 if "master" in branches: 46 if "master" in branches:
47 if not delete: 47 if not delete:
48 self.branchComboBox.addItem("master") 48 self.branchComboBox.addItem("master")
49 branches.remove("master") 49 branches.remove("master")
50 self.branchComboBox.addItems(sorted(branches)) 50 self.branchComboBox.addItems(sorted(branches))
51 51
52 if delete: 52 if delete:
53 self.__okButton.setEnabled(False) 53 self.__okButton.setEnabled(False)
54 self.branchComboBox.setEditable(True) 54 self.branchComboBox.setEditable(True)
55 55
56 @pyqtSlot(str) 56 @pyqtSlot(str)
57 def on_branchComboBox_editTextChanged(self, txt): 57 def on_branchComboBox_editTextChanged(self, txt):
58 """ 58 """
59 Private slot to handle a change of the branch name. 59 Private slot to handle a change of the branch name.
60 60
61 @param txt branch name (string) 61 @param txt branch name (string)
62 """ 62 """
63 self.__okButton.setEnabled(bool(txt)) 63 self.__okButton.setEnabled(bool(txt))
64 64
65 def getData(self): 65 def getData(self):
66 """ 66 """
67 Public method to get the selected data. 67 Public method to get the selected data.
68 68
69 @return tuple of selected branch name, remote name and a flag 69 @return tuple of selected branch name, remote name and a flag
70 indicating all branches (tuple of two strings and a boolean) 70 indicating all branches (tuple of two strings and a boolean)
71 """ 71 """
72 return (self.branchComboBox.currentText(), 72 return (
73 self.remoteComboBox.currentText(), 73 self.branchComboBox.currentText(),
74 self.branchComboBox.currentText() == self.__allBranches) 74 self.remoteComboBox.currentText(),
75 self.branchComboBox.currentText() == self.__allBranches,
76 )

eric ide

mercurial