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