Merge pull request #21

ZipDocument class vars should be instance vars
This commit is contained in:
Stijn Van Campenhout
2021-05-30 13:27:32 +02:00
committed by GitHub

View File

@@ -113,6 +113,14 @@ class ZipDocument(object):
rm: A list of :class:rmapy.document.RmPage in this zip.
"""
def __init__(self, _id=None, doc=None, file=None):
"""Create a new instance of a ZipDocument
Args:
_id: Can be left empty to generate one
doc: a raw pdf, epub or rm (.lines) file.
file: a zipfile to convert from
"""
# {"extraMetadata": {},
# "fileType": "pdf",
# "pageCount": 0,
@@ -121,7 +129,7 @@ class ZipDocument(object):
# "margins": 180,
# "textScale": 1,
# "transform": {}}
content = {
self.content = {
"extraMetadata": {
# "LastBrushColor": "Black",
# "LastBrushThicknessScale": "2",
@@ -159,7 +167,7 @@ class ZipDocument(object):
}
}
metadata = {
self.metadata = {
"deleted": False,
"lastModified": "1568368808000",
"metadatamodified": False,
@@ -172,22 +180,14 @@ class ZipDocument(object):
"VissibleName": "New Document"
}
pagedata = "b''"
self.pagedata = "b''"
zipfile = BytesIO()
pdf = None
epub = None
rm: List[RmPage] = []
ID = None
self.zipfile = BytesIO()
self.pdf = None
self.epub = None
self.rm: List[RmPage] = []
self.ID = None
def __init__(self, _id=None, doc=None, file=None):
"""Create a new instance of a ZipDocument
Args:
_id: Can be left empty to generate one
doc: a raw pdf, epub or rm (.lines) file.
file: a zipfile to convert from
"""
if not _id:
_id = str(uuid4())
self.ID = _id