Esempio n. 1
0
    def __init__(self, parent, **kw):
        TFrame.__init__(self, parent, style='FlatFrame', **kw)

        spot_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        spot_frame.pack(side=TOP)

        label = TLabel(spot_frame, text=_('Color name:'), justify=LEFT)
        label.pack(side=TOP)

        self.colorname_value = StringVar('')

        self.colorname = TEntrybox(spot_frame,
                                   text='',
                                   width=25,
                                   textvariable=self.colorname_value)
        self.colorname.set_state('readonly')
        self.colorname.pack(side=BOTTOM, fill=X)

        cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        cmyk_frame.pack(side=TOP)

        self.CMYK_label = TLabel(cmyk_frame,
                                 text='C:\nM:\nY:\nK:',
                                 justify=LEFT)
        self.CMYK_label.pack(side=LEFT, padx=10)

        self.RGB_label = TLabel(cmyk_frame, text='R:\nG:\nB:', justify=LEFT)
        self.RGB_label.pack(side=LEFT, padx=10)

        self.HTML_label = TLabel(self, text='HTML:', justify=LEFT)
        self.HTML_label.pack(side=BOTTOM, pady=5)
Esempio n. 2
0
	def build_dlg(self):
		root = self.top

		top = TFrame(root, borderwidth=5, style='FlatFrame')
		top.pack(side=TOP, expand=0, fill=BOTH)

		top2 = TFrame(top, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		format_label = TLabel(top2, text=_('Style name:'), borderwidth=0)
		format_label.pack(side=LEFT, pady=3)

		self.entry_name = TEntrybox(top, command=self.ok, width=15)
		self.entry_name.pack(side=TOP, fill=X)

		top2 = TFrame(top, height=5, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		prop_cont = TLabelframe(top, text=_('Style properties'), padding=10)
		prop_cont.pack(side=TOP, fill=X)

		properties = self.object.Properties()
		self.flags = {}
		for prop in property_names:
			type = property_types[prop]
			if type == FillProperty:
				state = self.object.has_fill and NORMAL or DISABLED
			elif type == LineProperty:
				state = self.object.has_line and NORMAL or DISABLED
			elif type == FontProperty:
				state = self.object.has_font and NORMAL or DISABLED
			else:
				# unknown property type!
				continue
			long, short = property_titles[prop]
			self.flags[prop] = var = IntVar(root)
			var.set(state == NORMAL)
			radio = TCheckbutton(prop_cont, text=long, state=state, variable=var)
			radio.pack(side=TOP, anchor=W)

		top2 = TFrame(top, height=3, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		but_frame = Frame(top)
		but_frame.pack(side=TOP, fill=X)

		button = TButton(but_frame, text=_("Cancel"), command=self.cancel)
		button.pack(side=RIGHT, padx=5)
		button = TButton(but_frame, text=_("OK"), command=self.ok)
		button.pack(side=RIGHT, padx=5)

		root.resizable (width=0, height=0)

		self.entry_name.set_focus()
Esempio n. 3
0
class SPOTDigitizer(TFrame):
    def __init__(self, parent, **kw):
        TFrame.__init__(self, parent, style='FlatFrame', **kw)

        spot_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        spot_frame.pack(side=TOP)

        label = TLabel(spot_frame, text=_('Color name:'), justify=LEFT)
        label.pack(side=TOP)

        self.colorname_value = StringVar('')

        self.colorname = TEntrybox(spot_frame,
                                   text='',
                                   width=25,
                                   textvariable=self.colorname_value)
        self.colorname.set_state('readonly')
        self.colorname.pack(side=BOTTOM, fill=X)

        cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        cmyk_frame.pack(side=TOP)

        self.CMYK_label = TLabel(cmyk_frame,
                                 text='C:\nM:\nY:\nK:',
                                 justify=LEFT)
        self.CMYK_label.pack(side=LEFT, padx=10)

        self.RGB_label = TLabel(cmyk_frame, text='R:\nG:\nB:', justify=LEFT)
        self.RGB_label.pack(side=LEFT, padx=10)

        self.HTML_label = TLabel(self, text='HTML:', justify=LEFT)
        self.HTML_label.pack(side=BOTTOM, pady=5)

    def set_color(self, color):
        self.color = color
        c, m, y, k = color.getCMYK()
        self.CMYK_label['text'] = 'C: %d\nM: %d\nY: %d\nK: %d' % (round(
            c * 100, 2), round(m * 100, 2), round(y * 100, 2), round(
                k * 100, 2))

        r, g, b = color.getRGB()
        text = 'R: %d\nG: %d\nB: %d' % (round(r * 255, 2), round(
            g * 255, 2), round(b * 255, 2))
        self.RGB_label['text'] = text

        int_color = (round(r * 255), round(g * 255), round(b * 255))
        text = 'HTML: #%02X%02X%02X' % int_color
        self.HTML_label['text'] = text

        if color.name == 'All':
            self.colorname_value.set(color.toString())
        else:
            self.colorname_value.set(color.name)
Esempio n. 4
0
	def __init__(self, parent, **kw):
		TFrame.__init__(self, parent, style='FlatFrame', **kw)	
			
		spot_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		spot_frame.pack(side=TOP)
		
		label = TLabel(spot_frame, text=_('Color name:'), justify=LEFT)
		label.pack(side=TOP)
		
		self.colorname_value = StringVar('')
		
		self.colorname = TEntrybox(spot_frame, text='', width=25, textvariable=self.colorname_value)
		self.colorname.set_state('readonly')
		self.colorname.pack(side=BOTTOM, fill=X)
		
		cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		cmyk_frame.pack(side=TOP)
		
		self.CMYK_label = TLabel(cmyk_frame, text='C:\nM:\nY:\nK:', justify=LEFT)
		self.CMYK_label.pack(side=LEFT, padx=10)
		
		self.RGB_label = TLabel(cmyk_frame, text='R:\nG:\nB:', justify=LEFT)
		self.RGB_label.pack(side=LEFT, padx=10)
		
		self.HTML_label = TLabel(self, text='HTML:', justify=LEFT)
		self.HTML_label.pack(side=BOTTOM, pady=5)		
Esempio n. 5
0
class SPOTDigitizer(TFrame):
	
	def __init__(self, parent, **kw):
		TFrame.__init__(self, parent, style='FlatFrame', **kw)	
			
		spot_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		spot_frame.pack(side=TOP)
		
		label = TLabel(spot_frame, text=_('Color name:'), justify=LEFT)
		label.pack(side=TOP)
		
		self.colorname_value = StringVar('')
		
		self.colorname = TEntrybox(spot_frame, text='', width=25, textvariable=self.colorname_value)
		self.colorname.set_state('readonly')
		self.colorname.pack(side=BOTTOM, fill=X)
		
		cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		cmyk_frame.pack(side=TOP)
		
		self.CMYK_label = TLabel(cmyk_frame, text='C:\nM:\nY:\nK:', justify=LEFT)
		self.CMYK_label.pack(side=LEFT, padx=10)
		
		self.RGB_label = TLabel(cmyk_frame, text='R:\nG:\nB:', justify=LEFT)
		self.RGB_label.pack(side=LEFT, padx=10)
		
		self.HTML_label = TLabel(self, text='HTML:', justify=LEFT)
		self.HTML_label.pack(side=BOTTOM, pady=5)		
		
	def set_color(self, color):
		self.color = color
		c, m, y, k = color.getCMYK()
		self.CMYK_label['text'] = 'C: %d\nM: %d\nY: %d\nK: %d' % (round(c * 100, 2), round(m * 100, 2), round(y * 100, 2), round(k * 100, 2))
				
		r, g, b = color.getRGB()
		text = 'R: %d\nG: %d\nB: %d' % (round(r * 255, 2), round(g * 255, 2), round(b * 255, 2))
		self.RGB_label['text'] = text	
		
		int_color = (round(r * 255), round(g * 255), round(b * 255))
		text = 'HTML: #%02X%02X%02X' % int_color
		self.HTML_label['text'] = text	
		
		if color.name == 'All':
			self.colorname_value.set(color.toString())
		else:
			self.colorname_value.set(color.name)		
Esempio n. 6
0
	def __init__(self, parent, callback, **kw):
		self.callback = callback
		TFrame.__init__(self, parent, style='FlatFrame', **kw)
		self.R_value = IntVar(0)
		self.G_value = IntVar(0)
		self.B_value = IntVar(0)
		self.A_value = IntVar(0)
		
		self.HTML_value = StringVar('')
		
			
		b = TLabel(self, style='HLine')
		b.pack(side=BOTTOM, fill=X)	
		
		frame = TFrame(self, borderwidth=0, style='FlatFrame')
		frame.pack(side=BOTTOM)
		label = TLabel(frame, text=_("Alpha channel: "))
		label.pack(side=LEFT)
		self.A_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.A_value, command=self.rgb_component_changed)
		self.A_spin.pack(side=RIGHT)
		
		b = TLabel(self, style='HLine')
		b.pack(side=BOTTOM, fill=X)
		
		
		html_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		html_frame.pack(side=BOTTOM)
		

		self.HTML_entry = TEntrybox(html_frame, text='#000000', width=10,
								textvariable=self.HTML_value, command=self.html_component_changed)
		self.HTML_entry.pack(side=RIGHT)
		
		label = TLabel(html_frame, text="HTML: ")
		label.pack(side=RIGHT)
		
		rgb_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		rgb_frame.pack(side=LEFT, padx=10)
		
		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="R: ")
		label.pack(side=LEFT)
		self.R_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.R_value, command=self.rgb_component_changed)
		self.R_spin.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="G: ")
		label.pack(side=LEFT)
		self.G_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.G_value, command=self.rgb_component_changed)
		self.G_spin.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="B: ")
		label.pack(side=LEFT)
		self.B_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.B_value, command=self.rgb_component_changed)
		self.B_spin.pack(side=RIGHT)
		
		cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		cmyk_frame.pack(side=LEFT)
		
		self.CMYK_label = TLabel(cmyk_frame, text='C:\nM:\nY:\nK:', justify=LEFT)
		self.CMYK_label.pack(side=LEFT)
