Helpviewer/Bookmarks/BookmarksImporters/OperaImporter.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3002
6ffc581f00f1
child 3058
0a02c433f52d
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 == "opera": 33 if id == "opera":
31 if Globals.isWindowsPlatform(): 34 if Globals.isWindowsPlatform():
32 standardDir = os.path.expandvars("%APPDATA%\\Opera\\Opera") 35 standardDir = os.path.expandvars("%APPDATA%\\Opera\\Opera")
33 elif Globals.isMacPlatform(): 36 elif Globals.isMacPlatform():
96 f = open(self.__fileName, "r", encoding="utf-8") 99 f = open(self.__fileName, "r", encoding="utf-8")
97 contents = f.read() 100 contents = f.read()
98 f.close() 101 f.close()
99 except IOError as err: 102 except IOError as err:
100 self._error = True 103 self._error = True
101 self._errorString = self.trUtf8("File '{0}' cannot be read.\nReason: {1}")\ 104 self._errorString = self.trUtf8(
105 "File '{0}' cannot be read.\nReason: {1}")\
102 .format(self.__fileName, str(err)) 106 .format(self.__fileName, str(err))
103 return None 107 return None
104 108
105 folderStack = [] 109 folderStack = []
106 110

eric ide

mercurial