Exemple #1
0
 def __init__(self, appdata, cnf={}):
     self.config = CPL_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.loader = CPL_Loader()
     self.saver = CPL_Saver()
     self.new()
Exemple #2
0
 def __init__(self, appdata, cnf={}):
     self.config = CPL_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.loader = CPL_Loader()
     self.saver = CPL_Saver()
     self.new()
Exemple #3
0
class CPL_Presenter(BinaryModelPresenter):
    cid = uc2const.CPL

    config = None
    doc_file = ''
    model = None

    def __init__(self, appdata, cnf=None):
        cnf = cnf or {}
        self.config = CPL_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.loader = CPL_Loader()
        self.saver = CPL_Saver()
        self.new()

    def new(self):
        self.model = CPL12_Palette()

    def convert_from_skp(self, skp_doc):
        skp_model = skp_doc.model
        name = skp_model.name
        self.model = CPL12_Palette(name)
        for color in skp_model.colors:
            self.model.childs.append(CPL12_Color(color))
        self.model.update_for_save()

    def convert_to_skp(self, skp_doc):
        skp_model = skp_doc.model
        skp_model.name = self.model.name
        skp_model.source = self.config.source
        if self.doc_file:
            filename = os.path.basename(self.doc_file)
            if skp_model.comments:
                skp_model.comments += '\n'
            skp_model.comments += 'Converted from %s' % filename
        for item in self.model.childs:
            skp_model.colors.append(item.get_color())
Exemple #4
0
class CPL_Presenter(BinaryModelPresenter):

    cid = uc2const.CPL

    config = None
    doc_file = ""
    model = None

    def __init__(self, appdata, cnf={}):
        self.config = CPL_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.loader = CPL_Loader()
        self.saver = CPL_Saver()
        self.new()

    def new(self):
        self.model = CPL12_Palette()

    def convert_from_skp(self, skp_doc):
        skp_model = skp_doc.model
        name = "" + skp_model.name
        self.model = CPL12_Palette(name)
        for color in skp_model.colors:
            self.model.childs.append(CPL12_Color(color))
        self.model.update_for_save()

    def convert_to_skp(self, skp_doc):
        skp_model = skp_doc.model
        skp_model.name = "" + self.model.name
        skp_model.source = "" + self.config.source
        if self.doc_file:
            filename = os.path.basename(self.doc_file)
            if skp_model.comments:
                skp_model.comments += "n"
            skp_model.comments += "Converted from %s" % filename
        for item in self.model.childs:
            skp_model.colors.append(item.get_color())