示例#1
0
 def update(self):
     self.handles = {}
     self.clear_transforms()
     config = self.app.config
     profiles = [
         config.cms_rgb_profile, config.cms_cmyk_profile,
         config.cms_lab_profile, config.cms_gray_profile,
         config.cms_display_profile
     ]
     profile_dicts = [
         config.cms_rgb_profiles, config.cms_cmyk_profiles,
         config.cms_lab_profiles, config.cms_gray_profiles,
         config.cms_display_profiles
     ]
     index = 0
     profile_dir = self.app.appdata.app_color_profile_dir
     for item in CS + [
             COLOR_DISPLAY,
     ]:
         path = None
         profile = profiles[index]
         if profile and profile in profile_dicts[index]:
             profile_filename = profile_dicts[index][profile]
             path = os.path.join(profile_dir, profile_filename)
         if path:
             path = fsutils.get_sys_path(path)
             self.handles[item] = libcms.cms_open_profile_from_file(path)
         else:
             profile_dir = self.app.appdata.app_color_profile_dir
             filename = 'built-in_%s.icm' % item
             path = os.path.join(profile_dir, filename)
             path = fsutils.get_sys_path(path)
             self.handles[item] = libcms.cms_open_profile_from_file(path)
         index += 1
     self.use_cms = config.cms_use
     self.use_display_profile = config.cms_use_display_profile
     self.rgb_intent = config.cms_rgb_intent
     self.cmyk_intent = config.cms_cmyk_intent
     self.flags = config.cms_flags
     self.proofing = config.cms_proofing
     self.alarm_codes = config.cms_alarmcodes
     self.gamutcheck = config.cms_gamutcheck
     if self.gamutcheck:
         libcms.cms_set_alarm_codes(*val_255(self.alarm_codes))
     self.proof_for_spot = config.cms_proof_for_spot
     if self.proofing:
         self.flags = self.flags | uc2const.cmsFLAGS_SOFTPROOFING
     if self.gamutcheck:
         self.flags = self.flags | uc2const.cmsFLAGS_GAMUTCHECK
     if config.cms_bpc_flag:
         self.flags = self.flags | uc2const.cmsFLAGS_BLACKPOINTCOMPENSATION
     if config.cms_bpt_flag:
         self.flags = self.flags | uc2const.cmsFLAGS_PRESERVEBLACK
示例#2
0
	def update(self):
		self.handles = {}
		self.clear_transforms()
		profiles = [config.cms_rgb_profile,
					config.cms_cmyk_profile,
					config.cms_lab_profile,
					config.cms_gray_profile,
					config.cms_display_profile]
		profile_dicts = [config.cms_rgb_profiles,
						config.cms_cmyk_profiles,
						config.cms_lab_profiles,
						config.cms_gray_profiles,
						config.cms_display_profiles]
		index = 0
		profile_dir = self.app.appdata.app_color_profile_dir
		for item in CS + [COLOR_DISPLAY, ]:
			path = None
			profile = profiles[index]
			if profile and profile_dicts[index].has_key(profile):
				profile_filename = profile_dicts[index][profile]
				path = os.path.join(profile_dir, profile_filename)
			if path:
				self.handles[item] = libcms.cms_open_profile_from_file(path)
			else:
				profile_dir = self.app.appdata.app_color_profile_dir
				filename = 'built-in_%s.icm' % item
				path = os.path.join(profile_dir, filename)
				self.handles[item] = libcms.cms_open_profile_from_file(path)
			index += 1
		self.use_cms = config.cms_use
		self.use_display_profile = config.cms_use_display_profile
		self.rgb_intent = config.cms_rgb_intent
		self.cmyk_intent = config.cms_cmyk_intent
		self.flags = config.cms_flags
		self.proofing = config.cms_proofing
		self.alarm_codes = config.cms_alarmcodes
		self.gamutcheck = config.cms_gamutcheck
		if self.gamutcheck:
			libcms.cms_set_alarm_codes(*val_255(self.alarm_codes))
		self.proof_for_spot = config.cms_proof_for_spot
		if self.proofing:
			self.flags = self.flags | uc2const.cmsFLAGS_SOFTPROOFING
		if self.gamutcheck:
			self.flags = self.flags | uc2const.cmsFLAGS_GAMUTCHECK
		if config.cms_bpc_flag:
			self.flags = self.flags | uc2const.cmsFLAGS_BLACKPOINTCOMPENSATION
		if config.cms_bpt_flag:
			self.flags = self.flags | uc2const.cmsFLAGS_PRESERVEBLACK
