コード例 #1
0
class GPL_Presenter(TextModelPresenter):
    cid = uc2const.GPL

    config = None
    doc_file = ''
    resources = None
    cms = None

    def __init__(self, appdata, cnf=None, filepath=None):
        cnf = cnf or {}
        self.config = GPL_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 = GPL_Loader()
        self.saver = GPL_Saver()
        if filepath is None:
            self.new()
        else:
            self.load(filepath)

    def new(self):
        self.model = GPL_Palette()
        self.update()

    def update(self, action=False):
        pass

    def convert_from_skp(self, skp_doc):
        skp_model = skp_doc.model
        self.model.name = skp_model.name
        self.model.columns = skp_model.columns
        self.model.comments = 'Palette source: ' + skp_model.source
        self.model.comments += '\n' + skp_model.comments
        for item in skp_model.colors:
            r, g, b = self.cms.get_rgb_color255(item)
            self.model.colors.append([r, g, b, item[3]])

    def convert_to_skp(self, skp_doc):
        skp_model = skp_doc.model
        skp_model.name = self.model.name
        skp_model.source = self.config.source
        skp_model.columns = self.model.columns
        skp_model.comments = self.model.comments
        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.colors:
            r, g, b, name = item
            r, g, b = cms.val_255_to_dec((r, g, b))
            skp_model.colors.append([COLOR_RGB, [r, g, b], 1.0, name])
コード例 #2
0
ファイル: gpl_presenter.py プロジェクト: Scrik/sk1-wx
class GPL_Presenter(TextModelPresenter):

	cid = uc2const.GPL

	config = None
	doc_file = ''
	resources = None
	cms = None

	def __init__(self, appdata, cnf={}, filepath=None):
		self.config = GPL_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 = GPL_Loader()
		self.saver = GPL_Saver()
		if filepath is None:
			self.new()
		else:
			self.load(filepath)

	def new(self):
		self.model = GPL_Palette()
		self.update()

	def update(self, action=False):pass

	def convert_from_skp(self, skp_doc):
		skp_model = skp_doc.model
		self.model.name = '' + skp_model.name
		self.model.columns = skp_model.columns
		self.model.comments = 'Palette source: ' + skp_model.source
		self.model.comments += '\n' + skp_model.comments
		for item in skp_model.colors:
			r, g, b = self.cms.get_rgb_color255(item)
			self.model.colors.append([r, g, b, '' + item[3]])

	def convert_to_skp(self, skp_doc):
		skp_model = skp_doc.model
		skp_model.name = '' + self.model.name
		skp_model.source = '' + self.config.source
		skp_model.columns = self.model.columns
		skp_model.comments = '' + self.model.comments
		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.colors:
			r, g, b, name = item
			r, g, b = cms.val_255_to_dec((r, g, b))
			skp_model.colors.append([COLOR_RGB, [r, g, b], 1.0, name])
コード例 #3
0
 def __init__(self, appdata, cnf=None, filepath=None):
     cnf = cnf or {}
     self.config = GPL_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 = GPL_Loader()
     self.saver = GPL_Saver()
     if filepath is None:
         self.new()
     else:
         self.load(filepath)
コード例 #4
0
ファイル: gpl_presenter.py プロジェクト: Scrik/sk1-wx
	def __init__(self, appdata, cnf={}, filepath=None):
		self.config = GPL_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 = GPL_Loader()
		self.saver = GPL_Saver()
		if filepath is None:
			self.new()
		else:
			self.load(filepath)