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

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to enter the data for a branch operation.
8 """
9
10 from PyQt6.QtCore import pyqtSlot
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
12
13 from .Ui_HgBranchInputDialog import Ui_HgBranchInputDialog
14
15
16 class HgBranchInputDialog(QDialog, Ui_HgBranchInputDialog):
17 """
18 Class implementing a dialog to enter the data for a branch operation.
19 """
20 def __init__(self, branches, parent=None):
21 """
22 Constructor
23
24 @param branches branch names to populate the branch list with
25 (list of string)
26 @param parent reference to the parent widget (QWidget)
27 """
28 super().__init__(parent)
29 self.setupUi(self)
30
31 self.branchComboBox.addItems(sorted(branches))
32 self.branchComboBox.setEditText("")
33
34 self.buttonBox.button(
35 QDialogButtonBox.StandardButton.Ok).setEnabled(False)
36
37 msh = self.minimumSizeHint()
38 self.resize(max(self.width(), msh.width()), msh.height())
39
40 @pyqtSlot(str)
41 def on_branchComboBox_editTextChanged(self, txt):
42 """
43 Private slot handling a change of the branch name.
44
45 @param txt contents of the branch combo box (string)
46 """
47 self.buttonBox.button(
48 QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt))
49
50 def getData(self):
51 """
52 Public method to get the data.
53
54 @return tuple of branch name, a flag indicating to commit the branch
55 and a flag indicating to force the branch creation
56 @rtype tuple of (str, bool, bool)
57 """
58 return (self.branchComboBox.currentText().replace(" ", "_"),
59 self.commitCheckBox.isChecked(),
60 self.forceCheckBox.isChecked())

eric ide

mercurial