Helpviewer/Bookmarks/BookmarksImporters/ChromeImporter.py

changeset 5587
ea526b78ee6c
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
equal deleted inserted replaced
5586:0e5421d679e7 5587:ea526b78ee6c
18 18
19 import UI.PixmapCache 19 import UI.PixmapCache
20 import Globals 20 import Globals
21 21
22 22
23 def getImporterInfo(id): 23 def getImporterInfo(sourceId):
24 """ 24 """
25 Module function to get information for the given source id. 25 Module function to get information for the given source id.
26 26
27 @param id id of the browser ("chrome" or "chromium") 27 @param sourceId id of the browser ("chrome" or "chromium")
28 @return tuple with an icon (QPixmap), readable name (string), name of 28 @return tuple with an icon (QPixmap), readable name (string), name of
29 the default bookmarks file (string), an info text (string), 29 the default bookmarks file (string), an info text (string),
30 a prompt (string) and the default directory of the bookmarks file 30 a prompt (string) and the default directory of the bookmarks file
31 (string) 31 (string)
32 @exception ValueError raised to indicate an invalid browser ID 32 @exception ValueError raised to indicate an invalid browser ID
33 """ 33 """
34 if id == "chrome": 34 if sourceId == "chrome":
35 if Globals.isWindowsPlatform(): 35 if Globals.isWindowsPlatform():
36 standardDir = os.path.expandvars( 36 standardDir = os.path.expandvars(
37 "%USERPROFILE%\\AppData\\Local\\Google\\Chrome\\" 37 "%USERPROFILE%\\AppData\\Local\\Google\\Chrome\\"
38 "User Data\\Default") 38 "User Data\\Default")
39 elif Globals.isMacPlatform(): 39 elif Globals.isMacPlatform():
53 QCoreApplication.translate( 53 QCoreApplication.translate(
54 "ChromeImporter", 54 "ChromeImporter",
55 """Please choose the file to begin importing bookmarks."""), 55 """Please choose the file to begin importing bookmarks."""),
56 standardDir, 56 standardDir,
57 ) 57 )
58 elif id == "chromium": 58 elif sourceId == "chromium":
59 if Globals.isWindowsPlatform(): 59 if Globals.isWindowsPlatform():
60 standardDir = os.path.expandvars( 60 standardDir = os.path.expandvars(
61 "%USERPROFILE%\\AppData\\Local\\Google\\Chrome\\" 61 "%USERPROFILE%\\AppData\\Local\\Google\\Chrome\\"
62 "User Data\\Default") 62 "User Data\\Default")
63 else: 63 else:
74 "ChromeImporter", 74 "ChromeImporter",
75 """Please choose the file to begin importing bookmarks."""), 75 """Please choose the file to begin importing bookmarks."""),
76 standardDir, 76 standardDir,
77 ) 77 )
78 else: 78 else:
79 raise ValueError("Unsupported browser ID given ({0}).".format(id)) 79 raise ValueError(
80 "Unsupported browser ID given ({0}).".format(sourceId))
80 81
81 82
82 class ChromeImporter(BookmarksImporter): 83 class ChromeImporter(BookmarksImporter):
83 """ 84 """
84 Class implementing the Chrome bookmarks importer. 85 Class implementing the Chrome bookmarks importer.
85 """ 86 """
86 def __init__(self, id="", parent=None): 87 def __init__(self, sourceId="", parent=None):
87 """ 88 """
88 Constructor 89 Constructor
89 90
90 @param id source ID (string) 91 @param sourceId source ID (string)
91 @param parent reference to the parent object (QObject) 92 @param parent reference to the parent object (QObject)
92 """ 93 """
93 super(ChromeImporter, self).__init__(id, parent) 94 super(ChromeImporter, self).__init__(sourceId, parent)
94 95
95 self.__fileName = "" 96 self.__fileName = ""
96 97
97 def setPath(self, path): 98 def setPath(self, path):
98 """ 99 """

eric ide

mercurial