Helpviewer/Bookmarks/BookmarksImporters/IExplorerImporter.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3002
6ffc581f00f1
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
21 21
22 def getImporterInfo(id): 22 def getImporterInfo(id):
23 """ 23 """
24 Module function to get information for the given source id. 24 Module function to get information for the given source id.
25 25
26 @param id id of the browser ("chrome" or "chromium")
26 @return tuple with an icon (QPixmap), readable name (string), name of 27 @return tuple with an icon (QPixmap), readable name (string), name of
27 the default bookmarks file (string), an info text (string), 28 the default bookmarks file (string), an info text (string),
28 a prompt (string) and the default directory of the bookmarks file (string) 29 a prompt (string) and the default directory of the bookmarks file
30 (string)
31 @exception ValueError raised to indicate an invalid browser ID
29 """ 32 """
30 if id == "ie": 33 if id == "ie":
31 if Globals.isWindowsPlatform(): 34 if Globals.isWindowsPlatform():
32 standardDir = os.path.expandvars( 35 standardDir = os.path.expandvars(
33 "%USERPROFILE%\\Favorites") 36 "%USERPROFILE%\\Favorites")
35 standardDir = "" 38 standardDir = ""
36 return ( 39 return (
37 UI.PixmapCache.getPixmap("internet_explorer.png"), 40 UI.PixmapCache.getPixmap("internet_explorer.png"),
38 "Internet Explorer", 41 "Internet Explorer",
39 "", 42 "",
40 QCoreApplication.translate("IExplorerImporter", 43 QCoreApplication.translate(
41 """Internet Explorer stores its bookmarks in the <b>Favorites</b> """ 44 "IExplorerImporter",
42 """folder This folder is usually located in"""), 45 """Internet Explorer stores its bookmarks in the"""
43 QCoreApplication.translate("IExplorerImporter", 46 """ <b>Favorites</b> folder This folder is usually"""
47 """ located in"""),
48 QCoreApplication.translate(
49 "IExplorerImporter",
44 """Please choose the folder to begin importing bookmarks."""), 50 """Please choose the folder to begin importing bookmarks."""),
45 standardDir, 51 standardDir,
46 ) 52 )
47 else: 53 else:
48 raise ValueError("Unsupported browser ID given ({0}).".format(id)) 54 raise ValueError("Unsupported browser ID given ({0}).".format(id))
126 if line.startswith("URL="): 132 if line.startswith("URL="):
127 url = line.replace("URL=", "") 133 url = line.replace("URL=", "")
128 break 134 break
129 if url: 135 if url:
130 if dir in folders: 136 if dir in folders:
131 bookmark = BookmarkNode(BookmarkNode.Bookmark, folders[dir]) 137 bookmark = BookmarkNode(BookmarkNode.Bookmark,
138 folders[dir])
132 else: 139 else:
133 bookmark = BookmarkNode(BookmarkNode.Bookmark, importRootNode) 140 bookmark = BookmarkNode(BookmarkNode.Bookmark,
141 importRootNode)
134 bookmark.url = url 142 bookmark.url = url
135 bookmark.title = name.replace("&", "&&") 143 bookmark.title = name.replace("&", "&&")
136 144
137 if self._id == "ie": 145 if self._id == "ie":
138 importRootNode.title = self.trUtf8("Internet Explorer Import") 146 importRootNode.title = self.trUtf8("Internet Explorer Import")

eric ide

mercurial