20 |
20 |
21 def getImporterInfo(sourceId): |
21 def getImporterInfo(sourceId): |
22 """ |
22 """ |
23 Module function to get information for the given source id. |
23 Module function to get information for the given source id. |
24 |
24 |
25 @param sourceId id of the browser ("chrome" or "chromium") |
25 @param sourceId id of the browser |
26 @return tuple with an icon (QPixmap), readable name (string), name of |
26 @type str |
27 the default bookmarks file (string), an info text (string), |
27 @return tuple with an icon, readable name, name of the default |
28 a prompt (string) and the default directory of the bookmarks file |
28 bookmarks file, an info text, a prompt and the default directory |
29 (string) |
29 of the bookmarks file |
|
30 @rtype tuple of (QPixmap, str, str, str, str, str) |
30 @exception ValueError raised to indicate an invalid browser ID |
31 @exception ValueError raised to indicate an invalid browser ID |
31 """ |
32 """ |
32 if sourceId != "firefox": |
33 if sourceId != "firefox": |
33 raise ValueError("Unsupported browser ID given ({0}).".format(sourceId)) |
34 raise ValueError("Unsupported browser ID given ({0}).".format(sourceId)) |
34 |
35 |
79 |
80 |
80 def setPath(self, path): |
81 def setPath(self, path): |
81 """ |
82 """ |
82 Public method to set the path of the bookmarks file or directory. |
83 Public method to set the path of the bookmarks file or directory. |
83 |
84 |
84 @param path bookmarks file or directory (string) |
85 @param path bookmarks file or directory |
|
86 @type str |
85 """ |
87 """ |
86 self.__fileName = path |
88 self.__fileName = path |
87 |
89 |
88 def open(self): |
90 def open(self): |
89 """ |
91 """ |
90 Public method to open the bookmarks file. |
92 Public method to open the bookmarks file. |
91 |
93 |
92 @return flag indicating success (boolean) |
94 @return flag indicating success |
|
95 @rtype bool |
93 """ |
96 """ |
94 if not os.path.exists(self.__fileName): |
97 if not os.path.exists(self.__fileName): |
95 self._error = True |
98 self._error = True |
96 self._errorString = self.tr("File '{0}' does not exist.").format( |
99 self._errorString = self.tr("File '{0}' does not exist.").format( |
97 self.__fileName |
100 self.__fileName |
111 |
114 |
112 def importedBookmarks(self): |
115 def importedBookmarks(self): |
113 """ |
116 """ |
114 Public method to get the imported bookmarks. |
117 Public method to get the imported bookmarks. |
115 |
118 |
116 @return imported bookmarks (BookmarkNode) |
119 @return imported bookmarks |
|
120 @rtype BookmarkNode |
117 """ |
121 """ |
118 from ..BookmarkNode import BookmarkNode |
122 from ..BookmarkNode import BookmarkNode |
119 |
123 |
120 importRootNode = BookmarkNode(BookmarkNode.Root) |
124 importRootNode = BookmarkNode(BookmarkNode.Root) |
121 |
125 |