summaryrefslogtreecommitdiff
path: root/grc/gui/Element.py
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2016-04-18 18:11:52 +0200
committerSeth Hitefield <sdhitefield@gmail.com>2016-05-24 13:02:23 -0400
commit5352dfd80fd238256da7bbd5efd15c154f3f5a14 (patch)
tree2221b54d0b7f7b42bd7f6e3fa521a6c9e8ded401 /grc/gui/Element.py
parente66cfa31ff52b95a9c3df27c8a1f3b02bef6db3d (diff)
gtk3: add flowgraph draw code and other gtk3 fixes (WIP)
Diffstat (limited to 'grc/gui/Element.py')
-rw-r--r--grc/gui/Element.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/grc/gui/Element.py b/grc/gui/Element.py
index 3f6017def7..30c0f5dba7 100644
--- a/grc/gui/Element.py
+++ b/grc/gui/Element.py
@@ -90,29 +90,33 @@ class Element(object):
self.clear()
for child in self.get_children(): child.create_shapes()
- def draw(self, gc, window, border_color, bg_color):
+ def draw(self, widget, cr, border_color, bg_color):
"""
Draw in the given window.
Args:
- gc: the graphics context
- window: the gtk window to draw on
+ widget:
+ cr:
border_color: the color for lines and rectangle borders
bg_color: the color for the inside of the rectangle
"""
X, Y = self.get_coordinate()
- gc.set_line_attributes(*self.line_attributes)
+ # TODO: gc.set_line_attributes(*self.line_attributes)
for (rX, rY), (W, H) in self._areas_list:
aX = X + rX
aY = Y + rY
- gc.set_foreground(bg_color)
- window.draw_rectangle(gc, True, aX, aY, W, H)
- gc.set_foreground(border_color)
- window.draw_rectangle(gc, False, aX, aY, W, H)
+ cr.set_source_rgb(*bg_color)
+ cr.rectangle(aX, aY, W, H)
+ cr.fill()
+ cr.set_source_rgb(*border_color)
+ cr.rectangle(aX, aY, W, H)
+ cr.stroke()
+
for (x1, y1), (x2, y2) in self._lines_list:
- gc.set_foreground(border_color)
- gc.set_background(bg_color)
- window.draw_line(gc, X+x1, Y+y1, X+x2, Y+y2)
+ cr.set_source_rgb(*border_color)
+ cr.move_to(X + x1, Y + y1)
+ cr.line_to(X + x2, Y + y2)
+ cr.stroke()
def rotate(self, rotation):
"""