Added SegmentParser.reconstruct_segments to fill segments with actual data

* used when restoring segment parser from json
This commit is contained in:
Rob McMullen 2018-10-29 13:32:59 -07:00
parent 50488fc2e5
commit 40a5a3207a

View File

@ -78,6 +78,12 @@ class SegmentParser:
raise errors.InvalidSegmentParser(e) raise errors.InvalidSegmentParser(e)
self.segments.extend(self.image.segments) self.segments.extend(self.image.segments)
def reconstruct_segments(self, new_rawdata):
self.image = self.get_image(new_rawdata)
self.segment_data = new_rawdata
for s in self.segments:
s.reconstruct_raw(new_rawdata)
def get_image(self, r): def get_image(self, r):
return self.image_type(r) return self.image_type(r)