18 |
18 |
19 def getImporterInfo(sourceId): |
19 def getImporterInfo(sourceId): |
20 """ |
20 """ |
21 Module function to get information for the given HTML source id. |
21 Module function to get information for the given HTML source id. |
22 |
22 |
23 @param sourceId id of the browser ("chrome" or "chromium") |
23 @param sourceId id of the browser |
24 @return tuple with an icon (QPixmap), readable name (string), name of |
24 @type str |
25 the default bookmarks file (string), an info text (string), |
25 @return tuple with an icon, readable name, name of the default |
26 a prompt (string) and the default directory of the bookmarks file |
26 bookmarks file, an info text, a prompt and the default directory |
27 (string) |
27 of the bookmarks file |
|
28 @rtype tuple of (QPixmap, str, str, str, str, str) |
28 @exception ValueError raised to indicate an invalid browser ID |
29 @exception ValueError raised to indicate an invalid browser ID |
29 """ |
30 """ |
30 if sourceId != "html": |
31 if sourceId != "html": |
31 raise ValueError("Unsupported browser ID given ({0}).".format(sourceId)) |
32 raise ValueError("Unsupported browser ID given ({0}).".format(sourceId)) |
32 |
33 |
69 |
70 |
70 def setPath(self, path): |
71 def setPath(self, path): |
71 """ |
72 """ |
72 Public method to set the path of the bookmarks file or directory. |
73 Public method to set the path of the bookmarks file or directory. |
73 |
74 |
74 @param path bookmarks file or directory (string) |
75 @param path bookmarks file or directory |
|
76 @type str |
75 """ |
77 """ |
76 self.__fileName = path |
78 self.__fileName = path |
77 |
79 |
78 def open(self): |
80 def open(self): |
79 """ |
81 """ |
80 Public method to open the bookmarks file. |
82 Public method to open the bookmarks file. |
81 |
83 |
82 @return flag indicating success (boolean) |
84 @return flag indicating success |
|
85 @rtype bool |
83 """ |
86 """ |
84 if not os.path.exists(self.__fileName): |
87 if not os.path.exists(self.__fileName): |
85 self._error = True |
88 self._error = True |
86 self._errorString = self.tr("File '{0}' does not exist.").format( |
89 self._errorString = self.tr("File '{0}' does not exist.").format( |
87 self.__fileName |
90 self.__fileName |
91 |
94 |
92 def importedBookmarks(self): |
95 def importedBookmarks(self): |
93 """ |
96 """ |
94 Public method to get the imported bookmarks. |
97 Public method to get the imported bookmarks. |
95 |
98 |
96 @return imported bookmarks (BookmarkNode) |
99 @return imported bookmarks |
|
100 @rtype BookmarkNode |
97 """ |
101 """ |
98 from ..BookmarkNode import BookmarkNode |
102 from ..BookmarkNode import BookmarkNode |
99 from ..NsHtmlReader import NsHtmlReader |
103 from ..NsHtmlReader import NsHtmlReader |
100 |
104 |
101 reader = NsHtmlReader() |
105 reader = NsHtmlReader() |