示例#3
0
	def test15_set_alarm_codes_with_lagest_values(self):
		try:
			libcms.cms_set_alarm_codes(0, 255, 255)
			libcms.cms_set_alarm_codes(255, 0, 255)
			libcms.cms_set_alarm_codes(255, 255, 0)
		except libcms.CmsError:
			self.fail()
示例#4
0
	def test14_set_alarm_codes_with_null_values(self):
		try:
			libcms.cms_set_alarm_codes(0, 1, 1)
			libcms.cms_set_alarm_codes(1, 0, 1)
			libcms.cms_set_alarm_codes(1, 1, 0)
		except libcms.CmsError:
			self.fail()
示例#5
0
文件: __init__.py 项目: sahwar/sk1-wx
 def test15_set_alarm_codes_with_lagest_values(self):
     try:
         libcms.cms_set_alarm_codes(0, 255, 255)
         libcms.cms_set_alarm_codes(255, 0, 255)
         libcms.cms_set_alarm_codes(255, 255, 0)
     except libcms.CmsError:
         self.fail()
示例#6
0
文件: __init__.py 项目: sahwar/sk1-wx
 def test14_set_alarm_codes_with_null_values(self):
     try:
         libcms.cms_set_alarm_codes(0, 1, 1)
         libcms.cms_set_alarm_codes(1, 0, 1)
         libcms.cms_set_alarm_codes(1, 1, 0)
     except libcms.CmsError:
         self.fail()
示例#7
0
def test_set_alarm_codes_with_lagest_values():
    try:
        libcms.cms_set_alarm_codes(0, 255, 255)
        libcms.cms_set_alarm_codes(255, 0, 255)
        libcms.cms_set_alarm_codes(255, 255, 0)
    except libcms.CmsError:
        assert False
示例#8
0
def test_set_alarm_codes_with_null_values():
    try:
        libcms.cms_set_alarm_codes(0, 1, 1)
        libcms.cms_set_alarm_codes(1, 0, 1)
        libcms.cms_set_alarm_codes(1, 1, 0)
    except libcms.CmsError:
        assert False
示例#9
0
	def test16_set_alarm_codes_with_incorrect_values(self):
		counter = 0
		try:
			libcms.cms_set_alarm_codes(256, 255, 255)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes(0, 256, 255)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes(0, 255, 256)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes(-1, 255, 255)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes(255, -1, 255)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes(255, 255, -1)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes(255, 255, .1)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes(255, .1, 255)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes(.1, 255, 255)
		except libcms.CmsError:
			counter += 1

		try:
			libcms.cms_set_alarm_codes("#fff", "#fff", "#fff")
		except libcms.CmsError:
			counter += 1

		self.assertEqual(counter, 10)
示例#10
0
文件: __init__.py 项目: sahwar/sk1-wx
    def test16_set_alarm_codes_with_incorrect_values(self):
        counter = 0
        try:
            libcms.cms_set_alarm_codes(256, 255, 255)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes(0, 256, 255)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes(0, 255, 256)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes(-1, 255, 255)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes(255, -1, 255)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes(255, 255, -1)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes(255, 255, .1)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes(255, .1, 255)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes(.1, 255, 255)
        except libcms.CmsError:
            counter += 1

        try:
            libcms.cms_set_alarm_codes("#fff", "#fff", "#fff")
        except libcms.CmsError:
            counter += 1

        self.assertEqual(counter, 10)
示例#11
0
def test_set_alarm_codes_with_incorrect_values():
    counter = 0
    try:
        libcms.cms_set_alarm_codes(256, 255, 255)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes(0, 256, 255)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes(0, 255, 256)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes(-1, 255, 255)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes(255, -1, 255)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes(255, 255, -1)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes(255, 255, .1)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes(255, .1, 255)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes(.1, 255, 255)
    except libcms.CmsError:
        counter += 1

    try:
        libcms.cms_set_alarm_codes("#fff", "#fff", "#fff")
    except libcms.CmsError:
        counter += 1

    assert counter == 10