diff options
author | Josh Blum <josh@joshknows.com> | 2009-09-05 02:21:37 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2009-09-05 02:21:37 -0700 |
commit | fa465d160b0c53fae3ad7876cf429263157dd60a (patch) | |
tree | 12c1b47840f0f4af32ab43d9878fa725d092decf /grc/gui/Element.py | |
parent | 5bb2a70a94be9c0f83712ee259b7125e3a582b08 (diff) |
Created recursive create labels and shapes method for gui element.
Replaces update methods in the gui classes and simplifies calls.
The master update method in flow graph calls create labels and shapes.
Diffstat (limited to 'grc/gui/Element.py')
-rw-r--r-- | grc/gui/Element.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/grc/gui/Element.py b/grc/gui/Element.py index bda1870598..2e20b9a224 100644 --- a/grc/gui/Element.py +++ b/grc/gui/Element.py @@ -61,6 +61,21 @@ class Element(object): rotation = rotation or self.get_rotation() return rotation in (90, 270) + def create_labels(self): + """ + Create labels (if applicable) and call on all children. + Call this base method before creating labels in the element. + """ + for child in self.get_children(): child.create_labels() + + def create_shapes(self): + """ + Create shapes (if applicable) and call on all children. + Call this base method before creating shapes in the element. + """ + self.clear() + for child in self.get_children(): child.create_shapes() + def draw(self, gc, window, border_color, bg_color): """ Draw in the given window. @@ -216,7 +231,3 @@ class Element(object): if rotation not in POSSIBLE_ROTATIONS: raise Exception('"%s" is not one of the possible rotations: (%s)'%(rotation, POSSIBLE_ROTATIONS)) self.rotation = rotation - - def update(self): - """Do nothing for the update. Dummy method.""" - pass |