src/eric7/WebBrowser/Bookmarks/BookmarksDialog.py

branch
eric7
changeset 10436
f6881d10e995
parent 10069
435cc5875135
child 10439
21c28b0f9e41
equal deleted inserted replaced
10435:c712d09cc839 10436:f6881d10e995
35 35
36 def __init__(self, parent=None, manager=None): 36 def __init__(self, parent=None, manager=None):
37 """ 37 """
38 Constructor 38 Constructor
39 39
40 @param parent reference to the parent widget (QWidget 40 @param parent reference to the parent widget
41 @type QWidge
41 @param manager reference to the bookmarks manager object 42 @param manager reference to the bookmarks manager object
42 (BookmarksManager) 43 @type BookmarksManager
43 """ 44 """
44 super().__init__(parent) 45 super().__init__(parent)
45 self.setupUi(self) 46 self.setupUi(self)
46 self.setWindowFlags(Qt.WindowType.Window) 47 self.setWindowFlags(Qt.WindowType.Window)
47 48
76 77
77 def closeEvent(self, evt): 78 def closeEvent(self, evt):
78 """ 79 """
79 Protected method to handle the closing of the dialog. 80 Protected method to handle the closing of the dialog.
80 81
81 @param evt reference to the event object (QCloseEvent) (ignored) 82 @param evt reference to the event object (ignored)
83 @type QCloseEvent
82 """ 84 """
83 self.__shutdown() 85 self.__shutdown()
84 86
85 def reject(self): 87 def reject(self):
86 """ 88 """
98 100
99 def __saveExpandedNodes(self, parent): 101 def __saveExpandedNodes(self, parent):
100 """ 102 """
101 Private method to save the child nodes of an expanded node. 103 Private method to save the child nodes of an expanded node.
102 104
103 @param parent index of the parent node (QModelIndex) 105 @param parent index of the parent node
104 @return flag indicating a change (boolean) 106 @type QModelIndex
107 @return flag indicating a change
108 @rtype bool
105 """ 109 """
106 changed = False 110 changed = False
107 for row in range(self.__proxyModel.rowCount(parent)): 111 for row in range(self.__proxyModel.rowCount(parent)):
108 child = self.__proxyModel.index(row, 0, parent) 112 child = self.__proxyModel.index(row, 0, parent)
109 sourceIndex = self.__proxyModel.mapToSource(child) 113 sourceIndex = self.__proxyModel.mapToSource(child)
120 124
121 def __expandNodes(self, node): 125 def __expandNodes(self, node):
122 """ 126 """
123 Private method to expand all child nodes of a node. 127 Private method to expand all child nodes of a node.
124 128
125 @param node reference to the bookmark node to expand (BookmarkNode) 129 @param node reference to the bookmark node to expand
130 @type BookmarkNode
126 """ 131 """
127 for childNode in node.children(): 132 for childNode in node.children():
128 if childNode.expanded: 133 if childNode.expanded:
129 idx = self.__bookmarksModel.nodeIndex(childNode) 134 idx = self.__bookmarksModel.nodeIndex(childNode)
130 idx = self.__proxyModel.mapFromSource(idx) 135 idx = self.__proxyModel.mapFromSource(idx)
133 138
134 def __customContextMenuRequested(self, pos): 139 def __customContextMenuRequested(self, pos):
135 """ 140 """
136 Private slot to handle the context menu request for the bookmarks tree. 141 Private slot to handle the context menu request for the bookmarks tree.
137 142
138 @param pos position the context menu was requested (QPoint) 143 @param pos position the context menu was requested
144 @type QPoint
139 """ 145 """
140 from .BookmarkNode import BookmarkNode 146 from .BookmarkNode import BookmarkNode
141 147
142 menu = QMenu() 148 menu = QMenu()
143 idx = self.bookmarksTree.indexAt(pos) 149 idx = self.bookmarksTree.indexAt(pos)
183 @pyqtSlot(QModelIndex) 189 @pyqtSlot(QModelIndex)
184 def __activated(self, idx): 190 def __activated(self, idx):
185 """ 191 """
186 Private slot to handle the activation of an entry. 192 Private slot to handle the activation of an entry.
187 193
188 @param idx reference to the entry index (QModelIndex) 194 @param idx reference to the entry index
195 @type QModelIndex
189 """ 196 """
190 if QApplication.keyboardModifiers() & Qt.KeyboardModifier.ControlModifier: 197 if QApplication.keyboardModifiers() & Qt.KeyboardModifier.ControlModifier:
191 self.__openBookmarkInNewTab() 198 self.__openBookmarkInNewTab()
192 elif QApplication.keyboardModifiers() & Qt.KeyboardModifier.ShiftModifier: 199 elif QApplication.keyboardModifiers() & Qt.KeyboardModifier.ShiftModifier:
193 self.__openBookmarkInNewWindow() 200 self.__openBookmarkInNewWindow()

eric ide

mercurial