From 260becfc6279bd871afe9fb4fb7f5dd9f0e7d59f Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Fri, 18 Jun 2010 04:49:22 +0000 Subject: fix #2053 - Paint starts with a random color selected http://bugs.sugarlabs.org/ticket/2053 --- diff --git a/Area.py b/Area.py index ff9a29b..f610de3 100644 --- a/Area.py +++ b/Area.py @@ -218,23 +218,24 @@ class Area(gtk.DrawingArea): self.gc = win.new_gc() self.gc_eraser = win.new_gc() colormap = self.get_colormap() - white = colormap.alloc_color('#ffffff', True, True) # white - self.gc_eraser.set_foreground(white) + self.white = colormap.alloc_color('#ffffff', True, True) # white + self.black = colormap.alloc_color('#000000', True, True) # black + + self.gc_eraser.set_foreground(self.white) self.gc_rainbow = win.new_gc() self.gc_brush = win.new_gc() - self.gc_brush.set_foreground(white) + self.gc_brush.set_foreground(self.black) self.gc_line = win.new_gc() self.gc_selection = win.new_gc() self.gc_selection.set_line_attributes(1, gtk.gdk.LINE_ON_OFF_DASH, gtk.gdk.CAP_ROUND, gtk.gdk.JOIN_ROUND) - black = colormap.alloc_color('#000000', True, True) # black - self.gc_selection.set_foreground(black) + self.gc_selection.set_foreground(self.black) self.gc_selection1 = win.new_gc() #this make another white line out of the black line self.gc_selection1.set_line_attributes(1, gtk.gdk.LINE_ON_OFF_DASH, gtk.gdk.CAP_ROUND, gtk.gdk.JOIN_ROUND) - self.gc_selection1.set_foreground(white) + self.gc_selection1.set_foreground(self.white) self.enableUndo(self) @@ -1080,10 +1081,9 @@ class Area(gtk.DrawingArea): 'fill': a Boolean value 'vertices': a integer ''' - logging.debug('Area.set_tool') + logging.debug('Area.set_tool %s',tool) #FIXME: self.tool should be a dict too. - print tool self.tool = tool @@ -1095,13 +1095,13 @@ class Area(gtk.DrawingArea): self.set_fill_color(self.tool['fill color']) else: # use black - self.set_fill_color( gtk.gdk.Color(0,0,0) ) + self.set_fill_color(self.black) if self.tool['stroke color'] is not None: self.set_stroke_color(self.tool['stroke color']) else: # use black - self.set_stroke_color( gtk.gdk.Color(0,0,0) ) + self.set_stroke_color(self.black) except AttributeError: pass -- cgit v0.9.1