15 |
15 |
16 class HelpBookmarkPropertiesDialog(QDialog, Ui_HelpBookmarkPropertiesDialog): |
16 class HelpBookmarkPropertiesDialog(QDialog, Ui_HelpBookmarkPropertiesDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to edit the bookmark properties. |
18 Class implementing a dialog to edit the bookmark properties. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, title="", url="", parent=None): |
21 def __init__(self, title="", url="", parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param title title for the bookmark (defaults to "") |
25 @param title title for the bookmark (defaults to "") |
25 @type str (optional) |
26 @type str (optional) |
26 @param url URL for the bookmark (defaults to "") |
27 @param url URL for the bookmark (defaults to "") |
27 @type str (optional) |
28 @type str (optional) |
28 @param parent reference to the parent widget (defaults to None) |
29 @param parent reference to the parent widget (defaults to None) |
29 @type QWidget (optional) |
30 @type QWidget (optional) |
30 """ |
31 """ |
31 super().__init__(parent) |
32 super().__init__(parent) |
32 self.setupUi(self) |
33 self.setupUi(self) |
33 |
34 |
34 self.titleEdit.textChanged.connect(self.__updateOkButton) |
35 self.titleEdit.textChanged.connect(self.__updateOkButton) |
35 self.urlEdit.textChanged.connect(self.__updateOkButton) |
36 self.urlEdit.textChanged.connect(self.__updateOkButton) |
36 |
37 |
37 self.titleEdit.setText(title) |
38 self.titleEdit.setText(title) |
38 self.urlEdit.setText(url) |
39 self.urlEdit.setText(url) |
39 |
40 |
40 msh = self.minimumSizeHint() |
41 msh = self.minimumSizeHint() |
41 self.resize(max(self.width(), msh.width()), msh.height()) |
42 self.resize(max(self.width(), msh.width()), msh.height()) |
42 |
43 |
43 @pyqtSlot() |
44 @pyqtSlot() |
44 def __updateOkButton(self): |
45 def __updateOkButton(self): |
45 """ |
46 """ |
46 Private method to set the enabled state of the OK button. |
47 Private method to set the enabled state of the OK button. |
47 """ |
48 """ |
48 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
49 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
49 bool(self.titleEdit.text().strip()) and |
50 bool(self.titleEdit.text().strip()) and bool(self.urlEdit.text().strip()) |
50 bool(self.urlEdit.text().strip()) |
|
51 ) |
51 ) |
52 |
52 |
53 def getData(self): |
53 def getData(self): |
54 """ |
54 """ |
55 Public method to retrieve the entered data. |
55 Public method to retrieve the entered data. |
56 |
56 |
57 @return tuple containing the title and URL for the bookmark |
57 @return tuple containing the title and URL for the bookmark |
58 @rtype tuple of (str, str) |
58 @rtype tuple of (str, str) |
59 """ |
59 """ |
60 return ( |
60 return ( |
61 self.titleEdit.text().strip(), |
61 self.titleEdit.text().strip(), |