SelectionEncloser/ConfigurationPage/SelectionEncloserEditDialog.py

branch
eric7
changeset 55
ccddc623f3c1
parent 52
d2119f1dd5b3
child 59
d29b2151850e
equal deleted inserted replaced
54:98441216a295 55:ccddc623f3c1
15 15
16 class SelectionEncloserEditDialog(QDialog, Ui_SelectionEncloserEditDialog): 16 class SelectionEncloserEditDialog(QDialog, Ui_SelectionEncloserEditDialog):
17 """ 17 """
18 Class implementing a dialog to edit an enclosing menu entry. 18 Class implementing a dialog to edit an enclosing menu entry.
19 """ 19 """
20
20 def __init__(self, title="", string="", parent=None): 21 def __init__(self, title="", string="", parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param title menu entry title 25 @param title menu entry title
25 @type str 26 @type str
26 @param string enclosing string or string format expression 27 @param string enclosing string or string format expression
27 @type str 28 @type str
28 @param parent reference to the parent widget 29 @param parent reference to the parent widget
29 @type QWidget 30 @type QWidget
30 """ 31 """
31 super().__init__(parent) 32 super().__init__(parent)
32 self.setupUi(self) 33 self.setupUi(self)
33 34
34 self.titleEdit.setText(title) 35 self.titleEdit.setText(title)
35 self.stringEdit.setText(string) 36 self.stringEdit.setText(string)
36 37
37 msh = self.minimumSizeHint() 38 msh = self.minimumSizeHint()
38 self.resize(max(self.size().width(), msh.width()), msh.height()) 39 self.resize(max(self.size().width(), msh.width()), msh.height())
39 40
40 self.__updateOkButton() 41 self.__updateOkButton()
41 42
42 def __updateOkButton(self): 43 def __updateOkButton(self):
43 """ 44 """
44 Private slot to set the status of the OK button. 45 Private slot to set the status of the OK button.
45 """ 46 """
46 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( 47 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
47 bool(self.titleEdit.text()) and bool(self.stringEdit.text())) 48 bool(self.titleEdit.text()) and bool(self.stringEdit.text())
48 49 )
50
49 @pyqtSlot(str) 51 @pyqtSlot(str)
50 def on_titleEdit_textChanged(self, txt): 52 def on_titleEdit_textChanged(self, txt):
51 """ 53 """
52 Private slot to react on changes of the title. 54 Private slot to react on changes of the title.
53 55
54 @param txt title text 56 @param txt title text
55 @type str 57 @type str
56 """ 58 """
57 self.__updateOkButton() 59 self.__updateOkButton()
58 60
59 @pyqtSlot(str) 61 @pyqtSlot(str)
60 def on_stringEdit_textChanged(self, txt): 62 def on_stringEdit_textChanged(self, txt):
61 """ 63 """
62 Private slot to react on changes of the string. 64 Private slot to react on changes of the string.
63 65
64 @param txt enclosing string 66 @param txt enclosing string
65 @type str 67 @type str
66 """ 68 """
67 self.__updateOkButton() 69 self.__updateOkButton()
68 70
69 def getData(self): 71 def getData(self):
70 """ 72 """
71 Public method to get the dialog data. 73 Public method to get the dialog data.
72 74
73 @return tuple with menu entry title and enclosing string or string 75 @return tuple with menu entry title and enclosing string or string
74 format expression 76 format expression
75 @rtype tuple of (str, str) 77 @rtype tuple of (str, str)
76 """ 78 """
77 return self.titleEdit.text(), self.stringEdit.text() 79 return self.titleEdit.text(), self.stringEdit.text()

eric ide

mercurial