SelectionEncloser/ConfigurationPage/SelectionEncloserEditDialog.py

branch
eric7
changeset 51
318d7ebbdce2
parent 45
896b66ba45f0
child 52
d2119f1dd5b3
equal deleted inserted replaced
50:face142f8fa5 51:318d7ebbdce2
5 5
6 """ 6 """
7 Module implementing a dialog to edit an enclosing menu entry. 7 Module implementing a dialog to edit an enclosing menu entry.
8 """ 8 """
9 9
10 from PyQt5.QtCore import pyqtSlot 10 from PyQt6.QtCore import pyqtSlot
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox 11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
12 12
13 from .Ui_SelectionEncloserEditDialog import Ui_SelectionEncloserEditDialog 13 from .Ui_SelectionEncloserEditDialog import Ui_SelectionEncloserEditDialog
14 14
15 15
16 class SelectionEncloserEditDialog(QDialog, Ui_SelectionEncloserEditDialog): 16 class SelectionEncloserEditDialog(QDialog, Ui_SelectionEncloserEditDialog):
19 """ 19 """
20 def __init__(self, title="", string="", parent=None): 20 def __init__(self, title="", string="", parent=None):
21 """ 21 """
22 Constructor 22 Constructor
23 23
24 @param title menu entry title (string) 24 @param title menu entry title
25 @param string enclosing string or string format expression (string) 25 @type str
26 @param parent reference to the parent widget (QWidget) 26 @param string enclosing string or string format expression
27 @type str
28 @param parent reference to the parent widget
29 @type QWidget
27 """ 30 """
28 super().__init__(parent) 31 super().__init__(parent)
29 self.setupUi(self) 32 self.setupUi(self)
30 33
31 self.titleEdit.setText(title) 34 self.titleEdit.setText(title)
38 41
39 def __updateOkButton(self): 42 def __updateOkButton(self):
40 """ 43 """
41 Private slot to set the status of the OK button. 44 Private slot to set the status of the OK button.
42 """ 45 """
43 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( 46 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
44 bool(self.titleEdit.text()) and bool(self.stringEdit.text())) 47 bool(self.titleEdit.text()) and bool(self.stringEdit.text()))
45 48
46 @pyqtSlot(str) 49 @pyqtSlot(str)
47 def on_titleEdit_textChanged(self, txt): 50 def on_titleEdit_textChanged(self, txt):
48 """ 51 """
49 Private slot to react on changes of the title. 52 Private slot to react on changes of the title.
50 53
51 @param txt title text (string) 54 @param txt title text
55 @type str
52 """ 56 """
53 self.__updateOkButton() 57 self.__updateOkButton()
54 58
55 @pyqtSlot(str) 59 @pyqtSlot(str)
56 def on_stringEdit_textChanged(self, txt): 60 def on_stringEdit_textChanged(self, txt):
57 """ 61 """
58 Private slot to react on changes of the string. 62 Private slot to react on changes of the string.
59 63
60 @param txt enclosing string (string) 64 @param txt enclosing string
65 @type str
61 """ 66 """
62 self.__updateOkButton() 67 self.__updateOkButton()
63 68
64 def getData(self): 69 def getData(self):
65 """ 70 """
66 Public method to get the dialog data. 71 Public method to get the dialog data.
67 72
68 @return tuple with menu entry title (string) and enclosing string 73 @return tuple with menu entry title and enclosing string or string
69 or string format expression (string) 74 format expression
75 @rtype tuple of (str, str)
70 """ 76 """
71 return self.titleEdit.text(), self.stringEdit.text() 77 return self.titleEdit.text(), self.stringEdit.text()

eric ide

mercurial