WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py

changeset 5605
1950fe1a32c4
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
--- a/WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py	Sat Mar 11 18:08:42 2017 +0100
+++ b/WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py	Sat Mar 11 19:17:59 2017 +0100
@@ -19,18 +19,18 @@
 import Globals
 
 
-def getImporterInfo(id):
+def getImporterInfo(sourceId):
     """
     Module function to get information for the given source id.
     
-    @param id id of the browser ("chrome" or "chromium")
+    @param sourceId id of the browser ("chrome" or "chromium")
     @return tuple with an icon (QPixmap), readable name (string), name of
         the default bookmarks file (string), an info text (string),
         a prompt (string) and the default directory of the bookmarks file
         (string)
     @exception ValueError raised to indicate an invalid browser ID
     """
-    if id == "ie":
+    if sourceId == "ie":
         if Globals.isWindowsPlatform():
             standardDir = os.path.expandvars(
                 "%USERPROFILE%\\Favorites")
@@ -51,21 +51,22 @@
             standardDir,
         )
     else:
-        raise ValueError("Unsupported browser ID given ({0}).".format(id))
+        raise ValueError(
+            "Unsupported browser ID given ({0}).".format(sourceId))
 
 
 class IExplorerImporter(BookmarksImporter):
     """
     Class implementing the Chrome bookmarks importer.
     """
-    def __init__(self, id="", parent=None):
+    def __init__(self, sourceId="", parent=None):
         """
         Constructor
         
-        @param id source ID (string)
+        @param sourceId source ID (string)
         @param parent reference to the parent object (QObject)
         """
-        super(IExplorerImporter, self).__init__(id, parent)
+        super(IExplorerImporter, self).__init__(sourceId, parent)
         
         self.__fileName = ""
     
@@ -107,11 +108,12 @@
         importRootNode = BookmarkNode(BookmarkNode.Folder)
         folders[self.__fileName] = importRootNode
         
-        for dir, subdirs, files in os.walk(self.__fileName):
+        for directory, subdirs, files in os.walk(self.__fileName):
             for subdir in subdirs:
-                path = os.path.join(dir, subdir)
-                if dir in folders:
-                    folder = BookmarkNode(BookmarkNode.Folder, folders[dir])
+                path = os.path.join(directory, subdir)
+                if directory in folders:
+                    folder = BookmarkNode(BookmarkNode.Folder,
+                                          folders[directory])
                 else:
                     folder = BookmarkNode(BookmarkNode.Folder, importRootNode)
                 folder.title = subdir.replace("&", "&&")
@@ -120,7 +122,7 @@
             for file in files:
                 name, ext = os.path.splitext(file)
                 if ext.lower() == ".url":
-                    path = os.path.join(dir, file)
+                    path = os.path.join(directory, file)
                     try:
                         f = open(path, "r")
                         contents = f.read()
@@ -133,9 +135,9 @@
                             url = line.replace("URL=", "")
                             break
                     if url:
-                        if dir in folders:
+                        if directory in folders:
                             bookmark = BookmarkNode(BookmarkNode.Bookmark,
-                                                    folders[dir])
+                                                    folders[directory])
                         else:
                             bookmark = BookmarkNode(BookmarkNode.Bookmark,
                                                     importRootNode)

eric ide

mercurial