5 |
5 |
6 """ |
6 """ |
7 Module implementing the bookmark node. |
7 Module implementing the bookmark node. |
8 """ |
8 """ |
9 |
9 |
|
10 import enum |
|
11 |
10 from PyQt6.QtCore import QDateTime |
12 from PyQt6.QtCore import QDateTime |
|
13 |
|
14 |
|
15 class BookmarkNodeType(enum.Enum): |
|
16 """ |
|
17 Class defining the bookmark node types. |
|
18 """ |
|
19 |
|
20 Root = 0 |
|
21 Folder = 1 |
|
22 Bookmark = 2 |
|
23 Separator = 3 |
|
24 |
|
25 |
|
26 class BookmarkTimestampType(enum.Enum): |
|
27 """ |
|
28 Class defining the bookmark timestamp types. |
|
29 """ |
|
30 |
|
31 Added = 0 |
|
32 Modified = 1 |
|
33 Visited = 2 |
11 |
34 |
12 |
35 |
13 class BookmarkNode: |
36 class BookmarkNode: |
14 """ |
37 """ |
15 Class implementing the bookmark node type. |
38 Class implementing the bookmark node type. |
16 """ |
39 """ |
17 |
40 |
18 # TODO: change this to an enum |
41 def __init__(self, type_=BookmarkNodeType.Root, parent=None): |
19 # possible bookmark node types |
|
20 Root = 0 |
|
21 Folder = 1 |
|
22 Bookmark = 2 |
|
23 Separator = 3 |
|
24 |
|
25 # TODO: change this to an enum |
|
26 # possible timestamp types |
|
27 TsAdded = 0 |
|
28 TsModified = 1 |
|
29 TsVisited = 2 |
|
30 |
|
31 def __init__(self, type_=Root, parent=None): |
|
32 """ |
42 """ |
33 Constructor |
43 Constructor |
34 |
44 |
35 @param type_ type of the bookmark node |
45 @param type_ type of the bookmark node |
36 @type BookmarkNode.Type |
46 @type BookmarkNode.Type |
96 @param child reference to the node to add |
106 @param child reference to the node to add |
97 @type BookmarkNode |
107 @type BookmarkNode |
98 @param offset position where to insert child (-1 = append) |
108 @param offset position where to insert child (-1 = append) |
99 @type int |
109 @type int |
100 """ |
110 """ |
101 if child._type == BookmarkNode.Root: |
111 if child._type == BookmarkNodeType.Root: |
102 return |
112 return |
103 |
113 |
104 if child._parent is not None: |
114 if child._parent is not None: |
105 child._parent.remove(child) |
115 child._parent.remove(child) |
106 |
116 |