def svg_saver(sk2_doc, filename=None, fileptr=None, translate=True, cnf=None, **kw): cnf = merge_cnf(cnf, kw) if sk2_doc.cid == uc2const.SVG: translate = False if translate: svg_doc = SVG_Presenter(sk2_doc.appdata, cnf) svg_doc.translate_from_sk2(sk2_doc) svg_doc.save(filename, fileptr) svg_doc.close() else: sk2_doc.save(filename, fileptr)
def svg_loader(appdata, filename=None, fileptr=None, translate=True, cnf=None, **kw): cnf = merge_cnf(cnf, kw) svg_doc = SVG_Presenter(appdata, cnf) svg_doc.load(filename, fileptr) if translate: sk2_doc = SK2_Presenter(appdata, cnf) if filename: sk2_doc.doc_file = filename svg_doc.translate_to_sk2(sk2_doc) svg_doc.close() return sk2_doc return svg_doc
def svgz_saver(sk2_doc, filename=None, fileptr=None, translate=True, cnf=None, **kw): cnf = merge_cnf(cnf, kw) if sk2_doc.cid == uc2const.SVG: translate = False path = get_sys_path(filename) fileptr = gzip.open(path, 'wb') if translate: svg_doc = SVG_Presenter(sk2_doc.appdata, cnf) svg_doc.translate_from_sk2(sk2_doc) svg_doc.save(None, fileptr) svg_doc.close() else: sk2_doc.save(None, fileptr)
def svg_saver(sk2_doc, filename=None, fileptr=None, translate=True, cnf={}, **kw): if kw: cnf.update(kw) if sk2_doc.cid == uc2const.SVG: translate = False if translate: svg_doc = SVG_Presenter(sk2_doc.appdata, cnf) svg_doc.translate_from_sk2(sk2_doc) svg_doc.save(filename, fileptr) svg_doc.close() else: sk2_doc.save(filename, fileptr)
def svgz_loader(appdata, filename=None, fileptr=None, translate=True, cnf=None, **kw): cnf = merge_cnf(cnf, kw) svg_doc = SVG_Presenter(appdata, cnf) path = get_sys_path(filename) fileptr = gzip.open(path, 'rb') svg_doc.load(None, fileptr) if translate: sk2_doc = SK2_Presenter(appdata, cnf) if filename: sk2_doc.doc_file = filename svg_doc.translate_to_sk2(sk2_doc) svg_doc.close() return sk2_doc return svg_doc
def svg_loader(appdata, filename=None, fileptr=None, translate=True, cnf={}, **kw): if kw: cnf.update(kw) svg_doc = SVG_Presenter(appdata, cnf) svg_doc.load(filename, fileptr) if translate: sk2_doc = SK2_Presenter(appdata, cnf) if filename: sk2_doc.doc_file = filename svg_doc.translate_to_sk2(sk2_doc) svg_doc.close() return sk2_doc return svg_doc
def svgz_saver(sk2_doc, filename=None, fileptr=None, translate=True, cnf=None, **kw): cnf = merge_cnf(cnf, kw) if sk2_doc.cid == uc2const.SVG: translate = False fileptr = gzip.GzipFile(upath(filename), mode='wb', fileobj=fileptr) if translate: svg_doc = SVG_Presenter(sk2_doc.appdata, cnf) svg_doc.translate_from_sk2(sk2_doc) svg_doc.save(None, fileptr) svg_doc.close() else: sk2_doc.save(None, fileptr)
def svgz_loader(appdata, filename=None, fileptr=None, translate=True, cnf=None, **kw): cnf = merge_cnf(cnf, kw) svg_doc = SVG_Presenter(appdata, cnf) fileptr = gzip.GzipFile(upath(filename), mode='rb', fileobj=fileptr) svg_doc.load(None, fileptr) if translate: sk2_doc = SK2_Presenter(appdata, cnf) if filename: sk2_doc.doc_file = filename svg_doc.translate_to_sk2(sk2_doc) svg_doc.close() return sk2_doc return svg_doc