51 |
53 |
52 def type(self): |
54 def type(self): |
53 """ |
55 """ |
54 Public method to get the bookmark's type. |
56 Public method to get the bookmark's type. |
55 |
57 |
56 @return bookmark type (BookmarkNode.Type) |
58 @return bookmark type |
|
59 @rtype BookmarkNode.Type |
57 """ |
60 """ |
58 return self._type |
61 return self._type |
59 |
62 |
60 def setType(self, type_): |
63 def setType(self, type_): |
61 """ |
64 """ |
62 Public method to set the bookmark's type. |
65 Public method to set the bookmark's type. |
63 |
66 |
64 @param type_ type of the bookmark node (BookmarkNode.Type) |
67 @param type_ type of the bookmark node |
|
68 @type BookmarkNode.Type |
65 """ |
69 """ |
66 self._type = type_ |
70 self._type = type_ |
67 |
71 |
68 def children(self): |
72 def children(self): |
69 """ |
73 """ |
70 Public method to get the list of child nodes. |
74 Public method to get the list of child nodes. |
71 |
75 |
72 @return list of all child nodes (list of BookmarkNode) |
76 @return list of all child nodes |
|
77 @rtype list of BookmarkNode |
73 """ |
78 """ |
74 return self._children[:] |
79 return self._children[:] |
75 |
80 |
76 def parent(self): |
81 def parent(self): |
77 """ |
82 """ |
78 Public method to get a reference to the parent node. |
83 Public method to get a reference to the parent node. |
79 |
84 |
80 @return reference to the parent node (BookmarkNode) |
85 @return reference to the parent node |
|
86 @rtype BookmarkNode |
81 """ |
87 """ |
82 return self._parent |
88 return self._parent |
83 |
89 |
84 def add(self, child, offset=-1): |
90 def add(self, child, offset=-1): |
85 """ |
91 """ |
86 Public method to add/insert a child node. |
92 Public method to add/insert a child node. |
87 |
93 |
88 @param child reference to the node to add (BookmarkNode) |
94 @param child reference to the node to add |
89 @param offset position where to insert child (integer, -1 = append) |
95 @type BookmarkNode |
|
96 @param offset position where to insert child (-1 = append) |
|
97 @type int |
90 """ |
98 """ |
91 if child._type == BookmarkNode.Root: |
99 if child._type == BookmarkNode.Root: |
92 return |
100 return |
93 |
101 |
94 if child._parent is not None: |
102 if child._parent is not None: |
102 |
110 |
103 def remove(self, child): |
111 def remove(self, child): |
104 """ |
112 """ |
105 Public method to remove a child node. |
113 Public method to remove a child node. |
106 |
114 |
107 @param child reference to the child node (BookmarkNode) |
115 @param child reference to the child node |
|
116 @type BookmarkNode |
108 """ |
117 """ |
109 child._parent = None |
118 child._parent = None |
110 if child in self._children: |
119 if child in self._children: |
111 self._children.remove(child) |
120 self._children.remove(child) |