def __init__(self, appdata, cnf={}, filepath=None): self.config = SVG_Config() config_file = os.path.join(appdata.app_config_dir, self.config.filename) self.config.load(config_file) self.config.update(cnf) self.appdata = appdata self.cms = self.appdata.app.default_cms self.loader = Advanced_XML_Loader() self.saver = Advanced_XML_Saver() self.methods = SVG_Methods(self) if filepath is None: self.new() else: self.load(filepath)
class SVG_Presenter(TaggedModelPresenter): cid = uc2const.SVG config = None doc_file = '' resources = None cms = None def __init__(self, appdata, cnf=None, filepath=None): cnf = cnf or {} self.config = SVG_Config() config_file = os.path.join(appdata.app_config_dir, self.config.filename) self.config.load(config_file) self.config.update(cnf) self.appdata = appdata self.cms = self.appdata.app.default_cms self.loader = Advanced_XML_Loader() self.saver = Advanced_XML_Saver() self.methods = SVG_Methods(self) if filepath is None: self.new() else: self.load(filepath) def new(self): self.model = create_new_svg(self.config) self.update() def update(self, action=False): TaggedModelPresenter.update(self, action) self.methods.update() def translate_from_sk2(self, sk2_doc): translator = SK2_to_SVG_Translator() translator.translate(sk2_doc, self) def translate_to_sk2(self, sk2_doc): translator = SVG_to_SK2_Translator() translator.translate(self, sk2_doc)
class SVG_Presenter(TaggedModelPresenter): cid = uc2const.SVG config = None doc_file = '' resources = None cms = None def __init__(self, appdata, cnf={}, filepath=None): self.config = SVG_Config() config_file = os.path.join(appdata.app_config_dir, self.config.filename) self.config.load(config_file) self.config.update(cnf) self.appdata = appdata self.cms = self.appdata.app.default_cms self.loader = Advanced_XML_Loader() self.saver = Advanced_XML_Saver() self.methods = SVG_Methods(self) if filepath is None: self.new() else: self.load(filepath) def new(self): self.model = create_new_svg(self.config) self.update() def update(self, action=False): TaggedModelPresenter.update(self, action) self.methods.update() def translate_from_sk2(self, sk2_doc): translator = SK2_to_SVG_Translator() translator.translate(sk2_doc, self) def translate_to_sk2(self, sk2_doc): translator = SVG_to_SK2_Translator() translator.translate(self, sk2_doc)