Example #1
0
    def __init__(self, app, parent):
        self.app = app
        self.parent = parent
        wal.HPanel.__init__(self, parent)

        self.image_txt = wal.Label(self,
                                   text=_('Image type: '),
                                   fontsize=FONTSIZE[0])
        self.pack(self.image_txt, padding=4)
        self.fill_txt = wal.Label(self, text=_('Fill:'), fontsize=FONTSIZE[0])
        self.pack(self.fill_txt)
        self.fill_swatch = SB_FillSwatch(self,
                                         self.app,
                                         self.fill_txt,
                                         onclick=self.app.proxy.fill_dialog)
        self.pack(self.fill_swatch, padding=2)
        self.pack((5, 5))
        self.stroke_txt = wal.Label(self,
                                    text=_('Stroke:'),
                                    fontsize=FONTSIZE[0])
        self.pack(self.stroke_txt)
        self.stroke_swatch = SB_StrokeSwatch(
            self,
            self.app,
            self.stroke_txt,
            onclick=self.app.proxy.stroke_dialog)
        self.pack(self.stroke_swatch, padding=2)
        self.pack((5, 5))
        self.Layout()
        events.connect(events.SELECTION_CHANGED, self.update)
        events.connect(events.DOC_CHANGED, self.update)
        events.connect(events.NO_DOCS, self.update)
Example #2
0
class ColorMonitor(wal.HPanel):

	image_txt = None
	fill_txt = None
	fill_swatch = None
	stroke_txt = None
	stroke_swatch = None

	def __init__(self, app, parent):
		self.app = app
		self.parent = parent
		wal.HPanel.__init__(self, parent)

		self.image_txt = wal.Label(self, text=_('Image type: '), fontsize=FONTSIZE[0])
		self.pack(self.image_txt, padding=4)
		self.fill_txt = wal.Label(self, text=_('Fill:'), fontsize=FONTSIZE[0])
		self.pack(self.fill_txt)
		self.fill_swatch = SB_FillSwatch(self, self.app, self.fill_txt,
										onclick=self.app.proxy.fill_dialog)
		self.pack(self.fill_swatch, padding=2)
		self.pack((5, 5))
		self.stroke_txt = wal.Label(self, text=_('Stroke:'), fontsize=FONTSIZE[0])
		self.pack(self.stroke_txt)
		self.stroke_swatch = SB_StrokeSwatch(self, self.app, self.stroke_txt,
										onclick=self.app.proxy.stroke_dialog)
		self.pack(self.stroke_swatch, padding=2)
		self.pack((5, 5))
		self.Layout()
		events.connect(events.SELECTION_CHANGED, self.update)
		events.connect(events.DOC_CHANGED, self.update)
		events.connect(events.NO_DOCS, self.update)

	def update(self, *args):
		sel = self.app.current_doc.get_selected_objs()
		if sel:
			if len(sel) == 1 and self.app.insp.is_obj_primitive(sel[0]):
				self.fill_swatch.update_from_obj(sel[0])
				self.stroke_swatch.update_from_obj(sel[0])
				if self.app.insp.is_obj_pixmap(sel[0]):
					txt = _('Image type: ') + IMAGE_NAMES[sel[0].colorspace]
					if sel[0].alpha_channel:
						if sel[0].colorspace in [IMAGE_CMYK, IMAGE_RGB]:
							txt += 'A'
						else:
							txt += '+A'
					self.image_txt.set_text(txt)
					self.image_txt.show()
				else:
					self.image_txt.hide()
				self.hide()
				self.show()
				return
		self.hide()
Example #3
0
	def __init__(self, app, parent):
		self.app = app
		self.parent = parent
		wal.HPanel.__init__(self, parent)

		self.image_txt = wal.Label(self, text=_('Image type: '), fontsize=FONTSIZE[0])
		self.pack(self.image_txt, padding=4)
		self.fill_txt = wal.Label(self, text=_('Fill:'), fontsize=FONTSIZE[0])
		self.pack(self.fill_txt)
		self.fill_swatch = SB_FillSwatch(self, self.app, self.fill_txt,
										onclick=self.app.proxy.fill_dialog)
		self.pack(self.fill_swatch, padding=2)
		self.pack((5, 5))
		self.stroke_txt = wal.Label(self, text=_('Stroke:'), fontsize=FONTSIZE[0])
		self.pack(self.stroke_txt)
		self.stroke_swatch = SB_StrokeSwatch(self, self.app, self.stroke_txt,
										onclick=self.app.proxy.stroke_dialog)
		self.pack(self.stroke_swatch, padding=2)
		self.pack((5, 5))
		self.Layout()
		events.connect(events.SELECTION_CHANGED, self.update)
		events.connect(events.DOC_CHANGED, self.update)
		events.connect(events.NO_DOCS, self.update)