[PATCH] fix #2053 - Paint starts with a random color selected
Gonzalo Odiard
godiard at gmail.com
Fri Jun 18 00:49:22 EDT 2010
http://bugs.sugarlabs.org/ticket/2053
---
Area.py | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
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
--
1.7.0.1
--000e0cd355a60c78e8048946b2a9
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
0001-fix-2053-Paint-starts-with-a-random-color-selected.patch<br>[gonzalo at a=
ronax mainline]$ cat 0001-fix-2053-Paint-starts-with-a-random-color-selecte=
d.patch <br>From 260becfc6279bd871afe9fb4fb7f5dd9f0e7d59f Mon Sep 17 00:00:=
00 2001<br>
From: Gonzalo Odiard <<a href=3D"mailto:godiard at gmail.com">godiard at gmail=
.com</a>><br>Date: Fri, 18 Jun 2010 01:49:22 -0300<br>Subject: [PATCH] f=
ix #2053 - Paint starts with a random color selected<br><br><a href=3D"http=
://bugs.sugarlabs.org/ticket/2053">http://bugs.sugarlabs.org/ticket/2053</a=
><br>
---<br>=A0Area.py |=A0=A0 20 ++++++++++----------<br>=A01 files changed, 10=
insertions(+), 10 deletions(-)<br><br>diff --git a/Area.py b/Area.py<br>in=
dex ff9a29b..f610de3 100644<br>--- a/Area.py<br>+++ b/Area.py<br>@@ -218,23=
+218,24 @@ class Area(gtk.DrawingArea):<br>
=A0=A0=A0=A0=A0=A0=A0=A0 self.gc =3D win.new_gc()=A0=A0=A0 <br>=A0=A0=A0=A0=
=A0=A0=A0=A0 self.gc_eraser =3D win.new_gc()<br>=A0=A0=A0=A0=A0=A0=A0=A0 co=
lormap =3D self.get_colormap()<br>-=A0=A0=A0=A0=A0=A0=A0 white =3D colormap=
.alloc_color('#ffffff', True, True) # white=A0=A0=A0=A0=A0 <br>-=A0=
=A0=A0=A0=A0=A0=A0 self.gc_eraser.set_foreground(white)<br>
+=A0=A0=A0=A0=A0=A0=A0 self.white =3D colormap.alloc_color('#ffffff'=
;, True, True) # white<br>+=A0=A0=A0=A0=A0=A0=A0 self.black =3D colormap.al=
loc_color('#000000', True, True)=A0 # black<br>+<br>+=A0=A0=A0=A0=
=A0=A0=A0 self.gc_eraser.set_foreground(self.white)<br>
=A0=A0=A0=A0=A0=A0=A0=A0 self.gc_rainbow =3D win.new_gc()<br>=A0=A0=A0=A0=
=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0=A0 self.gc_brush =3D win.new_gc()=A0=
=A0=A0=A0=A0 <br>-=A0=A0=A0=A0=A0=A0=A0 self.gc_brush.set_foreground(white)=
<br>+=A0=A0=A0=A0=A0=A0=A0 self.gc_brush.set_foreground(self.black)<br>=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>
=A0=A0=A0=A0=A0=A0=A0=A0 self.gc_line =3D win.new_gc()=A0=A0 <br>=A0<br>=A0=
=A0=A0=A0=A0=A0=A0=A0 self.gc_selection =3D win.new_gc()=A0 <br>=A0=A0=A0=
=A0=A0=A0=A0=A0 self.gc_selection.set_line_attributes(1, gtk.gdk.LINE_ON_OF=
F_DASH, gtk.gdk.CAP_ROUND, gtk.gdk.JOIN_ROUND)<br>-=A0=A0=A0=A0=A0=A0=A0 bl=
ack =3D colormap.alloc_color('#000000', True, True)=A0 # black<br>
-=A0=A0=A0=A0=A0=A0=A0 self.gc_selection.set_foreground(black)<br>+=A0=A0=
=A0=A0=A0=A0=A0 self.gc_selection.set_foreground(self.black)<br>=A0=A0=A0=
=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0=A0 self.gc_selection1 =3D win.new=
_gc()=A0 #this make another white line out of the black line<br>
=A0=A0=A0=A0=A0=A0=A0=A0 self.gc_selection1.set_line_attributes(1, gtk.gdk.=
LINE_ON_OFF_DASH, gtk.gdk.CAP_ROUND, gtk.gdk.JOIN_ROUND)<br>-=A0=A0=A0=A0=
=A0=A0=A0 self.gc_selection1.set_foreground(white)<br>+=A0=A0=A0=A0=A0=A0=
=A0 self.gc_selection1.set_foreground(self.white)<br>
=A0=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=
=A0=A0=A0 self.enableUndo(self)<br>@@ -1080,10 +1081,9 @@ class Area(gtk.Dr=
awingArea):<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 'fill': a Boolean value<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 'vertices': a integer<br>
=A0=A0=A0=A0=A0=A0=A0=A0 '''<br>-=A0=A0=A0=A0=A0=A0=A0 logging.=
debug('Area.set_tool')<br>+=A0=A0=A0=A0=A0=A0=A0 logging.debug('=
;Area.set_tool %s',tool)<br>=A0=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=
=A0=A0=A0=A0 #FIXME: self.tool should be a dict too.<br>-=A0=A0=A0=A0=A0=A0=
=A0 print tool<br>
=A0=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0=A0 self.tool =3D tool<br=
>=A0=A0=A0=A0=A0=A0=A0=A0 <br>@@ -1095,13 +1095,13 @@ class Area(gtk.Drawin=
gArea):<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self.set_fill_c=
olor(self.tool['fill color'])<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 else:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 # use black<b=
r>
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self.set_fill_color( gtk.gdk=
.Color(0,0,0) )<br>+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self.set_=
fill_color(self.black)<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =
<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if self.tool['stroke color'=
;] is not None:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self.se=
t_stroke_color(self.tool['stroke color'])<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 else:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 # use black<br>-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 self.set_stroke_color( gtk.gdk.Color(0,0,0) )<br>+=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self.set_stroke_color(self.black)<br>=A0=A0=
=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0=A0 except AttributeError:<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 pass<br>-- <br>1.7.0.1<br><br>
--000e0cd355a60c78e8048946b2a9--
More information about the Sugar-devel
mailing list