eric6/Plugins/VcsPlugins/vcsMercurial/HgBranchInputDialog.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 - 2019 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 __future__ import unicode_literals
11
12 from PyQt5.QtCore import pyqtSlot
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
14
15 from .Ui_HgBranchInputDialog import Ui_HgBranchInputDialog
16
17
18 class HgBranchInputDialog(QDialog, Ui_HgBranchInputDialog):
19 """
20 Class implementing a dialog to enter the data for a branch operation.
21 """
22 def __init__(self, branches, parent=None):
23 """
24 Constructor
25
26 @param branches branch names to populate the branch list with
27 (list of string)
28 @param parent reference to the parent widget (QWidget)
29 """
30 super(HgBranchInputDialog, self).__init__(parent)
31 self.setupUi(self)
32
33 self.branchComboBox.addItems(sorted(branches))
34 self.branchComboBox.setEditText("")
35
36 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
37
38 msh = self.minimumSizeHint()
39 self.resize(max(self.width(), msh.width()), msh.height())
40
41 @pyqtSlot(str)
42 def on_branchComboBox_editTextChanged(self, txt):
43 """
44 Private slot handling a change of the branch name.
45
46 @param txt contents of the branch combo box (string)
47 """
48 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt))
49
50 def getData(self):
51 """
52 Public method to get the data.
53
54 @return tuple of branch name (string) and a flag indicating to
55 commit the branch (boolean)
56 """
57 return (self.branchComboBox.currentText().replace(" ", "_"),
58 self.commitCheckBox.isChecked())

eric ide

mercurial