Esempio n. 7
0
class RGBDigitizer(TFrame):
	
	def __init__(self, parent, callback, **kw):
		self.callback = callback
		TFrame.__init__(self, parent, style='FlatFrame', **kw)
		self.R_value = IntVar(0)
		self.G_value = IntVar(0)
		self.B_value = IntVar(0)
		self.A_value = IntVar(0)
		
		self.HTML_value = StringVar('')
		
			
		b = TLabel(self, style='HLine')
		b.pack(side=BOTTOM, fill=X)	
		
		frame = TFrame(self, borderwidth=0, style='FlatFrame')
		frame.pack(side=BOTTOM)
		label = TLabel(frame, text=_("Alpha channel: "))
		label.pack(side=LEFT)
		self.A_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.A_value, command=self.rgb_component_changed)
		self.A_spin.pack(side=RIGHT)
		
		b = TLabel(self, style='HLine')
		b.pack(side=BOTTOM, fill=X)
		
		
		html_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		html_frame.pack(side=BOTTOM)
		

		self.HTML_entry = TEntrybox(html_frame, text='#000000', width=10,
								textvariable=self.HTML_value, command=self.html_component_changed)
		self.HTML_entry.pack(side=RIGHT)
		
		label = TLabel(html_frame, text="HTML: ")
		label.pack(side=RIGHT)
		
		rgb_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		rgb_frame.pack(side=LEFT, padx=10)
		
		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="R: ")
		label.pack(side=LEFT)
		self.R_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.R_value, command=self.rgb_component_changed)
		self.R_spin.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="G: ")
		label.pack(side=LEFT)
		self.G_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.G_value, command=self.rgb_component_changed)
		self.G_spin.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="B: ")
		label.pack(side=LEFT)
		self.B_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.B_value, command=self.rgb_component_changed)
		self.B_spin.pack(side=RIGHT)
		
		cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		cmyk_frame.pack(side=LEFT)
		
		self.CMYK_label = TLabel(cmyk_frame, text='C:\nM:\nY:\nK:', justify=LEFT)
		self.CMYK_label.pack(side=LEFT)
		
		
		
	def set_color(self, color):
		self.color = color
		self.R_value.set(int(round(color.red * 255)))
		self.G_value.set(int(round(color.green * 255)))
		self.B_value.set(int(round(color.blue * 255)))
		self.A_value.set(int(round(color.alpha * 255)))
		c, m, y, k = color.getCMYK()
		self.CMYK_label['text'] = 'C: %.2f\nM: %.2f\nY: %.2f\nK: %.2f' % (round(c * 100, 2), round(m * 100, 2), round(y * 100, 2), round(k * 100, 2))
		int_color = (round(color.red * 255), round(color.green * 255), round(color.blue * 255))
		self.HTML_value.set('#%02X%02X%02X' % int_color)
		
		
		
	def rgb_component_changed(self, *arg):
		r = self.R_value.get() / 255.0
		g = self.G_value.get() / 255.0
		b = self.B_value.get() / 255.0
		a = self.A_value.get() / 255.0
		self.callback(CreateRGBAColor(r, g, b, a))
	
	def html_component_changed(self, *arg):
		html = self.HTML_value.get()
		try:     
			r = int(string.atoi(html[1:3], 0x10)) / 255.0
			g = int(string.atoi(html[3:5], 0x10)) / 255.0 
			b = int(string.atoi(html[5:], 0x10)) / 255.0
		except:
			r = round(self.color.red * 255, 2)
			g = round(self.color.green * 255, 2)
			b = round(self.color.blue * 255, 2)		
		self.callback(CreateRGBAColor(r, g, b, self.A_value.get() / 255.0))
