Plugins/VcsPlugins/vcsMercurial/HgBranchInputDialog.py

changeset 3353
ddc966a494b0
child 3366
6084bb3c3911
equal deleted inserted replaced
3352:4b7fb52459ce 3353:ddc966a494b0
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 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 PyQt4.QtCore import pyqtSlot
11 from PyQt4.QtGui 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(QDialogButtonBox.Ok).setEnabled(False)
35
36 self.resize(self.width(), self.minimumSizeHint().height())
37
38 @pyqtSlot(str)
39 def on_branchComboBox_editTextChanged(self, txt):
40 """
41 Private slot handling a change of the branch name.
42
43 @param txt contents of the branch combo box (string)
44 """
45 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt))
46
47 def getData(self):
48 """
49 Public method to get the data.
50
51 @return tuple of branch name (string) and a flag indicating to
52 commit the branch (boolean)
53 """
54 return (self.branchComboBox.currentText(),
55 self.commitCheckBox.isChecked())

eric ide

mercurial