src/eric7/Plugins/VcsPlugins/vcsMercurial/HgBookmarkRenameDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 15
16 class HgBookmarkRenameDialog(QDialog, Ui_HgBookmarkRenameDialog): 16 class HgBookmarkRenameDialog(QDialog, Ui_HgBookmarkRenameDialog):
17 """ 17 """
18 Class implementing a dialog to get the data to rename a bookmark. 18 Class implementing a dialog to get the data to rename a bookmark.
19 """ 19 """
20
20 def __init__(self, bookmarksList, parent=None): 21 def __init__(self, bookmarksList, parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param bookmarksList list of bookmarks (list of strings) 25 @param bookmarksList list of bookmarks (list of strings)
25 @param parent reference to the parent widget (QWidget) 26 @param parent reference to the parent widget (QWidget)
26 """ 27 """
27 super().__init__(parent) 28 super().__init__(parent)
28 self.setupUi(self) 29 self.setupUi(self)
29 30
30 self.buttonBox.button( 31 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
31 QDialogButtonBox.StandardButton.Ok).setEnabled(False) 32
32
33 self.bookmarkCombo.addItems(sorted(bookmarksList)) 33 self.bookmarkCombo.addItems(sorted(bookmarksList))
34 34
35 msh = self.minimumSizeHint() 35 msh = self.minimumSizeHint()
36 self.resize(max(self.width(), msh.width()), msh.height()) 36 self.resize(max(self.width(), msh.width()), msh.height())
37 37
38 def __updateUI(self): 38 def __updateUI(self):
39 """ 39 """
40 Private slot to update the UI. 40 Private slot to update the UI.
41 """ 41 """
42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( 42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
43 self.nameEdit.text() != "" and 43 self.nameEdit.text() != "" and self.bookmarkCombo.currentText() != ""
44 self.bookmarkCombo.currentText() != ""
45 ) 44 )
46 45
47 @pyqtSlot(str) 46 @pyqtSlot(str)
48 def on_nameEdit_textChanged(self, txt): 47 def on_nameEdit_textChanged(self, txt):
49 """ 48 """
50 Private slot to handle changes of the bookmark name. 49 Private slot to handle changes of the bookmark name.
51 50
52 @param txt text of the edit (string) 51 @param txt text of the edit (string)
53 """ 52 """
54 self.__updateUI() 53 self.__updateUI()
55 54
56 @pyqtSlot(str) 55 @pyqtSlot(str)
57 def on_bookmarkCombo_editTextChanged(self, txt): 56 def on_bookmarkCombo_editTextChanged(self, txt):
58 """ 57 """
59 Private slot to handle changes of the selected bookmark. 58 Private slot to handle changes of the selected bookmark.
60 59
61 @param txt name of the selected bookmark (string) 60 @param txt name of the selected bookmark (string)
62 """ 61 """
63 self.__updateUI() 62 self.__updateUI()
64 63
65 def getData(self): 64 def getData(self):
66 """ 65 """
67 Public method to retrieve the entered data. 66 Public method to retrieve the entered data.
68 67
69 @return tuple naming the old and new bookmark names 68 @return tuple naming the old and new bookmark names
70 (string, string) 69 (string, string)
71 """ 70 """
72 return ( 71 return (
73 self.bookmarkCombo.currentText().replace(" ", "_"), 72 self.bookmarkCombo.currentText().replace(" ", "_"),

eric ide

mercurial