src/eric7/Plugins/VcsPlugins/vcsMercurial/HgBranchInputDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 15
16 class HgBranchInputDialog(QDialog, Ui_HgBranchInputDialog): 16 class HgBranchInputDialog(QDialog, Ui_HgBranchInputDialog):
17 """ 17 """
18 Class implementing a dialog to enter the data for a branch operation. 18 Class implementing a dialog to enter the data for a branch operation.
19 """ 19 """
20
20 def __init__(self, branches, parent=None): 21 def __init__(self, branches, parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param branches branch names to populate the branch list with 25 @param branches branch names to populate the branch list with
25 (list of string) 26 (list of string)
26 @param parent reference to the parent widget (QWidget) 27 @param parent reference to the parent widget (QWidget)
27 """ 28 """
28 super().__init__(parent) 29 super().__init__(parent)
29 self.setupUi(self) 30 self.setupUi(self)
30 31
31 self.branchComboBox.addItems(sorted(branches)) 32 self.branchComboBox.addItems(sorted(branches))
32 self.branchComboBox.setEditText("") 33 self.branchComboBox.setEditText("")
33 34
34 self.buttonBox.button( 35 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
35 QDialogButtonBox.StandardButton.Ok).setEnabled(False) 36
36
37 msh = self.minimumSizeHint() 37 msh = self.minimumSizeHint()
38 self.resize(max(self.width(), msh.width()), msh.height()) 38 self.resize(max(self.width(), msh.width()), msh.height())
39 39
40 @pyqtSlot(str) 40 @pyqtSlot(str)
41 def on_branchComboBox_editTextChanged(self, txt): 41 def on_branchComboBox_editTextChanged(self, txt):
42 """ 42 """
43 Private slot handling a change of the branch name. 43 Private slot handling a change of the branch name.
44 44
45 @param txt contents of the branch combo box (string) 45 @param txt contents of the branch combo box (string)
46 """ 46 """
47 self.buttonBox.button( 47 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt))
48 QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) 48
49
50 def getData(self): 49 def getData(self):
51 """ 50 """
52 Public method to get the data. 51 Public method to get the data.
53 52
54 @return tuple of branch name, a flag indicating to commit the branch 53 @return tuple of branch name, a flag indicating to commit the branch
55 and a flag indicating to force the branch creation 54 and a flag indicating to force the branch creation
56 @rtype tuple of (str, bool, bool) 55 @rtype tuple of (str, bool, bool)
57 """ 56 """
58 return (self.branchComboBox.currentText().replace(" ", "_"), 57 return (
59 self.commitCheckBox.isChecked(), 58 self.branchComboBox.currentText().replace(" ", "_"),
60 self.forceCheckBox.isChecked()) 59 self.commitCheckBox.isChecked(),
60 self.forceCheckBox.isChecked(),
61 )

eric ide

mercurial