Esempio n. 8
0
    def __init__(self, parent, callback, **kw):
        self.callback = callback
        TFrame.__init__(self, parent, style='FlatFrame', **kw)
        self.R_value = IntVar(0)
        self.G_value = IntVar(0)
        self.B_value = IntVar(0)
        self.A_value = IntVar(0)

        self.HTML_value = StringVar('')

        b = TLabel(self, style='HLine')
        b.pack(side=BOTTOM, fill=X)

        frame = TFrame(self, borderwidth=0, style='FlatFrame')
        frame.pack(side=BOTTOM)
        label = TLabel(frame, text=_("Alpha channel: "))
        label.pack(side=LEFT)
        self.A_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.A_value,
                               command=self.rgb_component_changed)
        self.A_spin.pack(side=RIGHT)

        b = TLabel(self, style='HLine')
        b.pack(side=BOTTOM, fill=X)

        html_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        html_frame.pack(side=BOTTOM)

        self.HTML_entry = TEntrybox(html_frame,
                                    text='#000000',
                                    width=10,
                                    textvariable=self.HTML_value,
                                    command=self.html_component_changed)
        self.HTML_entry.pack(side=RIGHT)

        label = TLabel(html_frame, text="HTML: ")
        label.pack(side=RIGHT)

        rgb_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        rgb_frame.pack(side=LEFT, padx=10)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="R: ")
        label.pack(side=LEFT)
        self.R_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.R_value,
                               command=self.rgb_component_changed)
        self.R_spin.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="G: ")
        label.pack(side=LEFT)
        self.G_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.G_value,
                               command=self.rgb_component_changed)
        self.G_spin.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="B: ")
        label.pack(side=LEFT)
        self.B_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.B_value,
                               command=self.rgb_component_changed)
        self.B_spin.pack(side=RIGHT)

        cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        cmyk_frame.pack(side=LEFT)

        self.CMYK_label = TLabel(cmyk_frame,
                                 text='C:\nM:\nY:\nK:',
                                 justify=LEFT)
        self.CMYK_label.pack(side=LEFT)
