Helpviewer/Bookmarks/BookmarksImporters/OperaImporter.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3484
645c12de6b0c
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
82 82
83 @return flag indicating success (boolean) 83 @return flag indicating success (boolean)
84 """ 84 """
85 if not os.path.exists(self.__fileName): 85 if not os.path.exists(self.__fileName):
86 self._error = True 86 self._error = True
87 self._errorString = self.trUtf8("File '{0}' does not exist.")\ 87 self._errorString = self.tr("File '{0}' does not exist.")\
88 .format(self.__fileName) 88 .format(self.__fileName)
89 return False 89 return False
90 return True 90 return True
91 91
92 def importedBookmarks(self): 92 def importedBookmarks(self):
99 f = open(self.__fileName, "r", encoding="utf-8") 99 f = open(self.__fileName, "r", encoding="utf-8")
100 contents = f.read() 100 contents = f.read()
101 f.close() 101 f.close()
102 except IOError as err: 102 except IOError as err:
103 self._error = True 103 self._error = True
104 self._errorString = self.trUtf8( 104 self._errorString = self.tr(
105 "File '{0}' cannot be read.\nReason: {1}")\ 105 "File '{0}' cannot be read.\nReason: {1}")\
106 .format(self.__fileName, str(err)) 106 .format(self.__fileName, str(err))
107 return None 107 return None
108 108
109 folderStack = [] 109 folderStack = []
125 node.title = line.replace("NAME=", "").replace("&", "&&") 125 node.title = line.replace("NAME=", "").replace("&", "&&")
126 elif line.startswith("URL="): 126 elif line.startswith("URL="):
127 node.url = line.replace("URL=", "") 127 node.url = line.replace("URL=", "")
128 128
129 if self._id == "opera": 129 if self._id == "opera":
130 importRootNode.title = self.trUtf8("Opera Import") 130 importRootNode.title = self.tr("Opera Import")
131 else: 131 else:
132 importRootNode.title = self.trUtf8("Imported {0}")\ 132 importRootNode.title = self.tr("Imported {0}")\
133 .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) 133 .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate))
134 return importRootNode 134 return importRootNode

eric ide

mercurial