eric6/WebBrowser/Bookmarks/BookmarksImporters/BookmarksImporter.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7781
607a6098cb44
child 8218
7c09585bd960
permissions
-rw-r--r--

Updated copyright for 2021.

1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2012 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a base class for the bookmarks importers.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
10 from PyQt5.QtCore import QObject
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
1965
96f5a76e1845 Fixed some PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1713
diff changeset
12
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 class BookmarksImporter(QObject):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 Class implementing the base class for the bookmarks importers.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 """
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
17 def __init__(self, sourceId="", parent=None):
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 Constructor
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
21 @param sourceId source ID (string)
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 @param parent reference to the parent object (QObject)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
24 super(BookmarksImporter, self).__init__(parent)
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 self._path = ""
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 self._file = ""
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 self._error = False
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 self._errorString = ""
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
30 self._id = sourceId
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 def setPath(self, path):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Public method to set the path of the bookmarks file or directory.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @param path bookmarks file or directory (string)
2954
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
37 @exception NotImplementedError raised to indicate this method must
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
38 be implemented by a subclass
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 raise NotImplementedError
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 def open(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 Public method to open the bookmarks file.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
2954
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
46 It must return a flag indicating success (boolean).
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
47
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
48 @exception NotImplementedError raised to indicate this method must
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
49 be implemented by a subclass
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 raise NotImplementedError
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 def importedBookmarks(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 Public method to get the imported bookmarks.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
2954
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
57 It must return the imported bookmarks (BookmarkNode).
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
58
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
59 @exception NotImplementedError raised to indicate this method must
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
60 be implemented by a subclass
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 raise NotImplementedError
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 def error(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 Public method to check for an error.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 @return flag indicating an error (boolean)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 return self._error
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 def errorString(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 Public method to get the error description.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 @return error description (string)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 return self._errorString

eric ide

mercurial