def __init__(self, gsfole): from gi.repository.Gsf import Input from gi.repository.Gsf import InfileMSOle if isinstance(gsfole, InfileMSOle): self.gsfole = gsfole elif isinstance(gsfole, Input): try: self.gsfole = InfileMSOle.new(gsfole) except Exception: raise InvalidOleStorageError() else: try: self.gsfole = open(gsfole) except Exception: raise InvalidOleStorageError()
def open(path): from gi.repository.Gsf import InputGio from gi.repository.Gsf import InfileMSOle inp = InputGio.new_for_path(path) return InfileMSOle.new(inp)