From bfad4881009bce6ab0b5b9177acc0b3ec37af985 Mon Sep 17 00:00:00 2001 From: Manuel QuiƱones Date: Mon, 02 May 2011 21:48:32 +0000 Subject: Brush pallete shows only size when Stamp tool is in use --- diff --git a/widgets.py b/widgets.py index f434ec7..7f59dd2 100644 --- a/widgets.py +++ b/widgets.py @@ -244,11 +244,13 @@ class ButtonStrokeColor(gtk.ToolItem): self.size_spinbutton.set_numeric(True) label = gtk.Label(_('Size: ')) - hbox = gtk.HBox() - content_box.pack_start(hbox) + hbox_size = gtk.HBox() + self.vbox_brush_options = gtk.VBox() + content_box.pack_start(hbox_size) + content_box.pack_start(self.vbox_brush_options) - hbox.pack_start(label) - hbox.pack_start(self.size_spinbutton) + hbox_size.pack_start(label) + hbox_size.pack_start(self.size_spinbutton) self.size_spinbutton.connect('value-changed', self._on_value_changed) # User is able to choose Shapes for 'Brush' and 'Eraser' @@ -276,25 +278,42 @@ class ButtonStrokeColor(gtk.ToolItem): label = gtk.Label(_('Shape')) - content_box.pack_start(label) - content_box.pack_start(item1) - content_box.pack_start(item2) - + self.vbox_brush_options.pack_start(label) + self.vbox_brush_options.pack_start(item1) + self.vbox_brush_options.pack_start(item2) + keep_aspect_checkbutton = gtk.CheckButton(_('Keep aspect')) ratio = self._activity.area.keep_aspect_ratio keep_aspect_checkbutton.set_active(ratio) keep_aspect_checkbutton.connect('toggled', self._keep_aspect_checkbutton_toggled) - content_box.pack_start(keep_aspect_checkbutton) + self.vbox_brush_options.pack_start(keep_aspect_checkbutton) color_palette_hbox.pack_start(gtk.VSeparator(), padding=style.DEFAULT_SPACING) color_palette_hbox.pack_start(content_box) color_palette_hbox.show_all() + self._update_palette() return self._palette def _keep_aspect_checkbutton_toggled(self, checkbutton): self._activity.area.keep_aspect_ratio = checkbutton.get_active() + + def _update_palette(self): + palette_children = self._palette._picker_hbox.get_children() + if self._stamping: + # Hide palette color widgets: + for ch in palette_children[:4]: + ch.hide_all() + # Hide brush options: + self.vbox_brush_options.hide_all() + else: + # Show palette color widgets: + for ch in palette_children[:4]: + ch.show_all() + # Show brush options: + self.vbox_brush_options.show_all() + self._palette.queue_draw() def set_stamping(self, stamping): self._stamping = stamping @@ -303,6 +322,7 @@ class ButtonStrokeColor(gtk.ToolItem): self.size_spinbutton.set_value(self.color_button.stamp_size) else: self.size_spinbutton.set_value(self.color_button.brush_size) + self._update_palette() def is_stamping(self): return self._stamping -- cgit v0.9.1