14 |
14 |
15 from .BookmarkNode import BookmarkNode |
15 from .BookmarkNode import BookmarkNode |
16 |
16 |
17 from .Ui_AddBookmarkDialog import Ui_AddBookmarkDialog |
17 from .Ui_AddBookmarkDialog import Ui_AddBookmarkDialog |
18 |
18 |
|
19 |
19 class AddBookmarkProxyModel(QSortFilterProxyModel): |
20 class AddBookmarkProxyModel(QSortFilterProxyModel): |
20 """ |
21 """ |
21 Class implementing a proxy model used by the AddBookmarkDialog dialog. |
22 Class implementing a proxy model used by the AddBookmarkDialog dialog. |
22 """ |
23 """ |
23 def __init__(self, parent = None): |
24 def __init__(self, parent=None): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 |
27 |
27 @param parent reference to the parent object (QObject) |
28 @param parent reference to the parent object (QObject) |
28 """ |
29 """ |
56 @param sourceParent index of the source item (QModelIndex) |
57 @param sourceParent index of the source item (QModelIndex) |
57 @return flag indicating acceptance (boolean) |
58 @return flag indicating acceptance (boolean) |
58 """ |
59 """ |
59 return sourceColumn == 0 |
60 return sourceColumn == 0 |
60 |
61 |
61 def hasChildren(self, parent = QModelIndex()): |
62 def hasChildren(self, parent=QModelIndex()): |
62 """ |
63 """ |
63 Public method to check, if a parent node has some children. |
64 Public method to check, if a parent node has some children. |
64 |
65 |
65 @param parent index of the parent node (QModelIndex) |
66 @param parent index of the parent node (QModelIndex) |
66 @return flag indicating the presence of children (boolean) |
67 @return flag indicating the presence of children (boolean) |
67 """ |
68 """ |
68 sindex = self.mapToSource(parent) |
69 sindex = self.mapToSource(parent) |
69 return self.sourceModel().hasChildren(sindex) |
70 return self.sourceModel().hasChildren(sindex) |
70 |
71 |
|
72 |
71 class AddBookmarkDialog(QDialog, Ui_AddBookmarkDialog): |
73 class AddBookmarkDialog(QDialog, Ui_AddBookmarkDialog): |
72 """ |
74 """ |
73 Class implementing a dialog to add a bookmark or a bookmark folder. |
75 Class implementing a dialog to add a bookmark or a bookmark folder. |
74 """ |
76 """ |
75 def __init__(self, parent = None, bookmarksManager = None): |
77 def __init__(self, parent=None, bookmarksManager=None): |
76 """ |
78 """ |
77 Constructor |
79 Constructor |
78 |
80 |
79 @param parent reference to the parent widget (QWidget) |
81 @param parent reference to the parent widget (QWidget) |
80 @param bookmarksManager reference to the bookmarks manager |
82 @param bookmarksManager reference to the bookmarks manager |
81 object (BookmarksManager) |
83 object (BookmarksManager) |
82 """ |
84 """ |
83 QDialog.__init__(self, parent) |
85 QDialog.__init__(self, parent) |
84 self.setupUi(self) |
86 self.setupUi(self) |
85 |
87 |