def wmf_loader(appdata, filename=None, fileptr=None, translate=True, cnf={}, **kw): if kw: cnf.update(kw) wmf_doc = WMF_Presenter(appdata, cnf) wmf_doc.load(filename, fileptr) if translate: sk2_doc = SK2_Presenter(appdata, cnf) if filename: sk2_doc.doc_file = filename wmf_doc.translate_to_sk2(sk2_doc) wmf_doc.close() return sk2_doc return wmf_doc
def wmf_saver(sk2_doc, filename=None, fileptr=None, translate=True, cnf={}, **kw): if kw: cnf.update(kw) if sk2_doc.cid == uc2const.WMF: translate = False if translate: wmf_doc = WMF_Presenter(sk2_doc.appdata, cnf) try: wmf_doc.translate_from_sk2(sk2_doc) except: for item in sys.exc_info(): print item wmf_doc.save(filename, fileptr) wmf_doc.close() else: sk2_doc.save(filename, fileptr)
def wmf_saver(sk2_doc, filename=None, fileptr=None, translate=True, cnf={}, **kw): if kw: cnf.update(kw) if sk2_doc.cid == uc2const.WMF: translate = False if translate: wmf_doc = WMF_Presenter(sk2_doc.appdata, cnf) wmf_doc.translate_from_sk2(sk2_doc) wmf_doc.save(filename, fileptr) wmf_doc.close() else: sk2_doc.save(filename, fileptr)
def wmf_saver(sk2_doc, filename=None, fileptr=None, translate=True, cnf=None, **kw): cnf = merge_cnf(cnf, kw) if sk2_doc.cid == uc2const.WMF: translate = False if translate: wmf_doc = WMF_Presenter(sk2_doc.appdata, cnf) wmf_doc.translate_from_sk2(sk2_doc) wmf_doc.save(filename, fileptr) wmf_doc.close() else: sk2_doc.save(filename, fileptr)