eric6/Plugins/VcsPlugins/vcsMercurial/HgBranchInputDialog.py

Tue, 10 Sep 2019 19:30:07 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 10 Sep 2019 19:30:07 +0200
changeset 7229
53054eb5b15a
parent 6942
2602857055c5
child 7360
9190402e4505
permissions
-rw-r--r--

Removed obsolete "from __future__ import ..." statements.

3353
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
3 # Copyright (c) 2014 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
3353
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter the data for a branch operation.
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3408
diff changeset
10
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
11 from PyQt5.QtCore import pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
3353
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_HgBranchInputDialog import Ui_HgBranchInputDialog
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 class HgBranchInputDialog(QDialog, Ui_HgBranchInputDialog):
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 Class implementing a dialog to enter the data for a branch operation.
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 def __init__(self, branches, parent=None):
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param branches branch names to populate the branch list with
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 (list of string)
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param parent reference to the parent widget (QWidget)
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3408
diff changeset
29 super(HgBranchInputDialog, self).__init__(parent)
3353
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.setupUi(self)
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 self.branchComboBox.addItems(sorted(branches))
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.branchComboBox.setEditText("")
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
3366
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3353
diff changeset
37 msh = self.minimumSizeHint()
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3353
diff changeset
38 self.resize(max(self.width(), msh.width()), msh.height())
3353
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 @pyqtSlot(str)
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 def on_branchComboBox_editTextChanged(self, txt):
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 """
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 Private slot handling a change of the branch name.
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 @param txt contents of the branch combo box (string)
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt))
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 def getData(self):
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 """
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 Public method to get the data.
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 @return tuple of branch name (string) and a flag indicating to
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 commit the branch (boolean)
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 """
3408
b6e6a7062d12 Changed some Mercurial dialogs asking for a (tag, branch,...) name to convert spaces to underscores because spaces are not really recommended.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3366
diff changeset
56 return (self.branchComboBox.currentText().replace(" ", "_"),
3353
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.commitCheckBox.isChecked())

eric ide

mercurial