Exemplo n.º 1
0
    def __init__(self,
                 name=None,
                 archive=None,
                 contents=None,
                 index=None,
                 metadata=None):
        self.name = name

        if archive is None:
            self.archive = DummyArchive()
        else:
            self.archive = archive

        if contents is None:
            self.contents = Contents()
        else:
            self.contents = contents

        if index is None:
            self.index = Index()
        else:
            self.index = index

        if metadata is None:
            self.metadata = {}
        else:
            self.metadata = metadata
Exemplo n.º 2
0
	def __init__(self, name=None, archive=None, contents=None, index=None, 
			metadata=None):
		self.name = name
		
		if archive is None:
			self.archive = DummyArchive()
		else:
			self.archive = archive

		if contents is None:
			self.contents = Contents()
		else:
			self.contents = contents
			
		if index is None:
			self.index = Index()
		else:
			self.index = index

		if metadata is None:
			self.metadata = {}
		else:
			self.metadata = metadata
Exemplo n.º 3
0
class Book:
	"""Generic HTML Help book.
	
	@ivar name: Name of the book.
	@type archive: L{htmlhelp.archive.Archive}
	@ivar archive: Archive with the HTML files, pictures, etc.
	@type contents: L{Contents}
	@ivar contents: Table of Contents.
	@type index: L{Index}
	@ivar index: Index.
	@type metadata: dict
	@ivar metadata: Book metadata.
	"""
	
	def __init__(self, name=None, archive=None, contents=None, index=None, 
			metadata=None):
		self.name = name
		
		if archive is None:
			self.archive = DummyArchive()
		else:
			self.archive = archive

		if contents is None:
			self.contents = Contents()
		else:
			self.contents = contents
			
		if index is None:
			self.index = Index()
		else:
			self.index = index

		if metadata is None:
			self.metadata = {}
		else:
			self.metadata = metadata
		
	def _get_title(self):
		"""Get the book title, which is the name in the contents root entry."""

		return self.contents.name

	title = property(_get_title, doc="""Book title.""")

	def _get_default_link(self):
		"""Get the book title, which is the link in the contents root entry."""

		return self.contents.link

	default_link = property(_get_default_link, doc="""Default link.""")
	
	def list(self):
		"""List the pages in the book."""

		return self.archive.keys()
		
	def resource(self, path):
		"""Return a file-like object with the required link."""
		
		return self.archive[path]
Exemplo n.º 4
0
class Book:
    """Generic HTML Help book.
	
	@ivar name: Name of the book.
	@type archive: L{htmlhelp.archive.Archive}
	@ivar archive: Archive with the HTML files, pictures, etc.
	@type contents: L{Contents}
	@ivar contents: Table of Contents.
	@type index: L{Index}
	@ivar index: Index.
	@type metadata: dict
	@ivar metadata: Book metadata.
	"""
    def __init__(self,
                 name=None,
                 archive=None,
                 contents=None,
                 index=None,
                 metadata=None):
        self.name = name

        if archive is None:
            self.archive = DummyArchive()
        else:
            self.archive = archive

        if contents is None:
            self.contents = Contents()
        else:
            self.contents = contents

        if index is None:
            self.index = Index()
        else:
            self.index = index

        if metadata is None:
            self.metadata = {}
        else:
            self.metadata = metadata

    def _get_title(self):
        """Get the book title, which is the name in the contents root entry."""

        return self.contents.name

    title = property(_get_title, doc="""Book title.""")

    def _get_default_link(self):
        """Get the book title, which is the link in the contents root entry."""

        return self.contents.link

    default_link = property(_get_default_link, doc="""Default link.""")

    def list(self):
        """List the pages in the book."""

        return self.archive.keys()

    def resource(self, path):
        """Return a file-like object with the required link."""

        return self.archive[path]
Exemplo n.º 5
0
 def setUp(self):
     self.archive = DummyArchive()