Esempio n. 9
0
class RGBDigitizer(TFrame):
    def __init__(self, parent, callback, **kw):
        self.callback = callback
        TFrame.__init__(self, parent, style='FlatFrame', **kw)
        self.R_value = IntVar(0)
        self.G_value = IntVar(0)
        self.B_value = IntVar(0)
        self.A_value = IntVar(0)

        self.HTML_value = StringVar('')

        b = TLabel(self, style='HLine')
        b.pack(side=BOTTOM, fill=X)

        frame = TFrame(self, borderwidth=0, style='FlatFrame')
        frame.pack(side=BOTTOM)
        label = TLabel(frame, text=_("Alpha channel: "))
        label.pack(side=LEFT)
        self.A_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.A_value,
                               command=self.rgb_component_changed)
        self.A_spin.pack(side=RIGHT)

        b = TLabel(self, style='HLine')
        b.pack(side=BOTTOM, fill=X)

        html_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        html_frame.pack(side=BOTTOM)

        self.HTML_entry = TEntrybox(html_frame,
                                    text='#000000',
                                    width=10,
                                    textvariable=self.HTML_value,
                                    command=self.html_component_changed)
        self.HTML_entry.pack(side=RIGHT)

        label = TLabel(html_frame, text="HTML: ")
        label.pack(side=RIGHT)

        rgb_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        rgb_frame.pack(side=LEFT, padx=10)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="R: ")
        label.pack(side=LEFT)
        self.R_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.R_value,
                               command=self.rgb_component_changed)
        self.R_spin.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="G: ")
        label.pack(side=LEFT)
        self.G_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.G_value,
                               command=self.rgb_component_changed)
        self.G_spin.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="B: ")
        label.pack(side=LEFT)
        self.B_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.B_value,
                               command=self.rgb_component_changed)
        self.B_spin.pack(side=RIGHT)

        cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        cmyk_frame.pack(side=LEFT)

        self.CMYK_label = TLabel(cmyk_frame,
                                 text='C:\nM:\nY:\nK:',
                                 justify=LEFT)
        self.CMYK_label.pack(side=LEFT)

    def set_color(self, color):
        self.color = color
        self.R_value.set(int(round(color.red * 255)))
        self.G_value.set(int(round(color.green * 255)))
        self.B_value.set(int(round(color.blue * 255)))
        self.A_value.set(int(round(color.alpha * 255)))
        c, m, y, k = color.getCMYK()
        self.CMYK_label['text'] = 'C: %.2f\nM: %.2f\nY: %.2f\nK: %.2f' % (
            round(c * 100, 2), round(m * 100, 2), round(y * 100,
                                                        2), round(k * 100, 2))
        int_color = (round(color.red * 255), round(color.green * 255),
                     round(color.blue * 255))
        self.HTML_value.set('#%02X%02X%02X' % int_color)

    def rgb_component_changed(self, *arg):
        r = self.R_value.get() / 255.0
        g = self.G_value.get() / 255.0
        b = self.B_value.get() / 255.0
        a = self.A_value.get() / 255.0
        self.callback(CreateRGBAColor(r, g, b, a))

    def html_component_changed(self, *arg):
        html = self.HTML_value.get()
        try:
            r = int(string.atoi(html[1:3], 0x10)) / 255.0
            g = int(string.atoi(html[3:5], 0x10)) / 255.0
            b = int(string.atoi(html[5:], 0x10)) / 255.0
        except:
            r = round(self.color.red * 255, 2)
            g = round(self.color.green * 255, 2)
            b = round(self.color.blue * 255, 2)
        self.callback(CreateRGBAColor(r, g, b, self.A_value.get() / 255.0))
