def __init__(self, appdata, cnf={}): self.config = SK_Config() config_file = os.path.join(appdata.app_config_dir, 'sk_config.xml') self.config.load(config_file) self.config.update(cnf) self.appdata = appdata self.loader = SK_Loader() self.saver = SK_Saver() self.methods = SK_Methods(self) self.resources = {} self.new()
class SK_Presenter(TextModelPresenter): cid = uc2const.SK config = None doc_file = '' resources = None def __init__(self, appdata, cnf={}): self.config = SK_Config() config_file = os.path.join(appdata.app_config_dir, 'sk_config.xml') self.config.load(config_file) self.config.update(cnf) self.appdata = appdata self.loader = SK_Loader() self.saver = SK_Saver() self.methods = SK_Methods(self) self.resources = {} self.new() def new(self): self.model = create_new_doc(self.config) self.update() def translate_from_sk2(self, sk2_doc): translator = SK2_to_SK_Translator() translator.translate(sk2_doc, self) def translate_to_sk2(self, sk2_doc): translator = SK_to_SK2_Translator() translator.translate(self, sk2_doc) def update(self, action=False): TextModelPresenter.update(self, action) if not self.model is None: self.methods.update()