Пример #1
0
	def update(self):
		self.name_field.set_value(self.color[3])
		txt = 'RGB: '
		if self.color[1][0]:
			txt += verbose_color(self.cms.get_rgb_color(self.color))
		else:
			txt += '---'
		self.rgb_txt.set_text(txt)

		txt = 'CMYK: '
		if self.color[1][1]:
			txt += verbose_color(self.cms.get_cmyk_color(self.color))
		else:
			txt += '---'
		self.cmyk_txt.set_text(txt)

		# Alpha slider
		start_clr = deepcopy(self.color)
		start_clr[2] = 0.0
		stop_clr = deepcopy(self.color)
		stop_clr[2] = 1.0
		start_clr = self.cms.get_rgba_color255(start_clr)
		stop_clr = self.cms.get_rgba_color255(stop_clr)
		self.alpha_slider.set_value(self.color[2], start_clr, stop_clr)
		self.alpha_spin.set_value(self.color[2] * 255.0)
Пример #2
0
	def convert_from_skp(self, skp_doc):
		skp_model = skp_doc.model
		self.model.childs.append(ASE_Group('' + skp_model.name))
		for item in skp_model.colors:
			if item[0] == uc2const.COLOR_SPOT:
				marker = ase_const.ASE_SPOT
				if item[1][0] and item[1][0]:
					if self.config.prefer_cmyk_for_spot:
						cs = ase_const.ASE_CMYK
						vals = tuple(deepcopy(item[1][1]))
					else:
						cs = ase_const.ASE_RGB
						vals = tuple(deepcopy(item[1][0]))
				elif item[1][0] and not item[1][0]:
					cs = ase_const.ASE_RGB
					vals = tuple(deepcopy(item[1][0]))
				else:
					cs = ase_const.ASE_CMYK
					vals = tuple(deepcopy(item[1][1]))
			else:
				marker = ase_const.ASE_PROCESS
				cs = ase_const.CS_MATCH[item[0]]
				vals = tuple(deepcopy(item[1]))
			if item[3]: name = '' + item[3]
			else: name = cms.verbose_color(item)
			self.model.childs.append(ASE_Color(name, cs, vals, marker))
		self.model.childs.append(ASE_Group_End())
		self.model.do_update(self)
Пример #3
0
	def set_color(self, color):
		if not color: return
		txt = '' + color[3]
		if not txt: txt = '???'
		self.name_field.set_text(txt)
		self.color_swatch.set_color(color)
		self.color_type.set_text(color[0] + ' ' + _('color'))
		if not color[0] == uc2const.COLOR_SPOT:
			self.line1.set_text(cms.verbose_color(color))
			self.line2.set_text('')
		else:
			txt1 = ''
			txt2 = ''
			if color[1][0]:
				txt1 = cms.verbose_color(self.cms.get_rgb_color(color))
			if color[1][1]:
				txt2 = cms.verbose_color(self.cms.get_cmyk_color(color))
			self.line1.set_text(txt1)
			self.line2.set_text(txt2)
		self.parent.layout()
Пример #4
0
	def update_from_obj(self, obj):
		text = _('Fill:')
		self.cms = self.app.current_doc.cms
		if self.app.insp.is_obj_pixmap(obj):
			text = _('Fg:')
			self.set_swatch_fill([sk2_const.FILL_EVENODD, sk2_const.FILL_SOLID,
								obj.style[3][0]])
		else:
			fill = obj.style[0]
			self.set_swatch_fill(fill)
			if fill:
				if fill[1] == sk2_const.FILL_SOLID:
					text += ' ' + cms.verbose_color(fill[2])
			else:
				text += ' ' + _('None')

		self.label.set_text(text)
Пример #5
0
	def _on_timer(self, event):
		mouse_pos = wx.GetMousePosition()
		x, y = self.GetScreenPosition()
		w, h = self.GetSize()
		rect = wx.Rect(x, y, w, h)
		if not rect.Inside(mouse_pos):
			self.timer.Stop()
			self.set_tip()
		else:
			if self.mouse_screen_pos == self.last_mouse_pos:
				if not self.tip:
					color = self.get_color_on_y(self.mouse_pos[1])
					color_name = ''
					color_txt = verbose_color(color)
					if not color[0] == 'SPOT' and color[3]:
						color_name = '' + color[3]
					self.tip = (color_name, color_txt)
					self.set_tip(self.tip)
			else:
				self.last_mouse_pos = self.mouse_screen_pos
				self.tip = ''
				self.set_tip()
Пример #6
0
	def __init__(self, color=None):
		CPL7_Color.__init__(self)
		if color:
			self.colorspace, self.valbytes = cdr_utils.get_cdr_color(color)
			if color[3]: self.name = '' + color[3]
			else: self.name = cms.verbose_color(color)
Пример #7
0
	def get_color_name(self, color):
		if not len(color) < 4 and color[3]:
			return color[3]
		else:
			return verbose_color(color)