Plugins/VcsPlugins/vcsMercurial/BookmarksExtension/HgBookmarkRenameDialog.py

Wed, 02 Jan 2013 10:31:48 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 02 Jan 2013 10:31:48 +0100
changeset 2302
f29e9405c851
parent 1509
c0b5e693b0eb
child 2525
8b507a9a2d40
child 3034
7ce719013078
child 3163
9f50365a0870
permissions
-rw-r--r--

Updated copyright for 2013.

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
2302
f29e9405c851 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
3 # Copyright (c) 2011 - 2013 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
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt4.QtCore import pyqtSlot
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt4.QtGui import QDialog, QDialogButtonBox
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 """
1131
7781e396c903 Changed the code to use super() to access the superclass.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
27 super().__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))
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 def __updateUI(self):
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 Private slot to update the UI.
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.nameEdit.text() != "" and \
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.bookmarkCombo.currentText() != ""
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 )
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 @pyqtSlot(str)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 def on_nameEdit_textChanged(self, txt):
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 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
47
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 @param txt text of the edit (string)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.__updateUI()
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 @pyqtSlot(str)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 def on_bookmarkCombo_editTextChanged(self, txt):
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 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
56
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 @param txt name of the selected bookmark (string)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.__updateUI()
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 def getData(self):
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 Public method to retrieve the entered data.
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 @return tuple naming the new and old bookmark names
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 (string, string)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 return self.nameEdit.text(), self.bookmarkCombo.currentText()

eric ide

mercurial