diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2010-05-20 05:51:30 (GMT) |
---|---|---|
committer | Gonzalo Odiard <gonzalo@nautilus.localdomain> | 2010-06-09 16:18:44 (GMT) |
commit | f748e6f8f07e03467b8915eabd125a556dc8e599 (patch) | |
tree | 98c0981c005f1af22c51c76b012b8276fbcb3fc2 | |
parent | b4996da5eff9ee62d27671da6134fbee80d93b72 (diff) |
fix #931 - Make "keep aspect ratio" selection visible in the UI.
Tested-by: James Cameron <quozl@laptop.org>
Signed-off-by: James Cameron <quozl@laptop.org>
-rw-r--r-- | Area.py | 5 | ||||
-rw-r--r-- | toolbox.py | 19 |
2 files changed, 21 insertions, 3 deletions
@@ -155,6 +155,7 @@ class Area(gtk.DrawingArea): self.line_shape = 'circle' self.last = [] self.rainbow_counter = 0 + self.keep_aspect_ratio = False self.font = pango.FontDescription('Sans 9') self._set_selection_bounds(0,0,0,0) @@ -378,7 +379,7 @@ class Area(gtk.DrawingArea): self.d.square(widget,event,coords,True,self.tool['fill']) elif self.tool['name'] == 'marquee-rectangular' and not self.selmove: - if state & gtk.gdk.CONTROL_MASK: + if (state & gtk.gdk.CONTROL_MASK) or self.keep_aspect_ratio: coords = self._keep_selection_ratio(coords) self.d.selection(widget,coords) # selected @@ -462,7 +463,7 @@ class Area(gtk.DrawingArea): elif self.tool['name'] == 'marquee-rectangular': if self.selmove == False: - if event.state & gtk.gdk.CONTROL_MASK: + if (event.state & gtk.gdk.CONTROL_MASK) or self.keep_aspect_ratio: coords = self._keep_selection_ratio(coords) self.d.selection(widget,coords,False) self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR)) @@ -357,6 +357,11 @@ class ToolsToolbar(gtk.Toolbar): self._tool_marquee_rectangular = ToolButton('tool-marquee-rectangular') self.insert(self._tool_marquee_rectangular, -1) self._tool_marquee_rectangular.set_tooltip(_('Rectangular Marquee')) + try: + self._configure_palette(self._tool_marquee_rectangular, self._TOOL_MARQUEE_RECTANGULAR) + except: + logging.debug('Could not create palette for tool Rectangular Marquee') + # New connect method # Using dictionnaries to control tool's properties @@ -483,7 +488,7 @@ class ToolsToolbar(gtk.Toolbar): label.show() colorbutton = ButtonFillColor(self._activity) - colorbutton.show() + colorbutton.show_all() hbox.pack_start(label) hbox.pack_start(colorbutton) @@ -493,8 +498,20 @@ class ToolsToolbar(gtk.Toolbar): content_box.pack_start(hbox) colorbutton.connect_after('color-set', self._on_color_set, self._TOOL_POLYGON) + if tool['name'] is self._TOOL_MARQUEE_RECTANGULAR['name']: + # Creating a CheckButton named "Fill". + keep_aspect_checkbutton = gtk.CheckButton(_('Keep aspect')) + keep_aspect_checkbutton.show() + keep_aspect_checkbutton.set_active(self._activity.area.keep_aspect_ratio) + + keep_aspect_checkbutton.connect('toggled', self._keep_aspect_checkbutton_toggled, widget) + palette.action_bar.pack_start(keep_aspect_checkbutton) + def _keep_aspect_checkbutton_toggled(self, checkbutton, button=None): + logging.debug('Keep aspect is Active: %s', checkbutton.get_active()) + self._activity.area.keep_aspect_ratio = checkbutton.get_active() + def set_shape(self, widget=None, tool=None, shape=None): """ Set a tool shape according to user choice at Tool Palette |