Esempio n. 10
0
class CreateStyleDlg(SKModal):

	title = _("Create Style")

	def __init__(self, master, object, style_names, **kw):
		self.object = object
		self.style_names = style_names
		apply(SKModal.__init__, (self, master), kw)

	def __del__(self):
		if __debug__:
			pdebug('__del__', '__del__', self)

	def build_dlg(self):
		root = self.top

		top = TFrame(root, borderwidth=5, style='FlatFrame')
		top.pack(side=TOP, expand=0, fill=BOTH)

		top2 = TFrame(top, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		format_label = TLabel(top2, text=_('Style name:'), borderwidth=0)
		format_label.pack(side=LEFT, pady=3)

		self.entry_name = TEntrybox(top, command=self.ok, width=15)
		self.entry_name.pack(side=TOP, fill=X)

		top2 = TFrame(top, height=5, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		prop_cont = TLabelframe(top, text=_('Style properties'), padding=10)
		prop_cont.pack(side=TOP, fill=X)

		properties = self.object.Properties()
		self.flags = {}
		for prop in property_names:
			type = property_types[prop]
			if type == FillProperty:
				state = self.object.has_fill and NORMAL or DISABLED
			elif type == LineProperty:
				state = self.object.has_line and NORMAL or DISABLED
			elif type == FontProperty:
				state = self.object.has_font and NORMAL or DISABLED
			else:
				# unknown property type!
				continue
			long, short = property_titles[prop]
			self.flags[prop] = var = IntVar(root)
			var.set(state == NORMAL)
			radio = TCheckbutton(prop_cont, text=long, state=state, variable=var)
			radio.pack(side=TOP, anchor=W)

		top2 = TFrame(top, height=3, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		but_frame = Frame(top)
		but_frame.pack(side=TOP, fill=X)

		button = TButton(but_frame, text=_("Cancel"), command=self.cancel)
		button.pack(side=RIGHT, padx=5)
		button = TButton(but_frame, text=_("OK"), command=self.ok)
		button.pack(side=RIGHT, padx=5)

		root.resizable (width=0, height=0)

		self.entry_name.set_focus()

	def ok(self, *args):
		name = self.entry_name.get_text()
		if not name:
			MessageDialog(self.top, title=_("Create Style Info"),
							message=_("Please enter a style name."),
							icon='info')
			return
		if name in self.style_names:
			MessageDialog(self.top, title=_("Create Style"),
							message=_("The name `%(name)s' is already used.\n"
										"Please choose another one.") % locals(),
							icon='info')
			return

		which_properties = []
		for prop, var in self.flags.items():
			if var.get():
				which_properties.append(prop)
		self.close_dlg((name, which_properties))
Esempio n. 11
0
    def build_dlg(self):
        super = self.top
        top = TFrame(super, borderwidth=10, style='FlatFrame')
        top.pack(side=TOP, fill=BOTH, expand=1)

        frame = TFrame(top, style='FlatFrame')
        frame.pack(side=BOTTOM, fill=BOTH, expand=0)

        label = TLabel(top, style="HLine")
        label.pack(side=BOTTOM, fill=BOTH, expand=0)

        button = TButton(frame, text=_("Cancel"), command=self.cancel)
        button.pack(side=RIGHT, expand=0)
        label = TLabel(frame, image="space_6", style="FlatLabel")
        label.pack(side=RIGHT)
        button = TButton(frame, text=_("OK"), command=self.ok)
        button.pack(side=RIGHT, expand=0)
        button = TButton(frame, image='colorpicker', state='disabled')
        button.pack(side=LEFT, expand=0)

        #       RGBlabel_frame = TFrame(top, borderwidth = 1, style='FlatFrame')
        #       RGBlabel_frame.pack(side = BOTTOM, fill = BOTH)
        #
        #       self.label = TLabel(RGBlabel_frame, style="FlatLabel")
        #       self.label.pack(side = LEFT)

        frame = TFrame(top, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)
        viewxy = ChooseRGBXY(frame, xyramp_size[0], xyramp_size[1], 0, 1)
        viewxy.pack(side=LEFT)

        frame = TFrame(top, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)
        viewz = ChooseRGBZ(frame, zramp_size[0], zramp_size[1], 2)
        viewz.pack(side=LEFT)

        frame1 = TFrame(top, borderwidth=3, style='FlatFrame')
        frame1.pack(side=RIGHT)

        CS_frame = TFrame(frame1, borderwidth=1, style='FlatFrame')
        CS_frame.pack(side=TOP)

        label = TLabel(CS_frame,
                       text="Old color:   \nNew color:   ",
                       justify='right')
        label.pack(side=LEFT)

        frame = TFrame(CS_frame, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)

        self.sample = ColorSample(frame, self.color, width=60, height=20)
        self.sample.pack(side=BOTTOM)
        sample = ColorSample(frame, self.color, width=60, height=20)
        sample.pack(side=TOP)

        label = TLabel(frame1, style="HLine")
        label.pack(side=TOP, fill=BOTH, expand=0)

        spin_frame = TFrame(frame1, borderwidth=1, style='FlatFrame')
        spin_frame.pack(side=TOP)

        hsv_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame')
        hsv_frame.pack(side=LEFT)

        frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="H: ")
        label.pack(side=LEFT)
        self.var1 = TSpinbox(frame,
                             min=0,
                             max=1.0,
                             step=0.01,
                             vartype=1,
                             command=self.component_changed)
        self.var1.pack(side=RIGHT)

        frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="S: ")
        label.pack(side=LEFT)
        self.var2 = TSpinbox(frame,
                             min=0,
                             max=1.0,
                             step=0.01,
                             vartype=1,
                             command=self.component_changed)
        self.var2.pack(side=RIGHT)

        frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="V: ")
        label.pack(side=LEFT)
        self.var3 = TSpinbox(frame,
                             min=0,
                             max=1.0,
                             step=0.01,
                             vartype=1,
                             command=self.component_changed)
        self.var3.pack(side=RIGHT)

        rgb_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame')
        rgb_frame.pack(side=LEFT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="R: ")
        label.pack(side=LEFT)
        self.var4 = TSpinbox(frame,
                             min=0,
                             max=255,
                             step=1,
                             vartype=0,
                             command=self.rgb_component_changed)
        self.var4.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="G: ")
        label.pack(side=LEFT)
        self.var5 = TSpinbox(frame,
                             min=0,
                             max=255,
                             step=1,
                             vartype=0,
                             command=self.rgb_component_changed)
        self.var5.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="B: ")
        label.pack(side=LEFT)
        self.var6 = TSpinbox(frame,
                             min=0,
                             max=255,
                             step=1,
                             vartype=0,
                             command=self.rgb_component_changed)
        self.var6.pack(side=RIGHT)

        HTML_frame = TFrame(frame1, borderwidth=3, style='FlatFrame')
        HTML_frame.pack(side=TOP)

        label = TLabel(HTML_frame, text="HTML: ")
        label.pack(side=LEFT)
        self.html = TEntrybox(HTML_frame,
                              text='#000000',
                              width=10,
                              command=self.html_component_changed)
        self.html.pack(side=LEFT)

        viewxy.Subscribe(CHANGED, self.color_changed)
        viewz.Subscribe(CHANGED, self.color_changed)
        self.viewxy = viewxy
        self.viewz = viewz

        super.resizable(width=0, height=0)

        self.color_changed(self.color)
