eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarkRenameDialog.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7780
41420f82c0ac
child 8143
2c730d5fd177
permissions
-rw-r--r--

Updated copyright for 2021.

1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2011 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to get the data to rename a bookmark.
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3562
diff changeset
10 from PyQt5.QtCore import pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3562
diff changeset
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_HgBookmarkRenameDialog import Ui_HgBookmarkRenameDialog
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 class HgBookmarkRenameDialog(QDialog, Ui_HgBookmarkRenameDialog):
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 Class implementing a dialog to get the data to rename a bookmark.
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 def __init__(self, bookmarksList, parent=None):
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Constructor
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 @param bookmarksList list of bookmarks (list of strings)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param parent reference to the parent widget (QWidget)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
27 super(HgBookmarkRenameDialog, self).__init__(parent)
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 self.setupUi(self)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 self.bookmarkCombo.addItems(sorted(bookmarksList))
3366
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
33
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
34 msh = self.minimumSizeHint()
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
35 self.resize(max(self.width(), msh.width()), msh.height())
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 def __updateUI(self):
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 Private slot to update the UI.
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
42 self.nameEdit.text() != "" and
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.bookmarkCombo.currentText() != ""
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 )
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 @pyqtSlot(str)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 def on_nameEdit_textChanged(self, txt):
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 Private slot to handle changes of the bookmark name.
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 @param txt text of the edit (string)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.__updateUI()
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 @pyqtSlot(str)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 def on_bookmarkCombo_editTextChanged(self, txt):
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 Private slot to handle changes of the selected bookmark.
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 @param txt name of the selected bookmark (string)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.__updateUI()
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 def getData(self):
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 Public method to retrieve the entered data.
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
5328
9c11e9285a46 Added context menu actions to the Mercurial bookmark list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
68 @return tuple naming the old and new bookmark names
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 (string, string)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
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
71 return (
5328
9c11e9285a46 Added context menu actions to the Mercurial bookmark list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
72 self.bookmarkCombo.currentText().replace(" ", "_"),
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
73 self.nameEdit.text().replace(" ", "_"),
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
74 )

eric ide

mercurial