|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2012 - 2016 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a base class for the bookmarks importers. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from PyQt5.QtCore import QObject |
|
13 |
|
14 |
|
15 class BookmarksImporter(QObject): |
|
16 """ |
|
17 Class implementing the base class for the bookmarks importers. |
|
18 """ |
|
19 def __init__(self, id="", parent=None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param id source ID (string) |
|
24 @param parent reference to the parent object (QObject) |
|
25 """ |
|
26 super(BookmarksImporter, self).__init__(parent) |
|
27 |
|
28 self._path = "" |
|
29 self._file = "" |
|
30 self._error = False |
|
31 self._errorString = "" |
|
32 self._id = id |
|
33 |
|
34 def setPath(self, path): |
|
35 """ |
|
36 Public method to set the path of the bookmarks file or directory. |
|
37 |
|
38 @param path bookmarks file or directory (string) |
|
39 @exception NotImplementedError raised to indicate this method must |
|
40 be implemented by a subclass |
|
41 """ |
|
42 raise NotImplementedError |
|
43 |
|
44 def open(self): |
|
45 """ |
|
46 Public method to open the bookmarks file. |
|
47 |
|
48 It must return a flag indicating success (boolean). |
|
49 |
|
50 @exception NotImplementedError raised to indicate this method must |
|
51 be implemented by a subclass |
|
52 """ |
|
53 raise NotImplementedError |
|
54 |
|
55 def importedBookmarks(self): |
|
56 """ |
|
57 Public method to get the imported bookmarks. |
|
58 |
|
59 It must return the imported bookmarks (BookmarkNode). |
|
60 |
|
61 @exception NotImplementedError raised to indicate this method must |
|
62 be implemented by a subclass |
|
63 """ |
|
64 raise NotImplementedError |
|
65 |
|
66 def error(self): |
|
67 """ |
|
68 Public method to check for an error. |
|
69 |
|
70 @return flag indicating an error (boolean) |
|
71 """ |
|
72 return self._error |
|
73 |
|
74 def errorString(self): |
|
75 """ |
|
76 Public method to get the error description. |
|
77 |
|
78 @return error description (string) |
|
79 """ |
|
80 return self._errorString |