Esempio n. 12
0
class ChooseColorDlg(SKModal):

    title = _("Select RGB Color")
    class_name = 'ColorDialog'

    def __init__(self, master, color, **kw):
        self.color = color.RGB()
        self.orig_color = color.RGB()
        apply(SKModal.__init__, (self, master), kw)

    def build_dlg(self):
        super = self.top
        top = TFrame(super, borderwidth=10, style='FlatFrame')
        top.pack(side=TOP, fill=BOTH, expand=1)

        frame = TFrame(top, style='FlatFrame')
        frame.pack(side=BOTTOM, fill=BOTH, expand=0)

        label = TLabel(top, style="HLine")
        label.pack(side=BOTTOM, fill=BOTH, expand=0)

        button = TButton(frame, text=_("Cancel"), command=self.cancel)
        button.pack(side=RIGHT, expand=0)
        label = TLabel(frame, image="space_6", style="FlatLabel")
        label.pack(side=RIGHT)
        button = TButton(frame, text=_("OK"), command=self.ok)
        button.pack(side=RIGHT, expand=0)
        button = TButton(frame, image='colorpicker', state='disabled')
        button.pack(side=LEFT, expand=0)

        #       RGBlabel_frame = TFrame(top, borderwidth = 1, style='FlatFrame')
        #       RGBlabel_frame.pack(side = BOTTOM, fill = BOTH)
        #
        #       self.label = TLabel(RGBlabel_frame, style="FlatLabel")
        #       self.label.pack(side = LEFT)

        frame = TFrame(top, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)
        viewxy = ChooseRGBXY(frame, xyramp_size[0], xyramp_size[1], 0, 1)
        viewxy.pack(side=LEFT)

        frame = TFrame(top, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)
        viewz = ChooseRGBZ(frame, zramp_size[0], zramp_size[1], 2)
        viewz.pack(side=LEFT)

        frame1 = TFrame(top, borderwidth=3, style='FlatFrame')
        frame1.pack(side=RIGHT)

        CS_frame = TFrame(frame1, borderwidth=1, style='FlatFrame')
        CS_frame.pack(side=TOP)

        label = TLabel(CS_frame,
                       text="Old color:   \nNew color:   ",
                       justify='right')
        label.pack(side=LEFT)

        frame = TFrame(CS_frame, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)

        self.sample = ColorSample(frame, self.color, width=60, height=20)
        self.sample.pack(side=BOTTOM)
        sample = ColorSample(frame, self.color, width=60, height=20)
        sample.pack(side=TOP)

        label = TLabel(frame1, style="HLine")
        label.pack(side=TOP, fill=BOTH, expand=0)

        spin_frame = TFrame(frame1, borderwidth=1, style='FlatFrame')
        spin_frame.pack(side=TOP)

        hsv_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame')
        hsv_frame.pack(side=LEFT)

        frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="H: ")
        label.pack(side=LEFT)
        self.var1 = TSpinbox(frame,
                             min=0,
                             max=1.0,
                             step=0.01,
                             vartype=1,
                             command=self.component_changed)
        self.var1.pack(side=RIGHT)

        frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="S: ")
        label.pack(side=LEFT)
        self.var2 = TSpinbox(frame,
                             min=0,
                             max=1.0,
                             step=0.01,
                             vartype=1,
                             command=self.component_changed)
        self.var2.pack(side=RIGHT)

        frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="V: ")
        label.pack(side=LEFT)
        self.var3 = TSpinbox(frame,
                             min=0,
                             max=1.0,
                             step=0.01,
                             vartype=1,
                             command=self.component_changed)
        self.var3.pack(side=RIGHT)

        rgb_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame')
        rgb_frame.pack(side=LEFT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="R: ")
        label.pack(side=LEFT)
        self.var4 = TSpinbox(frame,
                             min=0,
                             max=255,
                             step=1,
                             vartype=0,
                             command=self.rgb_component_changed)
        self.var4.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="G: ")
        label.pack(side=LEFT)
        self.var5 = TSpinbox(frame,
                             min=0,
                             max=255,
                             step=1,
                             vartype=0,
                             command=self.rgb_component_changed)
        self.var5.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="B: ")
        label.pack(side=LEFT)
        self.var6 = TSpinbox(frame,
                             min=0,
                             max=255,
                             step=1,
                             vartype=0,
                             command=self.rgb_component_changed)
        self.var6.pack(side=RIGHT)

        HTML_frame = TFrame(frame1, borderwidth=3, style='FlatFrame')
        HTML_frame.pack(side=TOP)

        label = TLabel(HTML_frame, text="HTML: ")
        label.pack(side=LEFT)
        self.html = TEntrybox(HTML_frame,
                              text='#000000',
                              width=10,
                              command=self.html_component_changed)
        self.html.pack(side=LEFT)

        viewxy.Subscribe(CHANGED, self.color_changed)
        viewz.Subscribe(CHANGED, self.color_changed)
        self.viewxy = viewxy
        self.viewz = viewz

        super.resizable(width=0, height=0)

        self.color_changed(self.color)

    def color_changed(self, color):
        #       self.label.configure(text = 'RGB:( %.3f %.3f %.3f )' % tuple(color))
        self.viewxy.SetColor(color)
        self.viewz.SetColor(color)
        self.sample.SetColor(color)
        v1, v2, v3 = apply(rgb_to_hsv, tuple(color))
        self.var1.set_value(v1)
        self.var2.set_value(v2)
        self.var3.set_value(v3)
        self.var4.set_value(round(color[0] * 255))
        self.var5.set_value(round(color[1] * 255))
        self.var6.set_value(round(color[2] * 255))
        int_color = (round(color[0] * 255), round(color[1] * 255),
                     round(color[2] * 255))
        self.html.set_text('#%02X%02X%02X' % int_color)
        self.color = color

    def component_changed(self, *rest):
        color = (self.var1.get_value(), self.var2.get_value(),
                 self.var3.get_value())
        color = apply(CreateRGBColor, apply(hsv_to_rgb, color)).RGB()
        self.color_changed(color)

    def rgb_component_changed(self, *rest):
        RGBColor = CreateRGBColor(self.var4.get_value() / 255.0,
                                  self.var5.get_value() / 255.0,
                                  self.var6.get_value() / 255.0).RGB()
        self.color_changed(RGBColor)

    def html_component_changed(self, *rest):
        html = self.html.get_text()
        try:
            RGBColor = CreateRGBColor(
                int(string.atoi(html[1:3], 0x10)) / 255.0,
                int(string.atoi(html[3:5], 0x10)) / 255.0,
                int(string.atoi(html[5:], 0x10)) / 255.0).RGB()
        except:
            RGBColor = self.color
        self.color_changed(RGBColor)

    def ok(self, *args):
        r, g, b = tuple(self.color)
        ColorObject = CreateRGBColor(r, g, b)
        self.close_dlg(ColorObject)
