Helpviewer/Bookmarks/BookmarksImporters/BookmarksImporter.py

Sun, 18 Mar 2012 10:07:28 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 18 Mar 2012 10:07:28 +0100
changeset 1713
56fdde8a2441
child 1965
96f5a76e1845
permissions
-rw-r--r--

Added a bookmarks importer to get them directly from other browsers files.

# -*- coding: utf-8 -*-

# Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a base class for the bookmarks importers.
"""

from PyQt4.QtCore import QObject

class BookmarksImporter(QObject):
    """
    Class implementing the base class for the bookmarks importers.
    """
    def __init__(self, id="", parent=None):
        """
        Constructor
        
        @param id source ID (string)
        @param parent reference to the parent object (QObject)
        """
        super().__init__(parent)
        
        self._path = ""
        self._file = ""
        self._error = False
        self._errorString = ""
        self._id = id
    
    def setPath(self, path):
        """
        Public method to set the path of the bookmarks file or directory.
        
        @param path bookmarks file or directory (string)
        """
        raise NotImplementedError
    
    def open(self):
        """
        Public method to open the bookmarks file.
        
        @return flag indicating success (boolean)
        """
        raise NotImplementedError
    
    def importedBookmarks(self):
        """
        Public method to get the imported bookmarks.
        
        @return imported bookmarks (BookmarkNode)
        """
        raise NotImplementedError
    
    def error(self):
        """
        Public method to check for an error.
        
        @return flag indicating an error (boolean)
        """
        return self._error
    
    def errorString(self):
        """
        Public method to get the error description.
        
        @return error description (string)
        """
        return self._errorString

eric ide

mercurial