15 |
15 |
16 class ProtocolHandlerManagerDialog(QDialog, Ui_ProtocolHandlerManagerDialog): |
16 class ProtocolHandlerManagerDialog(QDialog, Ui_ProtocolHandlerManagerDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to manage registered protocol handlers. |
18 Class implementing a dialog to manage registered protocol handlers. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, manager, parent=None): |
21 def __init__(self, manager, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param manager reference to the protocol handlers manager object |
25 @param manager reference to the protocol handlers manager object |
25 @type ProtocolHandlerManager |
26 @type ProtocolHandlerManager |
26 @param parent reference to the parent widget |
27 @param parent reference to the parent widget |
27 @type QWidget |
28 @type QWidget |
28 """ |
29 """ |
29 super().__init__(parent) |
30 super().__init__(parent) |
30 self.setupUi(self) |
31 self.setupUi(self) |
31 self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) |
32 self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) |
32 |
33 |
33 self.__manager = manager |
34 self.__manager = manager |
34 handlers = self.__manager.protocolHandlers() |
35 handlers = self.__manager.protocolHandlers() |
35 for scheme in sorted(handlers.keys()): |
36 for scheme in sorted(handlers.keys()): |
36 QTreeWidgetItem(self.protocolHandlersList, |
37 QTreeWidgetItem( |
37 [scheme, handlers[scheme].toString()]) |
38 self.protocolHandlersList, [scheme, handlers[scheme].toString()] |
38 |
39 ) |
|
40 |
39 self.on_protocolHandlersList_itemSelectionChanged() |
41 self.on_protocolHandlersList_itemSelectionChanged() |
40 |
42 |
41 @pyqtSlot() |
43 @pyqtSlot() |
42 def on_protocolHandlersList_itemSelectionChanged(self): |
44 def on_protocolHandlersList_itemSelectionChanged(self): |
43 """ |
45 """ |
44 Private slot handling a change of the selection. |
46 Private slot handling a change of the selection. |
45 """ |
47 """ |
46 self.deleteButton.setEnabled( |
48 self.deleteButton.setEnabled( |
47 len(self.protocolHandlersList.selectedItems()) == 1) |
49 len(self.protocolHandlersList.selectedItems()) == 1 |
48 |
50 ) |
|
51 |
49 @pyqtSlot() |
52 @pyqtSlot() |
50 def on_deleteButton_clicked(self): |
53 def on_deleteButton_clicked(self): |
51 """ |
54 """ |
52 Private slot to delete the selected protocol handler. |
55 Private slot to delete the selected protocol handler. |
53 """ |
56 """ |
54 itm = self.protocolHandlersList.selectedItems()[0] |
57 itm = self.protocolHandlersList.selectedItems()[0] |
55 self.__manager.removeProtocolHandler(itm.text(0)) |
58 self.__manager.removeProtocolHandler(itm.text(0)) |
56 |
59 |
57 self.protocolHandlersList.takeTopLevelItem( |
60 self.protocolHandlersList.takeTopLevelItem( |
58 self.protocolHandlersList.indexOfTopLevelItem(itm)) |
61 self.protocolHandlersList.indexOfTopLevelItem(itm) |
|
62 ) |
59 del itm |
63 del itm |