Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/chat/sketchpad
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2006-05-22 02:20:37 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2006-05-22 02:20:37 (GMT)
commit325fb8ff252e933aada3d6fccffa58e00c12f05b (patch)
treefe0606d129498869a38244b0b6653619fc183cc9 /sugar/chat/sketchpad
parent3841ac9983df5e8307ad2aa2ffa89edf7aa23030 (diff)
Add an emoticons menu
Diffstat (limited to 'sugar/chat/sketchpad')
-rw-r--r--sugar/chat/sketchpad/Sketch.py13
-rw-r--r--sugar/chat/sketchpad/SketchPad.py10
-rw-r--r--sugar/chat/sketchpad/Toolbox.py10
3 files changed, 8 insertions, 25 deletions
diff --git a/sugar/chat/sketchpad/Sketch.py b/sugar/chat/sketchpad/Sketch.py
index 3504b83..8c70f8d 100644
--- a/sugar/chat/sketchpad/Sketch.py
+++ b/sugar/chat/sketchpad/Sketch.py
@@ -1,27 +1,25 @@
from SVGdraw import path
class Sketch:
- def __init__(self, rgb):
+ def __init__(self):
self._points = []
- self._rgb = (float(rgb[0]), float(rgb[1]), float(rgb[2]))
def add_point(self, x, y):
- self._points.append((x, y))
+ self._points.append([x, y])
def draw(self, ctx):
start = True
- for (x, y) in self._points:
+ for [x, y] in self._points:
if start:
ctx.move_to(x, y)
start = False
else:
ctx.line_to(x, y)
- ctx.set_source_rgb(self._rgb[0], self._rgb[1], self._rgb[2])
ctx.stroke()
def draw_to_svg(self):
i = 0
- for (x, y) in self._points:
+ for [x, y] in self._points:
coords = str(x) + ' ' + str(y) + ' '
if i == 0:
path_data = 'M ' + coords
@@ -30,5 +28,4 @@ class Sketch:
else:
path_data += coords
i += 1
- color = "#%02X%02X%02X" % (255 * self._rgb[0], 255 * self._rgb[1], 255 * self._rgb[2])
- return path(path_data, fill = 'none', stroke = color)
+ return path(path_data, fill = 'none', stroke = '#000000')
diff --git a/sugar/chat/sketchpad/SketchPad.py b/sugar/chat/sketchpad/SketchPad.py
index d19ca40..9319378 100644
--- a/sugar/chat/sketchpad/SketchPad.py
+++ b/sugar/chat/sketchpad/SketchPad.py
@@ -13,7 +13,6 @@ class SketchPad(gtk.DrawingArea):
gtk.DrawingArea.__init__(self)
self._active_sketch = None
- self._rgb = (0.0, 0.0, 0.0)
self._sketches = []
self.add_events(gtk.gdk.BUTTON_PRESS_MASK |
@@ -24,7 +23,6 @@ class SketchPad(gtk.DrawingArea):
self.connect('expose_event', self.expose)
def expose(self, widget, event):
- """Draw the background of the sketchpad."""
rect = self.get_allocation()
ctx = widget.window.cairo_create()
@@ -40,11 +38,6 @@ class SketchPad(gtk.DrawingArea):
return False
- def set_color(self, color):
- """Sets the current drawing color of the sketchpad.
- color agument should be 3-item tuple of rgb values between 0 and 1."""
- self._rgb = color
-
def add_sketch(self, sketch):
self._sketches.append(sketch)
@@ -54,7 +47,7 @@ class SketchPad(gtk.DrawingArea):
self.window.invalidate_rect(None, False)
def __button_press_cb(self, widget, event):
- self._active_sketch = Sketch(self._rgb)
+ self._active_sketch = Sketch()
self.add_sketch(self._active_sketch)
self.add_point(event)
@@ -66,7 +59,6 @@ class SketchPad(gtk.DrawingArea):
self.add_point(event)
def to_svg(self):
- """Return a string containing an SVG representation of this sketch."""
d = drawing()
s = svg()
for sketch in self._sketches:
diff --git a/sugar/chat/sketchpad/Toolbox.py b/sugar/chat/sketchpad/Toolbox.py
index 7ed814a..bf56ccc 100644
--- a/sugar/chat/sketchpad/Toolbox.py
+++ b/sugar/chat/sketchpad/Toolbox.py
@@ -18,9 +18,6 @@ class ColorButton(gtk.RadioButton):
self.add(drawing_area)
drawing_area.show()
- def color(self):
- return self._rgb
-
def expose(self, widget, event):
rect = widget.get_allocation()
ctx = widget.window.cairo_create()
@@ -34,9 +31,7 @@ class ColorButton(gtk.RadioButton):
class Toolbox(gtk.VBox):
__gsignals__ = {
'tool-selected': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
- ([gobject.TYPE_STRING])),
- 'color-selected': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
- ([gobject.TYPE_PYOBJECT]))
+ ([gobject.TYPE_STRING]))
}
def __init__(self):
@@ -101,5 +96,4 @@ class Toolbox(gtk.VBox):
self.emit("tool-selected", tool_id)
def __color_clicked_cb(self, button, rgb):
- self.emit("color-selected", button.color())
-
+ pass