diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2014-12-03 16:12:13 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2014-12-03 16:27:29 +0100 |
commit | 9372ec7daf7856de7c0e1fe782836a5c722c1473 (patch) | |
tree | dec96bd4ed28f41979d0362506a05bce9165be2b /grc/gui/Element.py | |
parent | ef95b0ea9d49c0f2cc29a1b135df5133cddb0f80 (diff) |
grc: per element line styles (for custom domain ports and message connections)
Diffstat (limited to 'grc/gui/Element.py')
-rw-r--r-- | grc/gui/Element.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/grc/gui/Element.py b/grc/gui/Element.py index 95a4e2edab..67e8e10916 100644 --- a/grc/gui/Element.py +++ b/grc/gui/Element.py @@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA from Constants import LINE_SELECT_SENSITIVITY from Constants import POSSIBLE_ROTATIONS +import gtk + + class Element(object): """ GraphicalElement is the base class for all graphical elements. @@ -35,6 +38,9 @@ class Element(object): self.set_coordinate((0, 0)) self.clear() self.set_highlighted(False) + self.line_attributes = [ + 0, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER + ] def is_horizontal(self, rotation=None): """ @@ -89,15 +95,16 @@ class Element(object): border_color: the color for lines and rectangle borders bg_color: the color for the inside of the rectangle """ - X,Y = self.get_coordinate() - for (rX,rY),(W,H) in self._areas_list: + X, Y = self.get_coordinate() + 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) - for (x1, y1),(x2, y2) in self._lines_list: + for (x1, y1), (x2, y2) in self._lines_list: gc.set_foreground(border_color) window.draw_line(gc, X+x1, Y+y1, X+x2, Y+y2) |