Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/toolbar.py
diff options
context:
space:
mode:
Diffstat (limited to 'toolbar.py')
-rw-r--r--toolbar.py39
1 files changed, 34 insertions, 5 deletions
diff --git a/toolbar.py b/toolbar.py
index 70d27c5..dfb3a82 100644
--- a/toolbar.py
+++ b/toolbar.py
@@ -42,11 +42,31 @@ class PaintToolbar(ToolbarBox):
self.toolbar.insert(separator, -1)
separator.show()
- button = ToolButton('edit-clear')
- button.set_tooltip(_("Clear canvas"))
- button.connect("clicked", self._clear_drawing_canvas_cb)
- self.toolbar.insert(button, -1)
- button.show()
+ tool_item_width = gtk.ToolItem()
+ self.toolbar.insert(tool_item_width, -1)
+ tool_item_width.show()
+
+ hbox_width = gtk.HBox()
+ tool_item_width.add(hbox_width)
+ hbox_width.show()
+
+ width_label = gtk.Label(_('Width: '))
+ hbox_width.pack_start(width_label)
+ width_label.show()
+
+ self._width_spin = gtk.SpinButton()
+ adj = gtk.Adjustment(1, 1.0, 100.0, 1.0)
+ self._width_spin.set_adjustment(adj)
+ self._width_spin.set_numeric(True)
+ self._width_spin.connect('value-changed', self._width_spin_cb)
+ hbox_width.pack_start(self._width_spin)
+ self._width_spin.show()
+
+ clear_button = ToolButton('edit-clear')
+ clear_button.set_tooltip(_("Clear canvas"))
+ clear_button.connect("clicked", self._clear_drawing_canvas_cb)
+ self.toolbar.insert(clear_button, -1)
+ clear_button.show()
separator = gtk.SeparatorToolItem()
separator.props.draw = False
@@ -60,6 +80,15 @@ class PaintToolbar(ToolbarBox):
def set_drawing(self, drawing):
self._drawing = drawing
+ self._update_buttons()
+
+ def _update_buttons(self):
+ width = self._drawing.get_stroke_width()
+ self._width_spin.props.value = width
+
+ def _width_spin_cb(self, width_spin):
+ width = width_spin.get_value_as_int()
+ self._drawing.set_stroke_width(width)
def _clear_drawing_canvas_cb(self, button):
logging.debug("clear canvas")