Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/deka.py
diff options
context:
space:
mode:
authorAdam Schreiber <sadam@gnome.org>2009-05-09 13:08:47 (GMT)
committer Adam Schreiber <sadam@gnome.org>2009-05-09 13:08:47 (GMT)
commitf347b44f44bccc674b0af02ce17feeaffe6f83c3 (patch)
treecf6b4963e9aa9b767ad0e41001b116712f4286d3 /deka.py
parentd39561a045802295ec83c24f2dd588d071961e7b (diff)
Fix drawing of shapes out of windowHEADmaster
rect.x and rect.y when getting the allocation are given in window coordinates not in relation to the current drawing area.
Diffstat (limited to 'deka.py')
-rw-r--r--deka.py54
1 files changed, 30 insertions, 24 deletions
diff --git a/deka.py b/deka.py
index 1d4daf5..3321514 100644
--- a/deka.py
+++ b/deka.py
@@ -46,20 +46,20 @@ class DrawShapesArea(gtk.DrawingArea):
def draw (self, context):
rect = self.get_allocation()
context.set_source_rgba(0.0, 0.0, 0.0, 1.0)
- context.move_to (rect.x+rect.width/6, rect.y)
- context.line_to (rect.x+rect.width/6, rect.y + rect.height)
+ context.move_to (rect.width/6, 0)
+ context.line_to (rect.width/6, rect.height)
- context.move_to (rect.x+2*rect.width/6, rect.y)
- context.line_to (rect.x+2*rect.width/6, rect.y + rect.height)
+ context.move_to (2*rect.width/6, 0)
+ context.line_to (2*rect.width/6, rect.height)
- context.move_to (rect.x+3*rect.width/6, rect.y)
- context.line_to (rect.x+3*rect.width/6, rect.y + rect.height)
+ context.move_to (3*rect.width/6, 0)
+ context.line_to (3*rect.width/6, rect.height)
- context.move_to (rect.x+4*rect.width/6, rect.y)
- context.line_to (rect.x+4*rect.width/6, rect.y + rect.height)
+ context.move_to (4*rect.width/6, 0)
+ context.line_to (4*rect.width/6, rect.height)
- context.move_to (rect.x+5*rect.width/6, rect.y)
- context.line_to (rect.x+5*rect.width/6, rect.y + rect.height)
+ context.move_to (5*rect.width/6, 0)
+ context.line_to (5*rect.width/6, rect.height)
context.stroke()
@@ -70,8 +70,9 @@ class DrawShapesArea(gtk.DrawingArea):
else:
opacity = 0.25
- self.drawBar (context, rect.x + 5*rect.width/6 + n*rect.width/12,
- rect.y + m*rect.height/6, rect.width/12, rect.height/6, opacity)
+ self.drawBar (context, 5*rect.width/6 + n*rect.width/12,
+ m*rect.height/6 + (rect.height - 5*rect.height/6)/2,
+ rect.width/12, rect.height/6, opacity)
for m in range (0,5):
for n in range (0,2):
@@ -80,8 +81,9 @@ class DrawShapesArea(gtk.DrawingArea):
else:
opacity = 0.25
- self.drawCircle (context, rect.x + 4*rect.width/6 + n*rect.width/12,
- rect.y + m*rect.height/6, rect.width/12, rect.height/6, opacity)
+ self.drawCircle (context, 4*rect.width/6 + n*rect.width/12,
+ m*rect.height/6 + (rect.height - 5*rect.height/6)/2,
+ rect.width/12, rect.height/6, opacity)
for m in range (0,5):
for n in range (0,2):
@@ -89,10 +91,11 @@ class DrawShapesArea(gtk.DrawingArea):
opacity = 1
else:
opacity = 0.25
-
- self.drawTriangle (context, rect.x + 3*rect.width/6 + n*rect.width/12,
- rect.y + m*rect.height/6, rect.width/12, rect.height/6, opacity)
-
+
+ self.drawTriangle (context, 3*rect.width/6 + n*rect.width/12,
+ m*rect.height/6 + (rect.height - 5*rect.height/6)/2,
+ rect.width/12, rect.height/6, opacity)
+
for m in range (0,5):
for n in range (0,2):
if (((5-m) + ((n+1)%2)*5) <= self.thousands):
@@ -100,8 +103,9 @@ class DrawShapesArea(gtk.DrawingArea):
else:
opacity = 0.25
- self.drawSquare (context, rect.x + 2*rect.width/6 + n*rect.width/12,
- rect.y + m*rect.height/6, rect.width/12, rect.height/6, opacity)
+ self.drawSquare (context, + 2*rect.width/6 + n*rect.width/12,
+ m*rect.height/6 + (rect.height - 5*rect.height/6)/2,
+ rect.width/12, rect.height/6, opacity)
for m in range (0,5):
for n in range (0,2):
@@ -110,8 +114,9 @@ class DrawShapesArea(gtk.DrawingArea):
else:
opacity = 0.25
- self.drawPentagon (context, rect.x + 1*rect.width/6 + n*rect.width/12,
- rect.y + m*rect.height/6, rect.width/12, rect.height/6, opacity)
+ self.drawPentagon (context, + 1*rect.width/6 + n*rect.width/12,
+ m*rect.height/6 + (rect.height - 5*rect.height/6)/2,
+ rect.width/12, rect.height/6, opacity)
for m in range (0,5):
for n in range (0,2):
if (((5-m) + ((n+1)%2)*5) <= self.hundredthousands):
@@ -119,8 +124,9 @@ class DrawShapesArea(gtk.DrawingArea):
else:
opacity = 0.25
- self.drawHexagon (context, rect.x + 0*rect.width/6 + n*rect.width/12,
- rect.y + m*rect.height/6, rect.width/12, rect.height/6, opacity)
+ self.drawHexagon (context, + 0*rect.width/6 + n*rect.width/12,
+ m*rect.height/6 + (rect.height - 5*rect.height/6)/2,
+ rect.width/12, rect.height/6, opacity)
def set_count (self, count):
val = int(count)