Esempio n. 13
0
	def build_dlg(self):
		super = self.top
		top = TFrame(super, borderwidth=10, style='FlatFrame')
		top.pack(side=TOP, fill=BOTH, expand=1)

		frame = TFrame(top, style='FlatFrame')
		frame.pack(side=BOTTOM, fill=BOTH, expand=0)

		label = TLabel(top, style="HLine")
		label.pack(side=BOTTOM, fill=BOTH, expand=0)

		button = TButton(frame, text=_("Cancel"), command=self.cancel)
		button.pack(side=RIGHT, expand=0)
		label = TLabel(frame, image="space_6", style="FlatLabel")
		label.pack(side=RIGHT)
		button = TButton(frame, text=_("OK"), command=self.ok)
		button.pack(side=RIGHT, expand=0)
		button = TButton(frame, image='colorpicker', state='disabled')
		button.pack(side=LEFT, expand=0)

#       RGBlabel_frame = TFrame(top, borderwidth = 1, style='FlatFrame')
#       RGBlabel_frame.pack(side = BOTTOM, fill = BOTH)
#
#       self.label = TLabel(RGBlabel_frame, style="FlatLabel")
#       self.label.pack(side = LEFT)


		frame = TFrame(top, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)
		viewxy = ChooseRGBXY(frame, xyramp_size[0], xyramp_size[1], 0, 1)
		viewxy.pack(side=LEFT)

		frame = TFrame(top, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)
		viewz = ChooseRGBZ(frame, zramp_size[0], zramp_size[1], 2)
		viewz.pack(side=LEFT)

		frame1 = TFrame(top, borderwidth=3, style='FlatFrame')
		frame1.pack(side=RIGHT)

		CS_frame = TFrame(frame1, borderwidth=1, style='FlatFrame')
		CS_frame.pack(side=TOP)

		label = TLabel(CS_frame, text="Old color:   \nNew color:   ", justify='right')
		label.pack(side=LEFT)

		frame = TFrame(CS_frame, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)

		self.sample = ColorSample(frame, self.color, width=60, height=20)
		self.sample.pack(side=BOTTOM)
		sample = ColorSample(frame, self.color, width=60, height=20)
		sample.pack(side=TOP)

		label = TLabel(frame1, style="HLine")
		label.pack(side=TOP, fill=BOTH, expand=0)

		spin_frame = TFrame(frame1, borderwidth=1, style='FlatFrame')
		spin_frame.pack(side=TOP)

		hsv_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame')
		hsv_frame.pack(side=LEFT)

		frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="H: ")
		label.pack(side=LEFT)
		self.var1 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed)
		self.var1.pack(side=RIGHT)

		frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="S: ")
		label.pack(side=LEFT)
		self.var2 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed)
		self.var2.pack(side=RIGHT)

		frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="V: ")
		label.pack(side=LEFT)
		self.var3 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed)
		self.var3.pack(side=RIGHT)


		rgb_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame')
		rgb_frame.pack(side=LEFT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="R: ")
		label.pack(side=LEFT)
		self.var4 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed)
		self.var4.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="G: ")
		label.pack(side=LEFT)
		self.var5 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed)
		self.var5.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="B: ")
		label.pack(side=LEFT)
		self.var6 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed)
		self.var6.pack(side=RIGHT)

		HTML_frame = TFrame(frame1, borderwidth=3, style='FlatFrame')
		HTML_frame.pack(side=TOP)

		label = TLabel(HTML_frame, text="HTML: ")
		label.pack(side=LEFT)
		self.html = TEntrybox(HTML_frame, text='#000000', width=10, command=self.html_component_changed)
		self.html.pack(side=LEFT)



		viewxy.Subscribe(CHANGED, self.color_changed)
		viewz.Subscribe(CHANGED, self.color_changed)
		self.viewxy = viewxy
		self.viewz = viewz

		super.resizable(width=0, height=0)

		self.color_changed(self.color)
Esempio n. 14
0
class ChooseColorDlg(SKModal):

	title = _("Select RGB Color")
	class_name = 'ColorDialog'

	def __init__(self, master, color, **kw):
		self.color = color.RGB()
		self.orig_color = color.RGB()
		apply(SKModal.__init__, (self, master), kw)

	def build_dlg(self):
		super = self.top
		top = TFrame(super, borderwidth=10, style='FlatFrame')
		top.pack(side=TOP, fill=BOTH, expand=1)

		frame = TFrame(top, style='FlatFrame')
		frame.pack(side=BOTTOM, fill=BOTH, expand=0)

		label = TLabel(top, style="HLine")
		label.pack(side=BOTTOM, fill=BOTH, expand=0)

		button = TButton(frame, text=_("Cancel"), command=self.cancel)
		button.pack(side=RIGHT, expand=0)
		label = TLabel(frame, image="space_6", style="FlatLabel")
		label.pack(side=RIGHT)
		button = TButton(frame, text=_("OK"), command=self.ok)
		button.pack(side=RIGHT, expand=0)
		button = TButton(frame, image='colorpicker', state='disabled')
		button.pack(side=LEFT, expand=0)

