WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py

changeset 5605
1950fe1a32c4
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
equal deleted inserted replaced
5604:b047181a4a33 5605:1950fe1a32c4
17 17
18 import UI.PixmapCache 18 import UI.PixmapCache
19 import Globals 19 import Globals
20 20
21 21
22 def getImporterInfo(id): 22 def getImporterInfo(sourceId):
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 @param sourceId id of the browser ("chrome" or "chromium")
27 @return tuple with an icon (QPixmap), readable name (string), name of 27 @return tuple with an icon (QPixmap), readable name (string), name of
28 the default bookmarks file (string), an info text (string), 28 the default bookmarks file (string), an info text (string),
29 a prompt (string) and the default directory of the bookmarks file 29 a prompt (string) and the default directory of the bookmarks file
30 (string) 30 (string)
31 @exception ValueError raised to indicate an invalid browser ID 31 @exception ValueError raised to indicate an invalid browser ID
32 """ 32 """
33 if id == "opera": 33 if sourceId == "opera":
34 if Globals.isWindowsPlatform(): 34 if Globals.isWindowsPlatform():
35 standardDir = os.path.expandvars("%APPDATA%\\Opera\\Opera") 35 standardDir = os.path.expandvars("%APPDATA%\\Opera\\Opera")
36 elif Globals.isMacPlatform(): 36 elif Globals.isMacPlatform():
37 standardDir = os.path.expanduser( 37 standardDir = os.path.expanduser(
38 "~/Library/Opera") 38 "~/Library/Opera")
50 "OperaImporter", 50 "OperaImporter",
51 """Please choose the file to begin importing bookmarks."""), 51 """Please choose the file to begin importing bookmarks."""),
52 standardDir, 52 standardDir,
53 ) 53 )
54 else: 54 else:
55 raise ValueError("Unsupported browser ID given ({0}).".format(id)) 55 raise ValueError(
56 "Unsupported browser ID given ({0}).".format(sourceId))
56 57
57 58
58 class OperaImporter(BookmarksImporter): 59 class OperaImporter(BookmarksImporter):
59 """ 60 """
60 Class implementing the Opera bookmarks importer. 61 Class implementing the Opera bookmarks importer.
61 """ 62 """
62 def __init__(self, id="", parent=None): 63 def __init__(self, sourceId="", parent=None):
63 """ 64 """
64 Constructor 65 Constructor
65 66
66 @param id source ID (string) 67 @param sourceId source ID (string)
67 @param parent reference to the parent object (QObject) 68 @param parent reference to the parent object (QObject)
68 """ 69 """
69 super(OperaImporter, self).__init__(id, parent) 70 super(OperaImporter, self).__init__(sourceId, parent)
70 71
71 self.__fileName = "" 72 self.__fileName = ""
72 73
73 def setPath(self, path): 74 def setPath(self, path):
74 """ 75 """

eric ide

mercurial