#       RGBlabel_frame = TFrame(top, borderwidth = 1, style='FlatFrame')
#       RGBlabel_frame.pack(side = BOTTOM, fill = BOTH)
#
#       self.label = TLabel(RGBlabel_frame, style="FlatLabel")
#       self.label.pack(side = LEFT)


		frame = TFrame(top, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)
		viewxy = ChooseRGBXY(frame, xyramp_size[0], xyramp_size[1], 0, 1)
		viewxy.pack(side=LEFT)

		frame = TFrame(top, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)
		viewz = ChooseRGBZ(frame, zramp_size[0], zramp_size[1], 2)
		viewz.pack(side=LEFT)

		frame1 = TFrame(top, borderwidth=3, style='FlatFrame')
		frame1.pack(side=RIGHT)

		CS_frame = TFrame(frame1, borderwidth=1, style='FlatFrame')
		CS_frame.pack(side=TOP)

		label = TLabel(CS_frame, text="Old color:   \nNew color:   ", justify='right')
		label.pack(side=LEFT)

		frame = TFrame(CS_frame, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)

		self.sample = ColorSample(frame, self.color, width=60, height=20)
		self.sample.pack(side=BOTTOM)
		sample = ColorSample(frame, self.color, width=60, height=20)
		sample.pack(side=TOP)

		label = TLabel(frame1, style="HLine")
		label.pack(side=TOP, fill=BOTH, expand=0)

		spin_frame = TFrame(frame1, borderwidth=1, style='FlatFrame')
		spin_frame.pack(side=TOP)

		hsv_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame')
		hsv_frame.pack(side=LEFT)

		frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="H: ")
		label.pack(side=LEFT)
		self.var1 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed)
		self.var1.pack(side=RIGHT)

		frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="S: ")
		label.pack(side=LEFT)
		self.var2 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed)
		self.var2.pack(side=RIGHT)

		frame = TFrame(hsv_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="V: ")
		label.pack(side=LEFT)
		self.var3 = TSpinbox(frame, min=0, max=1.0, step=0.01, vartype=1, command=self.component_changed)
		self.var3.pack(side=RIGHT)


		rgb_frame = TFrame(spin_frame, borderwidth=2, style='FlatFrame')
		rgb_frame.pack(side=LEFT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="R: ")
		label.pack(side=LEFT)
		self.var4 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed)
		self.var4.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="G: ")
		label.pack(side=LEFT)
		self.var5 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed)
		self.var5.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="B: ")
		label.pack(side=LEFT)
		self.var6 = TSpinbox(frame, min=0, max=255, step=1, vartype=0, command=self.rgb_component_changed)
		self.var6.pack(side=RIGHT)

		HTML_frame = TFrame(frame1, borderwidth=3, style='FlatFrame')
		HTML_frame.pack(side=TOP)

		label = TLabel(HTML_frame, text="HTML: ")
		label.pack(side=LEFT)
		self.html = TEntrybox(HTML_frame, text='#000000', width=10, command=self.html_component_changed)
		self.html.pack(side=LEFT)



		viewxy.Subscribe(CHANGED, self.color_changed)
		viewz.Subscribe(CHANGED, self.color_changed)
		self.viewxy = viewxy
		self.viewz = viewz

		super.resizable(width=0, height=0)

		self.color_changed(self.color)

	def color_changed(self, color):
#       self.label.configure(text = 'RGB:( %.3f %.3f %.3f )' % tuple(color))
		self.viewxy.SetColor(color)
		self.viewz.SetColor(color)
		self.sample.SetColor(color)
		v1, v2, v3 = apply(rgb_to_hsv, tuple(color))
		self.var1.set_value(v1)
		self.var2.set_value(v2)
		self.var3.set_value(v3)
		self.var4.set_value(round(color[0] * 255))
		self.var5.set_value(round(color[1] * 255))
		self.var6.set_value(round(color[2] * 255))
		int_color = (round(color[0] * 255), round(color[1] * 255), round(color[2] * 255))
		self.html.set_text('#%02X%02X%02X' % int_color)
		self.color = color


	def component_changed(self, *rest):
		color = (self.var1.get_value(), self.var2.get_value(), self.var3.get_value())
		color = apply(CreateRGBColor, apply(hsv_to_rgb, color)).RGB()
		self.color_changed(color)

	def rgb_component_changed(self, *rest):
		RGBColor = CreateRGBColor(self.var4.get_value() / 255.0,
												self.var5.get_value() / 255.0,
												self.var6.get_value() / 255.0).RGB()
		self.color_changed(RGBColor)

	def html_component_changed(self, *rest):
		html = self.html.get_text()
		try:
				RGBColor = CreateRGBColor(int(string.atoi(html[1:3], 0x10)) / 255.0,
														int(string.atoi(html[3:5], 0x10)) / 255.0,
														int(string.atoi(html[5:], 0x10)) / 255.0).RGB()
		except:
				RGBColor = self.color
		self.color_changed(RGBColor)



	def ok(self, *args):
		r, g, b = tuple(self.color)
		ColorObject = CreateRGBColor(r, g, b)
		self.close_dlg(ColorObject)